dsh-gufa-code 1.3.93 → 1.3.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client.js +1 -1
- package/desktop/float/bin/gufa-float-macos-arm64 +0 -0
- package/desktop/float/bin/gufa-float-macos-universal +0 -0
- package/desktop/float/bin/gufa-float-macos-x64 +0 -0
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/Info.plist +2 -2
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/MacOS/gufa-float +0 -0
- package/docs/KNOWN-PITFALLS.md +7 -0
- package/host/fs.js +35 -9
- package/package.json +1 -1
- package/scripts/selftest-host.mjs +14 -0
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ dsh plugin add dsh-gufa-code
|
|
|
38
38
|
|
|
39
39
|
### 编辑器
|
|
40
40
|
|
|
41
|
-
- Monaco 编辑器(离线随包分发,无需联网下载);
|
|
41
|
+
- Monaco 编辑器(离线随包分发,无需联网下载);Monaco 自带 81 种语言全部映射(ABAP、Apex、Clojure、Elixir、F#、GraphQL、HCL/Terraform、Julia、Objective-C、Pascal、Perl、Protobuf、R、RST、Scheme、Solidity、SystemVerilog/Verilog、Tcl、TypeSpec、VB、WGSL、Bicep、Batch、CoffeeScript、Cypher、DAX、Logstash/ECL、MIPS、Power Query、Q#、Redis、SPARQL、Structured Text、Modula-3、ATS、Pony 系列等);
|
|
42
42
|
- **HTML 模板语法高亮**:EJS / Eta、ERB、Nunjucks / Jinja2(`.njk/.nunjucks/.jinja/.jinja2/.j2`)、Blade(`.blade.php`)、Haml、Slim,以及 Monaco 内置的 Handlebars / Mustache / Pug / Twig / Liquid / Razor / FreeMarker;扩展名自动识别;
|
|
43
43
|
- 多标签、按扩展名语法高亮、面包屑、状态栏(分支 / 行列 / 保存状态);
|
|
44
44
|
- **Copilot 风格 Tab 行内补全**:光标停/打字后,基于 Harness 自己的 DeepSeek 模型(默认 `deepseek-flash`,不需要额外 Copilot 订阅)流式生成灰色 ghost text,Tab 接受、Esc 忽略;支持 JS/TS/Python/Java/Go/Rust/C++/C#/JSON/YAML/Shell 等常见语言;
|
package/client.js
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<key>CFBundleDisplayName</key><string>古法编程悬浮层</string>
|
|
8
8
|
<key>CFBundleExecutable</key><string>gufa-float</string>
|
|
9
9
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
10
|
-
<key>CFBundleShortVersionString</key><string>1.3.
|
|
11
|
-
<key>CFBundleVersion</key><string>1.3.
|
|
10
|
+
<key>CFBundleShortVersionString</key><string>1.3.94</string>
|
|
11
|
+
<key>CFBundleVersion</key><string>1.3.94</string>
|
|
12
12
|
<key>LSUIElement</key><true/>
|
|
13
13
|
<key>NSHighResolutionCapable</key><true/>
|
|
14
14
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
|
Binary file
|
package/docs/KNOWN-PITFALLS.md
CHANGED
|
@@ -46,6 +46,13 @@
|
|
|
46
46
|
- `host/fs.js` 的 `LANG_BY_EXT` 决定 `.ejs/.njk/...` 返回哪个 language id;`.blade.php` 双扩展名要在 `languageOf` 里先特判,否则会命中 `php`。
|
|
47
47
|
- 自定义 tokenizer 是「HTML + 模板分隔符里的代码」简化版,不提供语义服务;Monarch 里 `@brackets`、`blockComment` 状态要各自定义,且 `htmlTag` 状态里 `/>` 要在 `>` 之前。
|
|
48
48
|
|
|
49
|
+
## 0.10 Monaco 语言映射审计(1.3.94)
|
|
50
|
+
|
|
51
|
+
- Monaco basic-languages 里注册的 81 种语言,扩展名表在 `vendor/monaco/vs/editor/editor.main.js` 里;`host/fs.js` 的 `LANG_BY_EXT` 必须全部覆盖,否则打开文件会落到 plaintext。
|
|
52
|
+
- 审计脚本思路:从 `editor.main.js` 抓 `id:"x" ... extensions:[...]`(注意 `aliases` 可能夹在 `id` 与 `extensions` 之间,正则要允许中间内容),再对比 `LANG_BY_EXT` 的值集合。
|
|
53
|
+
- 有多个语言共享扩展名(`.p` Pascal、`.m` Objective-C、`.v` Verilog、`.cls` Apex、`.pp` Ruby/Pascal、`.s` MIPS、`.config` XML 等)时,按 Monaco 默认取一个;用户项目里如果扩展名含义不同,改 `LANG_BY_EXT` 一行即可。
|
|
54
|
+
- 点开头文件(`.babelrc/.eslintrc/.jshintrc/.jscsrc/.bowerrc` → json、`.gitconfig` → ini、`.rprofile` → r)要在 `languageOf` 的 `lastIndexOf('.')` 之前特判,否则会被当成 plaintext。
|
|
55
|
+
|
|
49
56
|
## 1. 弹窗/菜单层级:只有一个正确做法(反复踩过多次,最终定案)
|
|
50
57
|
|
|
51
58
|
**现象**:弹窗被右侧「古法 AI」聊天栏压住、只显示一半、关闭按钮点不到;或者反过来把官方设置/会话弹窗盖住。
|
package/host/fs.js
CHANGED
|
@@ -21,12 +21,14 @@ const LIST_LIMIT = 4000
|
|
|
21
21
|
|
|
22
22
|
/** 扩展名 → Monaco language id(与 VS Code 常用映射一致)。 */
|
|
23
23
|
export const LANG_BY_EXT = {
|
|
24
|
-
js: 'javascript', jsx: 'javascript', mjs: 'javascript', cjs: 'javascript',
|
|
24
|
+
js: 'javascript', jsx: 'javascript', mjs: 'javascript', cjs: 'javascript', es6: 'javascript',
|
|
25
25
|
ts: 'typescript', tsx: 'typescript', mts: 'typescript', cts: 'typescript',
|
|
26
|
-
json: 'json', jsonc: 'json', json5: 'json',
|
|
27
|
-
md: 'markdown', markdown: 'markdown',
|
|
26
|
+
json: 'json', jsonc: 'json', json5: 'json', bowerrc: 'json', jshintrc: 'json', jscsrc: 'json', eslintrc: 'json', babelrc: 'json', har: 'json',
|
|
27
|
+
md: 'markdown', markdown: 'markdown', mdown: 'markdown', mkdn: 'markdown', mkd: 'markdown', mdwn: 'markdown', mdtxt: 'markdown', mdtext: 'markdown',
|
|
28
28
|
css: 'css', scss: 'scss', less: 'less',
|
|
29
29
|
html: 'html', htm: 'html', vue: 'html', svelte: 'html', astro: 'html',
|
|
30
|
+
shtml: 'html', xhtml: 'html', mdoc: 'html', jsp: 'html', asp: 'html', aspx: 'html', jshtm: 'html',
|
|
31
|
+
mdx: 'mdx',
|
|
30
32
|
ejs: 'ejs', eta: 'ejs',
|
|
31
33
|
hbs: 'handlebars', handlebars: 'handlebars', mustache: 'handlebars',
|
|
32
34
|
pug: 'pug', jade: 'pug',
|
|
@@ -35,12 +37,32 @@ export const LANG_BY_EXT = {
|
|
|
35
37
|
erb: 'erb', rhtml: 'erb',
|
|
36
38
|
haml: 'haml', slim: 'slim',
|
|
37
39
|
xml: 'xml', svg: 'xml', plist: 'xml', csproj: 'xml',
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
xsd: 'xml', dtd: 'xml', ascx: 'xml', config: 'xml', props: 'xml', targets: 'xml',
|
|
41
|
+
wxi: 'xml', wxl: 'xml', wxs: 'xml', xaml: 'xml', svgz: 'xml', opf: 'xml', xslt: 'xml', xsl: 'xml',
|
|
42
|
+
yaml: 'yaml', yml: 'yaml', toml: 'ini', ini: 'ini', cfg: 'ini', conf: 'ini', properties: 'ini', env: 'ini', gitconfig: 'ini',
|
|
43
|
+
py: 'python', pyw: 'python', rpy: 'python', cpy: 'python', gyp: 'python', gypi: 'python',
|
|
44
|
+
sh: 'shell', bash: 'shell', zsh: 'shell', fish: 'shell', ps1: 'powershell', psm1: 'powershell', psd1: 'powershell',
|
|
45
|
+
bat: 'bat', cmd: 'bat', azcli: 'azcli', bicep: 'bicep', abap: 'abap', apex: 'apex', cls: 'apex',
|
|
46
|
+
clj: 'clojure', cljs: 'clojure', cljc: 'clojure', edn: 'clojure',
|
|
47
|
+
coffee: 'coffeescript', csp: 'csp', cypher: 'cypher', cyp: 'cypher', ecl: 'ecl',
|
|
48
|
+
ex: 'elixir', exs: 'elixir', flow: 'flow9', fs: 'fsharp', fsi: 'fsharp', ml: 'fsharp', mli: 'fsharp', fsx: 'fsharp', fsscript: 'fsharp',
|
|
49
|
+
graphql: 'graphql', gql: 'graphql', tf: 'hcl', tfvars: 'hcl', hcl: 'hcl', jl: 'julia',
|
|
50
|
+
lex: 'lexon', m3: 'm3', i3: 'm3', mg: 'm3', ig: 'm3', s: 'mips',
|
|
51
|
+
dax: 'msdax', msdax: 'msdax', m: 'objective-c', pas: 'pascal', p: 'pascal',
|
|
52
|
+
ligo: 'pascaligo', pl: 'perl', pm: 'perl', pla: 'pla', dats: 'postiats', sats: 'postiats', hats: 'postiats',
|
|
53
|
+
pq: 'powerquery', pqm: 'powerquery', proto: 'proto', qs: 'qsharp',
|
|
54
|
+
r: 'r', rhistory: 'r', rmd: 'r', rt: 'r', redis: 'redis', rst: 'restructuredtext',
|
|
55
|
+
sb: 'sb', scm: 'scheme', ss: 'scheme', sch: 'scheme', rkt: 'scheme',
|
|
56
|
+
sol: 'sol', rq: 'sparql', st: 'st', iecst: 'st', iecplc: 'st', lc3lib: 'st',
|
|
57
|
+
sv: 'systemverilog', svh: 'systemverilog', v: 'verilog', vh: 'verilog',
|
|
58
|
+
tcl: 'tcl', tsp: 'typespec', vb: 'vb', wgsl: 'wgsl',
|
|
59
|
+
verilog: 'verilog', systemverilog: 'systemverilog',
|
|
60
|
+
lua: 'lua', java: 'java', jav: 'java', c: 'c', h: 'c', cpp: 'cpp', cc: 'cpp', cxx: 'cpp', hpp: 'cpp', hxx: 'cpp', hh: 'cpp',
|
|
61
|
+
cs: 'csharp', csx: 'csharp', cake: 'csharp', go: 'go', rs: 'rust', rlib: 'rust',
|
|
62
|
+
rb: 'ruby', rbx: 'ruby', rjs: 'ruby', gemspec: 'ruby',
|
|
63
|
+
php: 'php', php4: 'php', php5: 'php', phtml: 'php', ctp: 'php', sql: 'sql',
|
|
64
|
+
swift: 'swift', kt: 'kotlin', kts: 'kotlin', dart: 'dart', scala: 'scala', sc: 'scala', sbt: 'scala',
|
|
65
|
+
ftlh: 'freemarker2', ftlx: 'freemarker2',
|
|
44
66
|
dockerfile: 'dockerfile', makefile: 'makefile', cmake: 'cmake',
|
|
45
67
|
txt: 'plaintext', log: 'plaintext', gitignore: 'plaintext', lock: 'plaintext',
|
|
46
68
|
}
|
|
@@ -51,6 +73,10 @@ export function languageOf(path) {
|
|
|
51
73
|
if (/^makefile$/i.test(base)) return 'makefile'
|
|
52
74
|
if (/^\.?gitignore$/i.test(base) || /^\.?env/i.test(base)) return 'plaintext'
|
|
53
75
|
if (/\.blade\.php$/i.test(base)) return 'blade'
|
|
76
|
+
/* 以点开头的 JSON/INI/R 配置文件名(Monaco/json 默认支持这些) */
|
|
77
|
+
if (/^\.(?:babelrc|eslintrc|jshintrc|jscsrc|bowerrc)$/i.test(base)) return 'json'
|
|
78
|
+
if (/^\.gitconfig$/i.test(base)) return 'ini'
|
|
79
|
+
if (/^\.rprofile$/i.test(base)) return 'r'
|
|
54
80
|
const dot = base.lastIndexOf('.')
|
|
55
81
|
if (dot <= 0) return 'plaintext'
|
|
56
82
|
return LANG_BY_EXT[base.slice(dot + 1).toLowerCase()] ?? 'plaintext'
|
package/package.json
CHANGED
|
@@ -112,6 +112,20 @@ try {
|
|
|
112
112
|
const afterDelete = await call(router, 'fs.list', { root, path: 'src' })
|
|
113
113
|
check('delete applied', !afterDelete.entries.some((entry) => entry.name === 'helper.ts'))
|
|
114
114
|
|
|
115
|
+
console.log('fs.languageOf (Monaco 语言映射)')
|
|
116
|
+
const languageCases = [
|
|
117
|
+
['a.ejs', 'ejs'], ['a.eta', 'ejs'], ['a.erb', 'erb'], ['a.html.erb', 'erb'],
|
|
118
|
+
['a.njk', 'jinja'], ['a.jinja2', 'jinja'], ['a.hbs', 'handlebars'], ['a.mustache', 'handlebars'],
|
|
119
|
+
['a.pug', 'pug'], ['a.twig', 'twig'], ['a.liquid', 'liquid'], ['a.blade.php', 'blade'],
|
|
120
|
+
['a.haml', 'haml'], ['a.slim', 'slim'], ['a.mdx', 'mdx'],
|
|
121
|
+
['a.abap', 'abap'], ['a.cls', 'apex'], ['a.bat', 'bat'], ['a.clj', 'clojure'],
|
|
122
|
+
['a.coffee', 'coffeescript'], ['a.graphql', 'graphql'], ['a.tf', 'hcl'], ['a.jl', 'julia'],
|
|
123
|
+
['a.m', 'objective-c'], ['a.pas', 'pascal'], ['a.pl', 'perl'], ['a.proto', 'proto'],
|
|
124
|
+
['a.r', 'r'], ['a.rst', 'restructuredtext'], ['a.sol', 'sol'], ['a.sv', 'systemverilog'],
|
|
125
|
+
['a.tcl', 'tcl'], ['a.tsp', 'typespec'], ['a.vb', 'vb'], ['a.wgsl', 'wgsl'],
|
|
126
|
+
['.babelrc', 'json'], ['.gitconfig', 'ini'],
|
|
127
|
+
]
|
|
128
|
+
for (const [file, expected] of languageCases) check(`languageOf ${file} -> ${expected}`, fs.languageOf(file) === expected, fs.languageOf(file))
|
|
115
129
|
console.log('fs.search')
|
|
116
130
|
await call(router, 'fs.create', { root, path: 'search.txt', kind: 'file' })
|
|
117
131
|
await call(router, 'fs.write', { root, path: 'search.txt', content: 'Alpha beta\nBETA gamma\nbeta BETA\n' })
|