dsh-ide-window 0.0.0-stage → 0.1.1
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/AGENTS.md +360 -0
- package/LICENSE +21 -0
- package/README.md +413 -2
- package/client.js +10798 -0
- package/cordis.patch.yml +4 -0
- package/enable-navigation.ps1 +209 -0
- package/enable-navigation.sh +131 -0
- package/icon.svg +25 -0
- package/index.js +1352 -0
- package/install.ps1 +208 -0
- package/install.sh +198 -0
- package/locale/en.json +217 -0
- package/locale/zh.json +217 -0
- package/package.json +68 -4
- package/platform/contract.js +46 -0
- package/platform/index.js +29 -0
- package/platform/macos.js +30 -0
- package/platform/windows.js +37 -0
package/locale/zh.json
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "代码工作区",
|
|
4
|
+
"description": "把中央区域切成 IDEA 风格的工作区:左侧工作区文件树、编辑标签页与实时刷新的源码视图,同时隐藏左侧导航栏。"
|
|
5
|
+
},
|
|
6
|
+
"title": "代码工作区",
|
|
7
|
+
"subtitle": "工作区",
|
|
8
|
+
"files": "文件",
|
|
9
|
+
"showFiles": "显示文件树",
|
|
10
|
+
"hideFiles": "隐藏文件树",
|
|
11
|
+
"refresh": "刷新",
|
|
12
|
+
"refreshTree": "重新读取文件树",
|
|
13
|
+
"openInIde": "在编辑器中打开",
|
|
14
|
+
"backToChat": "对话",
|
|
15
|
+
"backToChatHint": "回到对话面板",
|
|
16
|
+
"noWorkspace": "当前会话没有绑定工作区目录。",
|
|
17
|
+
"noWorkspaceHint": "请先在对话里选择一个工作区,再回到这里浏览文件。",
|
|
18
|
+
"loading": "加载中…",
|
|
19
|
+
"loadingTree": "正在读取目录…",
|
|
20
|
+
"emptyDir": "空目录",
|
|
21
|
+
"errorPrefix": "错误:",
|
|
22
|
+
"truncated": "条目过多,仅显示前一部分。",
|
|
23
|
+
"closeTab": "关闭",
|
|
24
|
+
"closeOtherTabs": "关闭其他标签",
|
|
25
|
+
"closeAllTabs": "全部关闭",
|
|
26
|
+
"fileNotText": "这个文件不是可显示的文本,或体积超出上限。",
|
|
27
|
+
"fileTooLarge": "文件过大,未加载全文。",
|
|
28
|
+
"linesSuffix": "行",
|
|
29
|
+
"line": "行",
|
|
30
|
+
"language": "语言",
|
|
31
|
+
"utf8": "UTF-8",
|
|
32
|
+
"copyPath": "复制路径",
|
|
33
|
+
"copied": "已复制",
|
|
34
|
+
"live": "实时",
|
|
35
|
+
"liveOn": "实时刷新已开启",
|
|
36
|
+
"liveOff": "实时刷新已关闭",
|
|
37
|
+
"updated": "已更新",
|
|
38
|
+
"openTabHint": "点击文件在右侧打开",
|
|
39
|
+
"searchPlaceholder": "搜索文件名(⌘P / Ctrl+P)",
|
|
40
|
+
"noMatch": "没有匹配的文件",
|
|
41
|
+
"treeWidthHint": "拖动调整文件树宽度",
|
|
42
|
+
"toggleChat": "显示/隐藏对话",
|
|
43
|
+
"reload": "重新加载",
|
|
44
|
+
"settings": "设置",
|
|
45
|
+
"readOnly": "只读",
|
|
46
|
+
"watchUnsupported": "这个目录不支持文件监听,已改为手动刷新。",
|
|
47
|
+
"toggleNav": "显示/隐藏左侧导航栏",
|
|
48
|
+
"jumpFailed": "无法跳转到该文件(不在当前工作区内)",
|
|
49
|
+
"jumpOn": "引用跳转:开",
|
|
50
|
+
"jumpOff": "引用跳转:关",
|
|
51
|
+
"noDefinition": "未找到定义",
|
|
52
|
+
"indexing": "索引",
|
|
53
|
+
"noUsages": "没有已知调用点",
|
|
54
|
+
"lspFailed": "代码导航不可用(LSP)",
|
|
55
|
+
"querying": "正在查询语言服务器…",
|
|
56
|
+
"truncatedLines": "文件过大,仅加载前 {n} 行",
|
|
57
|
+
"tabImplements": "实现",
|
|
58
|
+
"tabCallers": "调用方",
|
|
59
|
+
"tabDeclaration": "声明",
|
|
60
|
+
"maybeIndexing": "(若刚启动,请等索引完成后重试)",
|
|
61
|
+
"searching": "搜索中…",
|
|
62
|
+
"searchResults": "个结果",
|
|
63
|
+
"searchTruncated": "(结果已截断)",
|
|
64
|
+
"noSearchResults": "没有匹配的文件",
|
|
65
|
+
"searchFailed": "搜索失败",
|
|
66
|
+
"palettePlaceholder": "搜索类、符号、文件、命令…",
|
|
67
|
+
"paletteTab_class": "类",
|
|
68
|
+
"paletteTab_symbol": "符号",
|
|
69
|
+
"paletteTab_all": "所有",
|
|
70
|
+
"paletteTab_files": "文件",
|
|
71
|
+
"paletteTab_text": "文本",
|
|
72
|
+
"paletteTab_actions": "操作",
|
|
73
|
+
"paletteKind_class": "类",
|
|
74
|
+
"paletteKind_symbol": "符号",
|
|
75
|
+
"paletteKind_files": "文件",
|
|
76
|
+
"paletteKind_text": "文本",
|
|
77
|
+
"paletteKind_actions": "操作",
|
|
78
|
+
"paletteEmpty": "没有匹配项",
|
|
79
|
+
"paletteBusy": "搜索中…",
|
|
80
|
+
"paletteHint": "↑↓ 选择 · Enter 打开 · Tab 切换分类 · Esc 关闭 · 双击 Shift 唤起",
|
|
81
|
+
"paletteActionTree": "显示/隐藏文件树",
|
|
82
|
+
"paletteActionRefresh": "刷新文件树与文件内容",
|
|
83
|
+
"paletteActionJump": "开/关 代码跳转",
|
|
84
|
+
"paletteActionCloseTabs": "关闭所有标签",
|
|
85
|
+
"paletteActionBack": "返回对话",
|
|
86
|
+
"paletteActionPalette": "打开搜索面板",
|
|
87
|
+
"projectSwitch": "切换项目",
|
|
88
|
+
"currentProject": "当前项目",
|
|
89
|
+
"projectNoSession": "该工作区还没有会话,无法读取文件",
|
|
90
|
+
"tabCallersText": "调用方(文本匹配)",
|
|
91
|
+
"navBack": "后退(鼠标侧键)",
|
|
92
|
+
"navForward": "前进(鼠标侧键)",
|
|
93
|
+
"noSourceInJar": "该 jar 没有源码",
|
|
94
|
+
"shortcutToggle": "代码工作区: 打开 / 关闭",
|
|
95
|
+
"shortcutBackToChat": "代码工作区: 返回对话",
|
|
96
|
+
"gestureSection": "代码工作区快捷键",
|
|
97
|
+
"gestureSectionHint": "本插件的全部快捷键,就在这里查看与修改(不占用 DSH 自己的快捷键列表)",
|
|
98
|
+
"gestureEdit": "查看",
|
|
99
|
+
"gestureClose": "关闭",
|
|
100
|
+
"gestureHint": "键盘命令点「修改」后直接按新组合键(Esc 取消);手势用下拉选择(macOS 上 ⌘ 与 Ctrl 分开);双击 Shift 与 ⌘P 为面板内固定行为",
|
|
101
|
+
"gestureDefinition": "转到定义",
|
|
102
|
+
"gestureUsages": "查看实现 / 调用方",
|
|
103
|
+
"gestureDouble": "双击",
|
|
104
|
+
"gestureMeta": "⌘+单击",
|
|
105
|
+
"gestureAlt": "⌥+单击",
|
|
106
|
+
"gestureConflict": "该组合已被占用",
|
|
107
|
+
"gestureTaken": "已被另一个动作占用",
|
|
108
|
+
"shortcutSearchEverywhere": "打开搜索无处不在",
|
|
109
|
+
"shortcutFileSearch": "定位文件搜索框",
|
|
110
|
+
"ksUnbound": "未绑定",
|
|
111
|
+
"gestureEditInDsh": "在 设置 → 通用设置 → 编辑快捷键 中修改",
|
|
112
|
+
"ksRecording": "请按键…",
|
|
113
|
+
"ksChange": "修改",
|
|
114
|
+
"ksReset": "恢复默认",
|
|
115
|
+
"ksCancel": "取消",
|
|
116
|
+
"settingsTitle": "代码工作区设置",
|
|
117
|
+
"settingsHint": "快捷键、字号等本插件设置,都在这里",
|
|
118
|
+
"settingsBasic": "基础设置",
|
|
119
|
+
"settingsFont": "字号",
|
|
120
|
+
"settingsCodeFont": "代码字号",
|
|
121
|
+
"settingsTreeFont": "文件树字号",
|
|
122
|
+
"tabMenuClose": "关闭",
|
|
123
|
+
"tabMenuCloseOthers": "关闭其他标签页",
|
|
124
|
+
"tabMenuCloseAll": "关闭所有标签页",
|
|
125
|
+
"tabMenuCloseUnmodified": "关闭未修改标签页",
|
|
126
|
+
"tabMenuCloseRight": "关闭右侧标签页",
|
|
127
|
+
"tabMenuCloseReadOnly": "关闭所有只读项",
|
|
128
|
+
"tabMenuAddToContext": "添加到智能体上下文",
|
|
129
|
+
"tabMenuCopyPath": "复制路径/引用",
|
|
130
|
+
"tabMenuCopied": "已复制,可直接粘贴到对话输入框",
|
|
131
|
+
"tabMenuCloseLeft": "关闭左侧标签页",
|
|
132
|
+
"tabMenuLabel": "标签页操作",
|
|
133
|
+
"gutterMenuLabel": "代码区操作",
|
|
134
|
+
"gutterMenuAnnotate": "使用 Git 追溯注解",
|
|
135
|
+
"gutterMenuUnannotate": "关闭 Git 追溯注解",
|
|
136
|
+
"setupTitle": "代码导航未就绪",
|
|
137
|
+
"setupBody": "浏览、搜索、Git、复制引用都能用;跳转、调用链、用法计数需要 JetBrains 语言服务器。按下面两条命令走一遍即可。",
|
|
138
|
+
"setupLicence": "授权入口:",
|
|
139
|
+
"setupRecheck": "重新检测",
|
|
140
|
+
"setupChecking": "检测中…",
|
|
141
|
+
"setupClose": "关闭",
|
|
142
|
+
"setupReady": "代码导航已就绪",
|
|
143
|
+
"setupStill": "仍未检测到 LSP:看一下 DSH 启动日志和 profile 的 cordis.patch.yml。",
|
|
144
|
+
"treeRevealNone": "没有打开的文件",
|
|
145
|
+
"treeExpandAll": "展开全部",
|
|
146
|
+
"treeCollapseAll": "收起全部",
|
|
147
|
+
"treeExpandLimit": "已展开到上限(200 个目录)",
|
|
148
|
+
"annotateUncommitted": "未提交",
|
|
149
|
+
"gestureCtrl": "Ctrl+单击",
|
|
150
|
+
"gesturePickHint": "选择触发方式",
|
|
151
|
+
"gestureChain": "查看调用链",
|
|
152
|
+
"chainLoading": "正在向上查找调用方…",
|
|
153
|
+
"chainNone": "没有找到调用方(可能已是入口方法)",
|
|
154
|
+
"chainHint": "点击节点跳到对应代码",
|
|
155
|
+
"chainRule": "上方节点调用下方节点;← 后是它调用下方方法的位置",
|
|
156
|
+
"treeMenuLabel": "文件菜单",
|
|
157
|
+
"treeOpen": "在代码工作区打开",
|
|
158
|
+
"treeCopyContent": "复制文件内容",
|
|
159
|
+
"treeCopyPath": "复制绝对路径",
|
|
160
|
+
"treeCopyRelative": "复制仓库相对路径",
|
|
161
|
+
"treeCopyFqn": "复制限定类名",
|
|
162
|
+
"treeCopied": "已复制",
|
|
163
|
+
"treeCopyFailed": "复制失败",
|
|
164
|
+
"treeGitSection": "Git",
|
|
165
|
+
"treeAnnotate": "使用 Git 追溯注解",
|
|
166
|
+
"treeDiff": "显示差异",
|
|
167
|
+
"treeHistory": "显示历史记录",
|
|
168
|
+
"treeCompareRevision": "与修订比较…",
|
|
169
|
+
"treeCompareRef": "与分支或标签比较…",
|
|
170
|
+
"treeDiffFailed": "读取差异失败",
|
|
171
|
+
"treeLogFailed": "读取历史失败",
|
|
172
|
+
"treeRefsFailed": "读取分支失败",
|
|
173
|
+
"treeNoHistory": "该文件没有提交记录",
|
|
174
|
+
"treeNoRefs": "仓库里没有分支或标签",
|
|
175
|
+
"treeNoDiff": "与当前版本没有差异",
|
|
176
|
+
"treeUntracked": "该文件尚未纳入版本控制",
|
|
177
|
+
"treeTruncated": "内容过长,已截断",
|
|
178
|
+
"treeTag": "标签",
|
|
179
|
+
"treeBranch": "分支",
|
|
180
|
+
"treeRouteMissing": "新路由未注册,请完全退出并重新打开 DSH",
|
|
181
|
+
"tabImplementsText": "实现(文本匹配)",
|
|
182
|
+
"chainTextual": "语言服务不可用,调用链按文本匹配展开",
|
|
183
|
+
"propertyLabel": "属性",
|
|
184
|
+
"implementationLabel": "实现",
|
|
185
|
+
"alreadyAtDefinition": "当前位置就是定义",
|
|
186
|
+
"lspUnsupported": "当前语言服务不支持这项查询,结果只能按文本匹配",
|
|
187
|
+
"lspLicense": "已在浏览器打开 JetBrains 授权页;完成授权后重启 DSH",
|
|
188
|
+
"paletteActionLicenseRelogin": "JetBrains 授权:退出当前账号并重新登录",
|
|
189
|
+
"lspReloginRunning": "正在退出当前 JetBrains 账号并打开登录页…",
|
|
190
|
+
"lspReloginOpened": "已打开 JetBrains 登录页:登录有授权的账号后重启 DSH",
|
|
191
|
+
"settingsMavenRepo": "Maven 本地仓库",
|
|
192
|
+
"settingsMavenRepoHint": "依赖源码(-sources.jar)从这里读取;留空则自动检测 Maven 的 settings.xml 与 ~/.m2/repository",
|
|
193
|
+
"settingsMavenRepoAuto": "自动检测",
|
|
194
|
+
"mavenRepoMissing": "Maven 本地仓库不存在",
|
|
195
|
+
"settingsMavenRepoInUse": "当前使用",
|
|
196
|
+
"settingsMavenRepoManual": "设置项",
|
|
197
|
+
"settingsMavenRepoDetecting": "正在检测仓库位置…",
|
|
198
|
+
"settingsMavenRepoMissingDir": "目录不存在",
|
|
199
|
+
"treeLocate": "定位到当前文件",
|
|
200
|
+
"gestureAltWin": "Alt+单击",
|
|
201
|
+
"paletteActionDiagnostics": "复制诊断信息",
|
|
202
|
+
"diagCopied": "诊断信息已复制,宿主日志已追加",
|
|
203
|
+
"diagCopyFailed": "无法写入剪贴板,诊断信息未复制",
|
|
204
|
+
"diagReported": "诊断信息已写入宿主日志(剪贴板不可用)",
|
|
205
|
+
"symbolMenuLabel": "符号操作",
|
|
206
|
+
"symbolMenuCopyName": "复制名称",
|
|
207
|
+
"symbolMenuCopyReference": "复制引用",
|
|
208
|
+
"symbolMenuReferenceToChat": "复制引用回对话",
|
|
209
|
+
"treeReferenceToChat": "复制引用回对话",
|
|
210
|
+
"referenceInserted": "引用已插入对话",
|
|
211
|
+
"referenceInsertedPlain": "已插入纯文本引用",
|
|
212
|
+
"referenceNoEditor": "未找到对话输入框,引用未插入",
|
|
213
|
+
"setupStepScript": "第 1 步:运行安装脚本(装管道包、下载服务器、写好配置;脚本不在默认位置就改成你的路径)",
|
|
214
|
+
"setupStepLicence": "第 2 步:授权(会打开浏览器;已授权会直接显示 licensed)",
|
|
215
|
+
"setupStepRestart": "最后:完全退出 DSH(⌘Q / 托盘退出)再打开。",
|
|
216
|
+
"setupCopyAll": "复制命令"
|
|
217
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ide-window",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "IDEA-style code workspace for DeepSeek Harness: a centre panel with a workspace file tree, editor tabs and live-updating source, while the left navigation column hides.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"icon": "icon.svg",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js",
|
|
9
|
+
"./client": "./client.js",
|
|
10
|
+
"./locale/*.json": "./locale/*.json",
|
|
11
|
+
"./icon": "./icon.svg",
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"client.js",
|
|
17
|
+
"platform/",
|
|
18
|
+
"cordis.patch.yml",
|
|
19
|
+
"locale/*.json",
|
|
20
|
+
"icon.svg",
|
|
21
|
+
"README.md",
|
|
22
|
+
"AGENTS.md",
|
|
23
|
+
"install.sh",
|
|
24
|
+
"install.ps1",
|
|
25
|
+
"enable-navigation.sh",
|
|
26
|
+
"enable-navigation.ps1"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "node build.mjs",
|
|
30
|
+
"check": "node --check index.js && node --check client.js",
|
|
31
|
+
"test": "node test/platform.mjs && node test/diagnostics.mjs && node test/status.mjs && node test/harness.mjs && node test/inference.mjs && node test/maven.mjs"
|
|
32
|
+
},
|
|
33
|
+
"dsh": {
|
|
34
|
+
"bundle": {
|
|
35
|
+
"patch": "./cordis.patch.yml"
|
|
36
|
+
},
|
|
37
|
+
"client": {
|
|
38
|
+
"platform": "web",
|
|
39
|
+
"immediately": true,
|
|
40
|
+
"inject": [
|
|
41
|
+
"@deepseek-ai/dsh-client-locale",
|
|
42
|
+
"@deepseek-ai/dsh-client-shortcuts"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"keywords": [
|
|
48
|
+
"dsh-plugin",
|
|
49
|
+
"deepseek-harness",
|
|
50
|
+
"dsh",
|
|
51
|
+
"ide",
|
|
52
|
+
"file-tree",
|
|
53
|
+
"code"
|
|
54
|
+
],
|
|
55
|
+
"engines": {
|
|
56
|
+
"dsh": "0.2.2-rc.3"
|
|
57
|
+
},
|
|
58
|
+
"author": "simons-jiang",
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "git+https://github.com/simons-jiang/dsh-ide-window.git"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/simons-jiang/dsh-ide-window#readme",
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/simons-jiang/dsh-ide-window/issues"
|
|
66
|
+
},
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contract every platform implementation follows.
|
|
3
|
+
*
|
|
4
|
+
* The workspace keeps one place per operation that differs between operating
|
|
5
|
+
* systems. `index.js` asks `platform/index.js` for the current platform instead
|
|
6
|
+
* of branching on `process.platform`, so adding a system means one more file
|
|
7
|
+
* that satisfies this contract — not another `if` scattered through the Host.
|
|
8
|
+
*
|
|
9
|
+
* **Every new feature must be checked on both systems.** If a feature touches a
|
|
10
|
+
* path, an external command, a binary, a system directory or a shortcut label,
|
|
11
|
+
* the difference belongs here: add a member to this contract, implement it in
|
|
12
|
+
* `macos.js` and `windows.js`, and list it in `PLATFORM_METHODS` so the test
|
|
13
|
+
* fails until both implementations answer.
|
|
14
|
+
*
|
|
15
|
+
* A filesystem root is not a platform difference: `node:path` already knows it
|
|
16
|
+
* (`parse(path).root`), so the contract does not carry one.
|
|
17
|
+
*
|
|
18
|
+
* Paths inside the plugin are **POSIX**: every path that crosses a route, a
|
|
19
|
+
* preference or the browser is slash separated. A platform converts at its
|
|
20
|
+
* boundary (`toPosix`) and back only when showing it to the user (`toNative`).
|
|
21
|
+
*
|
|
22
|
+
* @typedef {object} IdePlatform
|
|
23
|
+
* @property {string} name `mac` or `windows`.
|
|
24
|
+
* @property {(path: string) => string} toPosix Native or mixed path → slashes.
|
|
25
|
+
* @property {(path: string) => string} toNative Slash path → platform form.
|
|
26
|
+
* @property {(path: string) => boolean} isAbsolutePath
|
|
27
|
+
* @property {(path: string) => string} expandUserPath `${user.home}`, `~` → home.
|
|
28
|
+
* @property {string[]} ripgrepSuffixes Binary paths inside the bundled packages.
|
|
29
|
+
* @property {string[]} serverLauncherNames Launcher file names, in try order.
|
|
30
|
+
* @property {(path: string) => boolean} needsShell `spawn` needs `shell: true`
|
|
31
|
+
* for this path (Windows blocks `.bat`/`.cmd` without it since CVE-2024-27980).
|
|
32
|
+
* @property {(url: string) => { command: string, args: string[] }} openUrlCommand
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/** Every member a platform implementation must carry. */
|
|
36
|
+
export const PLATFORM_METHODS = [
|
|
37
|
+
'name',
|
|
38
|
+
'toPosix',
|
|
39
|
+
'toNative',
|
|
40
|
+
'isAbsolutePath',
|
|
41
|
+
'expandUserPath',
|
|
42
|
+
'ripgrepSuffixes',
|
|
43
|
+
'serverLauncherNames',
|
|
44
|
+
'needsShell',
|
|
45
|
+
'openUrlCommand',
|
|
46
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pick the platform implementation for this Host.
|
|
3
|
+
*
|
|
4
|
+
* Only macOS and Windows are supported. Anything else resolves to the POSIX
|
|
5
|
+
* (macOS) implementation, which also keeps Linux working as well as it did
|
|
6
|
+
* before a Windows port existed.
|
|
7
|
+
*/
|
|
8
|
+
import { macPlatform } from './macos.js'
|
|
9
|
+
import { windowsPlatform } from './windows.js'
|
|
10
|
+
|
|
11
|
+
const IMPLEMENTATIONS = {
|
|
12
|
+
mac: macPlatform,
|
|
13
|
+
windows: windowsPlatform,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Only macOS is "the mac implementation"; everything else is Windows, which is
|
|
18
|
+
* the rule the plugin follows everywhere (`macos` or not).
|
|
19
|
+
*
|
|
20
|
+
* @param {string} os - `process.platform` value, or a short name.
|
|
21
|
+
*/
|
|
22
|
+
export function createPlatform(os) {
|
|
23
|
+
const macOs = os === 'darwin' || os === 'macos' || os === 'mac'
|
|
24
|
+
return macOs ? IMPLEMENTATIONS.mac : IMPLEMENTATIONS.windows
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The running Host's platform. */
|
|
28
|
+
export const platform = createPlatform(process.platform)
|
|
29
|
+
export { macPlatform, windowsPlatform }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* macOS: POSIX paths, `open` for the browser, `.app` bundles for tools.
|
|
3
|
+
*/
|
|
4
|
+
import { homedir } from 'node:os'
|
|
5
|
+
|
|
6
|
+
/** @type {import('./contract.js').IdePlatform} */
|
|
7
|
+
export const macPlatform = {
|
|
8
|
+
name: 'mac',
|
|
9
|
+
toPosix: (path) => String(path ?? ''),
|
|
10
|
+
toNative: (path) => String(path ?? ''),
|
|
11
|
+
isAbsolutePath: (path) => {
|
|
12
|
+
const text = String(path ?? '')
|
|
13
|
+
return text.startsWith('/')
|
|
14
|
+
},
|
|
15
|
+
expandUserPath: (path) => {
|
|
16
|
+
const text = String(path ?? '')
|
|
17
|
+
const home = homedir()
|
|
18
|
+
return text
|
|
19
|
+
.replace(/\$\{user\.home\}/g, home)
|
|
20
|
+
.replace(/\$\{env\.HOME\}/g, home)
|
|
21
|
+
.replace(/^~(?=\/)/, home)
|
|
22
|
+
},
|
|
23
|
+
ripgrepSuffixes: [
|
|
24
|
+
'@vscode/ripgrep-darwin-arm64/bin/rg',
|
|
25
|
+
'@vscode/ripgrep-darwin-x64/bin/rg',
|
|
26
|
+
],
|
|
27
|
+
serverLauncherNames: ['intellij-server'],
|
|
28
|
+
needsShell: () => false,
|
|
29
|
+
openUrlCommand: (url) => ({ command: 'open', args: [url] }),
|
|
30
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Windows: drive-letter paths, `explorer` for the browser, `.bat` launchers.
|
|
3
|
+
*/
|
|
4
|
+
import { homedir } from 'node:os'
|
|
5
|
+
|
|
6
|
+
/** @type {import('./contract.js').IdePlatform} */
|
|
7
|
+
export const windowsPlatform = {
|
|
8
|
+
name: 'windows',
|
|
9
|
+
toPosix: (path) => String(path ?? '').replace(/\\/g, '/'),
|
|
10
|
+
toNative: (path) => String(path ?? '').replace(/\//g, '\\'),
|
|
11
|
+
isAbsolutePath: (path) => {
|
|
12
|
+
const text = windowsPlatform.toPosix(path)
|
|
13
|
+
// A drive letter, a UNC share, or a rooted path on the current drive.
|
|
14
|
+
return /^[A-Za-z]:\//.test(text) || text.startsWith('//') || text.startsWith('/')
|
|
15
|
+
},
|
|
16
|
+
expandUserPath: (path) => {
|
|
17
|
+
const home = homedir()
|
|
18
|
+
return String(path ?? '')
|
|
19
|
+
.replace(/\$\{user\.home\}/g, home)
|
|
20
|
+
.replace(/\$\{env\.USERPROFILE\}/g, home)
|
|
21
|
+
.replace(/\$\{env\.HOME\}/g, home)
|
|
22
|
+
.replace(/^~(?=[\\/])/, home)
|
|
23
|
+
},
|
|
24
|
+
ripgrepSuffixes: [
|
|
25
|
+
'@vscode/ripgrep-win32-x64/bin/rg.exe',
|
|
26
|
+
'@vscode/ripgrep-win32-arm64/bin/rg.exe',
|
|
27
|
+
'@vscode/ripgrep/bin/rg.exe',
|
|
28
|
+
],
|
|
29
|
+
serverLauncherNames: ['intellij-server.bat', 'intellij-server.cmd', 'intellij-server.exe', 'intellij-server'],
|
|
30
|
+
// Node (CVE-2024-27980) refuses to spawn a .bat/.cmd without a shell. The
|
|
31
|
+
// licence verbs take no arguments that contain spaces, so a shell is safe.
|
|
32
|
+
needsShell: (path) => /\.(bat|cmd)$/i.test(String(path ?? '')),
|
|
33
|
+
// `explorer <url>` opens the browser but reports an unreliable exit code and
|
|
34
|
+
// goes through a shell layer; `cmd /c start ""` is the documented form and
|
|
35
|
+
// keeps the empty title argument that `start` needs for a quoted URL.
|
|
36
|
+
openUrlCommand: (url) => ({ command: 'cmd', args: ['/c', 'start', '', url] }),
|
|
37
|
+
}
|