Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ pnpm-lock.yaml
*.json
!config*.json
go.mod
.RData
.Rhistory
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发
<img src="public/icons/java.svg" width="60" alt="Java">
<img src="public/icons/javascript-browser.svg" width="60" alt="JavaScript (Browser)">
<img src="public/icons/javascript-jquery.svg" width="60" alt="JavaScript (jQuery)">
<img src="public/icons/nodejs.svg" width="60" alt="JavaScript (Node.js)">
<img src="public/icons/javascript-nodejs.svg" width="60" alt="JavaScript (Node.js)">
<img src="public/icons/kotlin.svg" width="60" alt="Kotlin">
<img src="public/icons/nodejs.svg" width="60" alt="Node.js">
<img src="public/icons/php.svg" width="60" alt="PHP">
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/plugins/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl LanguagePlugin for ShellPlugin {
}

fn get_language_name(&self) -> &'static str {
"Shell"
"ShellScript"
}

fn get_language_key(&self) -> &'static str {
Expand Down
27 changes: 14 additions & 13 deletions src/composables/useCodeMirrorFunctionHelp.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import { EditorView, hoverTooltip } from '@codemirror/view'
1
import {EditorView, hoverTooltip} from '@codemirror/view'

export function useCodeMirrorFunctionHelp()
{
// 提示框
const createHelpTooltip = (text: string) => {
const dom = document.createElement('div')
dom.className = 'cm-function-help-tooltip'
dom.className = 'cm-custom-function-tooltip'

dom.innerHTML = `
<div class="relative mb-1">
<div class="px-2 py-1 bg-gray-800 text-white text-xs rounded">
<span class="font-mono">${ text }</span>
<span class="font-mono">${text}</span>
</div>
<!-- 小三角箭头 -->
<div class="absolute left-1/2 transform -translate-x-1/2 top-full">
<div class="w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-800"></div>
</div>
</div>
`

return { dom }
return {dom}
}

// 显示函数提示扩展
const showFunctionHelpHover = hoverTooltip((view, pos, side) => {
let { from, to, text } = view.state.doc.lineAt(pos)
let {from, to, text} = view.state.doc.lineAt(pos)
let start = pos, end = pos
while (start > from && /\w/.test(text[start - from - 1])) {
start--
Expand All @@ -44,20 +43,22 @@ export function useCodeMirrorFunctionHelp()
return createHelpTooltip(text.slice(start - from, end - from))
}
}
}, { hoverTime: 300 })
}, {hoverTime: 300})

// 提示框样式主题
const functionHelpTheme = EditorView.theme({
'.cm-function-help-tooltip': {
'.cm-custom-function-tooltip': {
zIndex: '100',
animation: 'fadeIn 0.2s ease-out'
},
'.cm-tooltip': {
border: 'none !important'
'.cm-tooltip.cm-tooltip-hover': {
backgroundColor: 'transparent !important',
border: 'none !important',
boxShadow: 'none !important'
},
'@keyframes fadeIn': {
'from': { opacity: '0', transform: 'translateY(-2px)' },
'to': { opacity: '1', transform: 'translateY(0)' }
'from': {opacity: '0', transform: 'translateY(-2px)'},
'to': {opacity: '1', transform: 'translateY(0)'}
}
})

Expand Down
Loading