dsh-remote-vs 0.26.0 → 0.27.0
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.en.md +4 -11
- package/README.md +4 -8
- package/THIRD-PARTY-NOTICES.md +7 -2
- package/lib/client.js +6622 -5821
- package/lib/index.js +275 -1
- package/lib/types/client/CodeEditor.d.ts +14 -0
- package/lib/types/client/OutlinePanel.d.ts +22 -0
- package/lib/types/client/ProcessesSection.d.ts +19 -0
- package/lib/types/client/api.d.ts +5 -1
- package/lib/types/client/blame-model.d.ts +77 -0
- package/lib/types/client/i18n.d.ts +1 -1
- package/lib/types/client/outline-model.d.ts +59 -0
- package/lib/types/client/scm/actions.d.ts +12 -1
- package/lib/types/client/store.d.ts +18 -0
- package/lib/types/client/vsc/blame.d.ts +19 -0
- package/lib/types/client/vsc/kit.d.ts +0 -2
- package/lib/types/client/vsc/preview-document.d.ts +46 -0
- package/lib/types/client/vsc/preview-model.d.ts +31 -0
- package/lib/types/client/vsc/preview-services.d.ts +24 -0
- package/lib/types/git-ops.d.ts +18 -0
- package/lib/types/processes.d.ts +43 -0
- package/lib/types/protocol.d.ts +34 -0
- package/package.json +2 -1
- package/src/client/CodeEditor.tsx +43 -1
- package/src/client/EditorPane.tsx +520 -37
- package/src/client/MonitorView.tsx +16 -5
- package/src/client/OutlinePanel.tsx +287 -0
- package/src/client/ProcessesSection.tsx +292 -0
- package/src/client/api.ts +8 -0
- package/src/client/blame-model.ts +242 -0
- package/src/client/i18n.ts +194 -0
- package/src/client/index.tsx +4 -0
- package/src/client/outline-model.ts +775 -0
- package/src/client/scm/HistoryPanel.tsx +38 -1
- package/src/client/scm/actions.ts +55 -2
- package/src/client/store.tsx +54 -5
- package/src/client/vsc/blame.ts +147 -0
- package/src/client/vsc/kit.tsx +3 -11
- package/src/client/vsc/preview-document.tsx +323 -0
- package/src/client/vsc/preview-model.ts +216 -0
- package/src/client/vsc/preview-services.ts +118 -0
- package/src/client/vsc/vsc.css +6509 -5716
- package/src/git-ops.ts +34 -0
- package/src/processes.ts +177 -0
- package/src/protocol.ts +37 -0
- package/src/routes.ts +118 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure parsing/formatting for `git blame` (and the shared vocabulary the
|
|
3
|
+
* editor UI uses for a line's provenance). No CodeMirror and no DOM here, so
|
|
4
|
+
* the gate can feed it real porcelain output.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { GitCommit } from '../protocol.ts'
|
|
8
|
+
import { unquoteGitPath } from '../git-format.ts'
|
|
9
|
+
|
|
10
|
+
/** One blamed line: 1-based final line number plus the commit that owns it. */
|
|
11
|
+
export interface BlameLine {
|
|
12
|
+
line: number
|
|
13
|
+
hash: string
|
|
14
|
+
author: string
|
|
15
|
+
email: string
|
|
16
|
+
/** Author timestamp, seconds since the epoch (git's `author-time`). */
|
|
17
|
+
time: number
|
|
18
|
+
summary: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A run of consecutive lines owned by the same commit. */
|
|
22
|
+
export interface BlameRun {
|
|
23
|
+
from: number
|
|
24
|
+
to: number
|
|
25
|
+
hash: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** One `--follow` file-history row, plus the name the file had in that commit. */
|
|
29
|
+
export interface FileHistoryCommit extends GitCommit {
|
|
30
|
+
/** Path to show/diff for THIS commit (old name before a rename). */
|
|
31
|
+
path: string
|
|
32
|
+
/** Rename source when this commit renamed the file. */
|
|
33
|
+
origPath?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const HEADER = /^([0-9a-f]{40,64}) \d+ (\d+)(?: \d+)?$/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Parse `git blame --line-porcelain`.
|
|
40
|
+
*
|
|
41
|
+
* `--line-porcelain` repeats the commit header and metadata for every line (no
|
|
42
|
+
* previous-commit grouping), which keeps this parser stateless: a header starts
|
|
43
|
+
* a record, the metadata lines fill it, and the tab-prefixed content line ends
|
|
44
|
+
* it. Lines that do not match the shape are ignored rather than aborting the
|
|
45
|
+
* whole read — a partially understood blame is still useful.
|
|
46
|
+
*/
|
|
47
|
+
export function parseBlamePorcelain(stdout: string): BlameLine[] {
|
|
48
|
+
const rows: BlameLine[] = []
|
|
49
|
+
let current: {
|
|
50
|
+
hash: string
|
|
51
|
+
line: number
|
|
52
|
+
author?: string
|
|
53
|
+
email?: string
|
|
54
|
+
time?: number
|
|
55
|
+
summary?: string
|
|
56
|
+
} | undefined
|
|
57
|
+
for (const raw of stdout.split('\n')) {
|
|
58
|
+
const line = raw.endsWith('\r') ? raw.slice(0, -1) : raw
|
|
59
|
+
const header = HEADER.exec(line)
|
|
60
|
+
if (header !== null) {
|
|
61
|
+
current = { hash: header[1] as string, line: Number(header[2]) }
|
|
62
|
+
continue
|
|
63
|
+
}
|
|
64
|
+
if (current === undefined) continue
|
|
65
|
+
if (line.startsWith('\t')) {
|
|
66
|
+
rows.push({
|
|
67
|
+
line: current.line,
|
|
68
|
+
hash: current.hash,
|
|
69
|
+
author: current.author ?? '',
|
|
70
|
+
email: current.email ?? '',
|
|
71
|
+
time: current.time ?? 0,
|
|
72
|
+
summary: current.summary ?? '',
|
|
73
|
+
})
|
|
74
|
+
current = undefined
|
|
75
|
+
continue
|
|
76
|
+
}
|
|
77
|
+
const space = line.indexOf(' ')
|
|
78
|
+
if (space < 0) continue
|
|
79
|
+
const key = line.slice(0, space)
|
|
80
|
+
const value = line.slice(space + 1)
|
|
81
|
+
if (key === 'author') current.author = value
|
|
82
|
+
else if (key === 'author-mail') current.email = value.replace(/^<|>$/g, '')
|
|
83
|
+
else if (key === 'author-time') current.time = Number(value) || 0
|
|
84
|
+
else if (key === 'summary') current.summary = value
|
|
85
|
+
}
|
|
86
|
+
return rows
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Group consecutive lines of one commit; non-adjacent runs stay separate. */
|
|
90
|
+
export function blameRuns(rows: readonly BlameLine[]): BlameRun[] {
|
|
91
|
+
const runs: BlameRun[] = []
|
|
92
|
+
let previous: BlameLine | undefined
|
|
93
|
+
for (const row of rows) {
|
|
94
|
+
if (previous !== undefined && previous.hash === row.hash && previous.line + 1 === row.line) {
|
|
95
|
+
const run = runs[runs.length - 1]
|
|
96
|
+
if (run !== undefined) run.to = row.line
|
|
97
|
+
} else {
|
|
98
|
+
runs.push({ from: row.line, to: row.line, hash: row.hash })
|
|
99
|
+
}
|
|
100
|
+
previous = row
|
|
101
|
+
}
|
|
102
|
+
return runs
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Short author name for the narrow blame gutter. */
|
|
106
|
+
export function shortAuthor(author: string): string {
|
|
107
|
+
const name = author.trim()
|
|
108
|
+
if (name === '') return '?'
|
|
109
|
+
return name.length <= 10 ? name : `${name.slice(0, 9)}…`
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Relative age labels, deliberately compact (`now`, `5m`, `3h`, `2d`, `4w`,
|
|
114
|
+
* `3mo`, `2y`) because this text lives in a gutter.
|
|
115
|
+
*/
|
|
116
|
+
export function relativeBlameTime(timeSeconds: number, nowSeconds: number = Math.floor(Date.now() / 1000)): string {
|
|
117
|
+
if (!Number.isFinite(timeSeconds) || timeSeconds <= 0) return '?'
|
|
118
|
+
const diff = Math.max(0, nowSeconds - timeSeconds)
|
|
119
|
+
if (diff < 60) return 'now'
|
|
120
|
+
if (diff < 3600) return `${Math.floor(diff / 60)}m`
|
|
121
|
+
if (diff < 86_400) return `${Math.floor(diff / 3600)}h`
|
|
122
|
+
if (diff < 7 * 86_400) return `${Math.floor(diff / 86_400)}d`
|
|
123
|
+
if (diff < 30 * 86_400) return `${Math.floor(diff / (7 * 86_400))}w`
|
|
124
|
+
if (diff < 365 * 86_400) return `${Math.floor(diff / (30 * 86_400))}mo`
|
|
125
|
+
return `${Math.floor(diff / (365 * 86_400))}y`
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** One-line gutter label: author initials/name plus relative age. */
|
|
129
|
+
export function blameLabel(row: BlameLine, nowSeconds: number = Math.floor(Date.now() / 1000)): string {
|
|
130
|
+
return `${shortAuthor(row.author)} · ${relativeBlameTime(row.time, nowSeconds)}`
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Hover text: full attribution. The browser renders `title` as plain text, so
|
|
135
|
+
* no markup is needed (and no translator dependency leaks into the model).
|
|
136
|
+
*/
|
|
137
|
+
export function blameTitle(row: BlameLine): string {
|
|
138
|
+
const when = row.time > 0 ? new Date(row.time * 1000).toLocaleString() : 'unknown date'
|
|
139
|
+
const email = row.email === '' ? '' : `\n${row.email}`
|
|
140
|
+
return `${row.author || 'unknown author'}${email}\n${when}\n${row.hash}\n${row.summary}`.trim()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** False for git's all-zero "not committed yet" pseudo-commit. */
|
|
144
|
+
export function isCommittedBlame(hash: string): boolean {
|
|
145
|
+
return !/^0{40,64}$/.test(hash)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The next `-L` window to request, or undefined when the viewport is covered.
|
|
150
|
+
*
|
|
151
|
+
* Pure and exported so the gate can prove the "3000-line file only asks for
|
|
152
|
+
* the visible window" requirement without a browser. `overscan` keeps a small
|
|
153
|
+
* buffer above/below so a normal scroll does not immediately need a new call.
|
|
154
|
+
*/
|
|
155
|
+
export function planBlameWindow(
|
|
156
|
+
first: number,
|
|
157
|
+
last: number,
|
|
158
|
+
total: number,
|
|
159
|
+
covered: ReadonlySet<number>,
|
|
160
|
+
overscan = 40,
|
|
161
|
+
): { from: number; to: number } | undefined {
|
|
162
|
+
if (!Number.isFinite(first) || !Number.isFinite(last) || !Number.isFinite(total) || total < 1) return undefined
|
|
163
|
+
const from = Math.max(1, Math.min(first, total) - Math.max(0, Math.floor(overscan)))
|
|
164
|
+
const to = Math.min(total, Math.max(last, first) + Math.max(0, Math.floor(overscan)))
|
|
165
|
+
if (to < from) return undefined
|
|
166
|
+
for (let line = from; line <= to; line += 1) {
|
|
167
|
+
if (!covered.has(line)) return { from, to }
|
|
168
|
+
}
|
|
169
|
+
return undefined
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface NameStatusRow {
|
|
173
|
+
path: string
|
|
174
|
+
origPath?: string
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Parse one `--name-status` row; C/R rows carry an old path as well. */
|
|
178
|
+
function parseNameStatusRow(raw: string): NameStatusRow | undefined {
|
|
179
|
+
const fields = raw.split('\t')
|
|
180
|
+
if (fields.length < 2) return undefined
|
|
181
|
+
const status = fields[0] as string
|
|
182
|
+
const first = fields[1] as string
|
|
183
|
+
const second = fields[2] as string | undefined
|
|
184
|
+
const path = unquoteGitPath(second ?? first)
|
|
185
|
+
if (path === '') return undefined
|
|
186
|
+
const origPath = second === undefined ? undefined : unquoteGitPath(first)
|
|
187
|
+
return status.startsWith('R') || status.startsWith('C')
|
|
188
|
+
? { path, ...(origPath === undefined ? {} : { origPath }) }
|
|
189
|
+
: { path }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Parse `git log --follow --name-status -M` output into per-commit rows.
|
|
194
|
+
*
|
|
195
|
+
* `--follow` reports the file under its name AT THAT COMMIT. Starting from the
|
|
196
|
+
* current name and walking newest→oldest, each rename row supplies the next
|
|
197
|
+
* (older) name, so a click on an old history row opens the right path instead
|
|
198
|
+
* of an empty diff for the current name.
|
|
199
|
+
*/
|
|
200
|
+
export function parseFileHistory(stdout: string, currentPath: string): FileHistoryCommit[] {
|
|
201
|
+
const commits: FileHistoryCommit[] = []
|
|
202
|
+
let wanted = currentPath
|
|
203
|
+
for (const block of stdout.split('\0')) {
|
|
204
|
+
const lines = block.replace(/^\r?\n/, '').split(/\r?\n/).filter(line => line.trim() !== '')
|
|
205
|
+
if (lines.length === 0) continue
|
|
206
|
+
const [hash, parents, author, email, date, refs, subject] = (lines[0] as string).split('\x1f') as [
|
|
207
|
+
string, string, string, string, string, string, string,
|
|
208
|
+
]
|
|
209
|
+
if (!/^[0-9a-f]{4,64}$/.test((hash ?? '').trim())) continue
|
|
210
|
+
const statuses = lines.slice(1).flatMap(line => {
|
|
211
|
+
const row = parseNameStatusRow(line)
|
|
212
|
+
return row === undefined ? [] : [row]
|
|
213
|
+
})
|
|
214
|
+
let path = wanted
|
|
215
|
+
let origPath: string | undefined
|
|
216
|
+
const rename = statuses.find(row => row.path === wanted && row.origPath !== undefined)
|
|
217
|
+
if (rename !== undefined) {
|
|
218
|
+
path = wanted
|
|
219
|
+
origPath = rename.origPath
|
|
220
|
+
wanted = rename.origPath as string
|
|
221
|
+
} else if (statuses.some(row => row.path === wanted)) {
|
|
222
|
+
path = wanted
|
|
223
|
+
} else if (statuses.length === 1) {
|
|
224
|
+
// A path-limited log normally has one status row; trust it when the
|
|
225
|
+
// rename chain did not line up (e.g. a merge or an unusual rename).
|
|
226
|
+
path = (statuses[0] as NameStatusRow).path
|
|
227
|
+
origPath = (statuses[0] as NameStatusRow).origPath
|
|
228
|
+
}
|
|
229
|
+
commits.push({
|
|
230
|
+
hash: (hash as string).trim(),
|
|
231
|
+
parents: (parents ?? '').trim() === '' ? [] : (parents as string).trim().split(' '),
|
|
232
|
+
author: (author ?? '').trim(),
|
|
233
|
+
email: (email ?? '').trim(),
|
|
234
|
+
date: Number(date) || 0,
|
|
235
|
+
refs: (refs ?? '').split(',').map(item => item.trim()).filter(item => item !== ''),
|
|
236
|
+
subject: (subject ?? '').trim(),
|
|
237
|
+
path,
|
|
238
|
+
...(origPath === undefined ? {} : { origPath }),
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
return commits
|
|
242
|
+
}
|
package/src/client/i18n.ts
CHANGED
|
@@ -79,6 +79,28 @@ export const DYNAMIC_KEYS = [
|
|
|
79
79
|
'editor.crumbLabel',
|
|
80
80
|
'editor.crumbUp',
|
|
81
81
|
'editor.crumbEmpty',
|
|
82
|
+
// Outline kind labels are chosen through a `kind` → key lookup in
|
|
83
|
+
// `OutlinePanel.tsx`, not a literal t() call.
|
|
84
|
+
'outline.kind.class',
|
|
85
|
+
'outline.kind.interface',
|
|
86
|
+
'outline.kind.struct',
|
|
87
|
+
'outline.kind.enum',
|
|
88
|
+
'outline.kind.trait',
|
|
89
|
+
'outline.kind.impl',
|
|
90
|
+
'outline.kind.namespace',
|
|
91
|
+
'outline.kind.module',
|
|
92
|
+
'outline.kind.function',
|
|
93
|
+
'outline.kind.method',
|
|
94
|
+
'outline.kind.constructor',
|
|
95
|
+
'outline.kind.field',
|
|
96
|
+
'outline.kind.variable',
|
|
97
|
+
'outline.kind.type',
|
|
98
|
+
'outline.kind.macro',
|
|
99
|
+
// Chosen by preview kind at runtime in preview-document.tsx.
|
|
100
|
+
'preview.officeUnavailableTitle',
|
|
101
|
+
'preview.unavailableTitle',
|
|
102
|
+
'preview.officeUnavailableHint',
|
|
103
|
+
'preview.unavailableHint',
|
|
82
104
|
'editor.imageHint',
|
|
83
105
|
'editor.imageFitHint',
|
|
84
106
|
'editor.imageFailedHint',
|
|
@@ -592,6 +614,35 @@ const zh: Record<string, string> = {
|
|
|
592
614
|
'history.diffToolbar': '补丁工具',
|
|
593
615
|
'editor.preview': '预览',
|
|
594
616
|
'editor.source': '源码',
|
|
617
|
+
'preview.converting': '正在由远端 LibreOffice 转换为 PDF…',
|
|
618
|
+
'preview.convertingHint': '由宿主 LibreOffice 转换,首次打开通常需要几秒。',
|
|
619
|
+
'preview.failedTitle': '无法预览这个文件',
|
|
620
|
+
'preview.failedHint': '文件可能已损坏、格式不受支持,或转换失败。',
|
|
621
|
+
'preview.tooLargeTitle': '文件过大,无法预览',
|
|
622
|
+
'preview.tooLargeHint': '超出宿主或插件的读取上限;可以用原生应用打开它。',
|
|
623
|
+
'preview.unavailableTitle': '当前没有可用的预览服务',
|
|
624
|
+
'preview.unavailableHint': '宿主没有挂载所需的文件/Office 服务,插件会退回自己的下载通道。',
|
|
625
|
+
'preview.notFoundTitle': '文件已不在磁盘上',
|
|
626
|
+
'preview.notFoundHint': '它可能已被删除、改名或移出工作区。',
|
|
627
|
+
'preview.remoteTitle': '远端文件无法预览',
|
|
628
|
+
'preview.remoteHint': '宿主拒绝了这条字节读取路径。',
|
|
629
|
+
'preview.officeUnavailableTitle': '远端没有 LibreOffice',
|
|
630
|
+
'preview.officeUnavailableHint': '宿主 officeKit 不可用,远端也没有安装 LibreOffice,因此无法转换这个文档。',
|
|
631
|
+
'preview.truncated': '文件过大,只预览了已加载的部分。',
|
|
632
|
+
'preview.tableTruncated': '数据超过 {rows} 行 / {cells} 个单元格,只解析了前面部分。',
|
|
633
|
+
'preview.tableHiddenRows': '只显示了前 {shown} 行,还有 {rest} 行未显示。',
|
|
634
|
+
'preview.tableHiddenColumns': '只显示了前 {shown} 列,还有 {rest} 列未显示。',
|
|
635
|
+
'preview.tableEmptyTitle': '空表格',
|
|
636
|
+
'preview.tableEmptyHint': '这个文件没有可显示的行。',
|
|
637
|
+
'preview.documentHint': '翻页 / 缩放由浏览器内置阅读器提供',
|
|
638
|
+
'preview.mediaUnsupported': '浏览器不支持这个容器或编码',
|
|
639
|
+
'preview.svgFailed': 'SVG 无法渲染',
|
|
640
|
+
'preview.svgFailedHint': '文件不是合法的 SVG。切到源码可以查看并修正标记。',
|
|
641
|
+
'preview.svgHint': 'SVG 以图片方式渲染:脚本不会执行。',
|
|
642
|
+
'preview.copyCode': '复制代码',
|
|
643
|
+
'preview.copied': '已复制',
|
|
644
|
+
'preview.footnotes': '脚注',
|
|
645
|
+
'common.retry': '重试',
|
|
595
646
|
'editor.imageFailed': '图片读取失败。',
|
|
596
647
|
'editor.closeDirty': '有未保存的修改',
|
|
597
648
|
'editor.discardClose': '放弃并关闭',
|
|
@@ -622,6 +673,34 @@ const zh: Record<string, string> = {
|
|
|
622
673
|
'editor.tabsLabel': '打开的编辑器',
|
|
623
674
|
'editor.diffSuffix': '(差异)',
|
|
624
675
|
'editor.wrap': '自动换行',
|
|
676
|
+
'editor.blameToggle': '行内 blame(作者 + 时间,点击查看提交)',
|
|
677
|
+
'editor.blameOpenCaret': '打开光标所在行的提交',
|
|
678
|
+
'editor.fileHistory': '文件历史',
|
|
679
|
+
'editor.fileHistoryEmpty': '这个文件没有提交历史。',
|
|
680
|
+
'editor.outline': '大纲',
|
|
681
|
+
'outline.title': '文件大纲',
|
|
682
|
+
'outline.placeholder': '筛选符号…',
|
|
683
|
+
'outline.hint': '↑↓ 选择 · Enter 跳转 · Esc 关闭',
|
|
684
|
+
'outline.empty': '这个文件里没有可识别的符号。',
|
|
685
|
+
'outline.noResults': '没有匹配的符号。',
|
|
686
|
+
'outline.more': '结果已截断,共匹配 {total} 条,只显示前 {count} 条;继续输入可以缩小范围。',
|
|
687
|
+
'outline.truncated': '文件符号太多,只列出前 {count} 个。',
|
|
688
|
+
'outline.guessed': '未识别该文件的语言:大纲按缩进与关键字猜测,可能不准确。',
|
|
689
|
+
'outline.kind.class': '类',
|
|
690
|
+
'outline.kind.interface': '接口',
|
|
691
|
+
'outline.kind.struct': '结构',
|
|
692
|
+
'outline.kind.enum': '枚举',
|
|
693
|
+
'outline.kind.trait': 'trait',
|
|
694
|
+
'outline.kind.impl': 'impl',
|
|
695
|
+
'outline.kind.namespace': '命名空间',
|
|
696
|
+
'outline.kind.module': '模块',
|
|
697
|
+
'outline.kind.function': '函数',
|
|
698
|
+
'outline.kind.method': '方法',
|
|
699
|
+
'outline.kind.constructor': '构造',
|
|
700
|
+
'outline.kind.field': '字段',
|
|
701
|
+
'outline.kind.variable': '变量',
|
|
702
|
+
'outline.kind.type': '类型',
|
|
703
|
+
'outline.kind.macro': '宏',
|
|
625
704
|
'editor.fontSmaller': '减小字号(Ctrl+滚轮)',
|
|
626
705
|
'editor.fontLarger': '增大字号(Ctrl+滚轮)',
|
|
627
706
|
'editor.openInCenter': '在会话区全宽打开',
|
|
@@ -828,6 +907,35 @@ const zh: Record<string, string> = {
|
|
|
828
907
|
'monitor.interval10': '10 秒',
|
|
829
908
|
'monitor.interval30': '30 秒',
|
|
830
909
|
'monitor.linuxOnly': '完整指标来自 Linux /proc;其他平台显示为未知。',
|
|
910
|
+
'proc.title': '进程',
|
|
911
|
+
'proc.host': '主机',
|
|
912
|
+
'proc.filter': '过滤命令 / 用户 / PID',
|
|
913
|
+
'proc.sort': '排序',
|
|
914
|
+
'proc.sortCpu': '按 CPU(平均值)',
|
|
915
|
+
'proc.sortMem': '按内存',
|
|
916
|
+
'proc.sortPid': '按 PID',
|
|
917
|
+
'proc.refresh': '刷新进程表',
|
|
918
|
+
'proc.elapsed': '运行时长',
|
|
919
|
+
'proc.command': '命令',
|
|
920
|
+
'proc.cpuHint': 'CPU% 是进程生命周期平均值(ps pcpu),不是瞬时值。',
|
|
921
|
+
'proc.killTitle': '结束进程',
|
|
922
|
+
'proc.killText': '向主机 {host} 的 PID {pid} 发送 TERM?\n{command}',
|
|
923
|
+
'proc.kill': '结束',
|
|
924
|
+
'proc.killSent': '已向 PID {pid} 发送 TERM。',
|
|
925
|
+
'proc.killForceTitle': '强制结束进程',
|
|
926
|
+
'proc.killForceText': 'TERM 没有结束主机 {host} 的 PID {pid};发送 KILL(不可捕获,可能丢数据)?\n{command}',
|
|
927
|
+
'proc.killForce': '强制',
|
|
928
|
+
'proc.killForceSent': '已向 PID {pid} 发送 KILL。',
|
|
929
|
+
'proc.unknown': '—',
|
|
930
|
+
'proc.cannotEnumerate': '无法枚举远端进程(ps 探针没有给出可信结果)。',
|
|
931
|
+
'proc.noPs': '远端没有可用的 ps,无法枚举进程。',
|
|
932
|
+
'proc.truncated': '只列出 CPU 最高的前 {count} 个进程。',
|
|
933
|
+
'proc.noHost': '没有可采样的远端主机。',
|
|
934
|
+
'proc.empty': '没有匹配的进程。',
|
|
935
|
+
'proc.hostTooOld': '宿主版本过旧:进程面板需要新版 dsh-remote-vs,请升级插件后刷新。',
|
|
936
|
+
'proc.expand': '展开进程分区',
|
|
937
|
+
'proc.collapse': '收起进程分区',
|
|
938
|
+
'proc.collapsedHint': '展开以查看远端的进程快照(按 CPU 排序)。',
|
|
831
939
|
}
|
|
832
940
|
|
|
833
941
|
const en: Record<string, string> = {
|
|
@@ -1336,6 +1444,35 @@ const en: Record<string, string> = {
|
|
|
1336
1444
|
'history.diffToolbar': 'Patch tools',
|
|
1337
1445
|
'editor.preview': 'Preview',
|
|
1338
1446
|
'editor.source': 'Source',
|
|
1447
|
+
'preview.converting': 'Converting with remote LibreOffice…',
|
|
1448
|
+
'preview.convertingHint': 'Converted by the host LibreOffice; the first open usually takes a few seconds.',
|
|
1449
|
+
'preview.failedTitle': 'Cannot preview this file',
|
|
1450
|
+
'preview.failedHint': 'The file may be corrupt, unsupported, or the conversion failed.',
|
|
1451
|
+
'preview.tooLargeTitle': 'File is too large to preview',
|
|
1452
|
+
'preview.tooLargeHint': 'It exceeds the Host or plugin read limit; open it with a native app instead.',
|
|
1453
|
+
'preview.unavailableTitle': 'No preview service is available',
|
|
1454
|
+
'preview.unavailableHint': 'The Host did not mount the required file/Office services; the plugin falls back to its own download path.',
|
|
1455
|
+
'preview.notFoundTitle': 'The file is no longer on disk',
|
|
1456
|
+
'preview.notFoundHint': 'It may have been deleted, renamed or moved out of the workspace.',
|
|
1457
|
+
'preview.remoteTitle': 'Remote file cannot be previewed',
|
|
1458
|
+
'preview.remoteHint': 'The Host refused this byte-read path.',
|
|
1459
|
+
'preview.officeUnavailableTitle': 'LibreOffice is not available on the remote host',
|
|
1460
|
+
'preview.officeUnavailableHint': 'The host officeKit is unavailable and the remote host has no LibreOffice, so this document cannot be converted.',
|
|
1461
|
+
'preview.truncated': 'File is too large; only the loaded part is previewed.',
|
|
1462
|
+
'preview.tableTruncated': 'Data exceeds {rows} rows / {cells} cells; only the first part was parsed.',
|
|
1463
|
+
'preview.tableHiddenRows': 'Only the first {shown} rows are shown; {rest} more are hidden.',
|
|
1464
|
+
'preview.tableHiddenColumns': 'Only the first {shown} columns are shown; {rest} more are hidden.',
|
|
1465
|
+
'preview.tableEmptyTitle': 'Empty table',
|
|
1466
|
+
'preview.tableEmptyHint': 'This file has no rows to show.',
|
|
1467
|
+
'preview.documentHint': 'Paging / zoom live in the browser’s built-in viewer',
|
|
1468
|
+
'preview.mediaUnsupported': 'The browser does not support this container or codec',
|
|
1469
|
+
'preview.svgFailed': 'SVG cannot be rendered',
|
|
1470
|
+
'preview.svgFailedHint': 'The file is not valid SVG. Switch to source to inspect and fix the markup.',
|
|
1471
|
+
'preview.svgHint': 'SVG is rendered as an image: scripts do not run.',
|
|
1472
|
+
'preview.copyCode': 'Copy code',
|
|
1473
|
+
'preview.copied': 'Copied',
|
|
1474
|
+
'preview.footnotes': 'Footnotes',
|
|
1475
|
+
'common.retry': 'Retry',
|
|
1339
1476
|
'editor.imageFailed': 'Could not read the image.',
|
|
1340
1477
|
'editor.closeDirty': 'Unsaved changes',
|
|
1341
1478
|
'editor.discardClose': 'Discard and close',
|
|
@@ -1366,6 +1503,34 @@ const en: Record<string, string> = {
|
|
|
1366
1503
|
'editor.tabsLabel': 'Open editors',
|
|
1367
1504
|
'editor.diffSuffix': ' (diff)',
|
|
1368
1505
|
'editor.wrap': 'Word wrap',
|
|
1506
|
+
'editor.blameToggle': 'Inline blame (author + age; click a line for its commit)',
|
|
1507
|
+
'editor.blameOpenCaret': 'Open the commit at the caret',
|
|
1508
|
+
'editor.fileHistory': 'File history',
|
|
1509
|
+
'editor.fileHistoryEmpty': 'No commit history for this file.',
|
|
1510
|
+
'editor.outline': 'Outline',
|
|
1511
|
+
'outline.title': 'File outline',
|
|
1512
|
+
'outline.placeholder': 'Filter symbols…',
|
|
1513
|
+
'outline.hint': '↑↓ select · Enter jump · Esc close',
|
|
1514
|
+
'outline.empty': 'No recognisable symbols in this file.',
|
|
1515
|
+
'outline.noResults': 'No matching symbols.',
|
|
1516
|
+
'outline.more': 'Results truncated: {total} matches, showing the first {count}; keep typing to narrow them down.',
|
|
1517
|
+
'outline.truncated': 'Too many symbols: only the first {count} are listed.',
|
|
1518
|
+
'outline.guessed': 'Language not recognised: this outline is guessed from indentation and keywords.',
|
|
1519
|
+
'outline.kind.class': 'class',
|
|
1520
|
+
'outline.kind.interface': 'interface',
|
|
1521
|
+
'outline.kind.struct': 'struct',
|
|
1522
|
+
'outline.kind.enum': 'enum',
|
|
1523
|
+
'outline.kind.trait': 'trait',
|
|
1524
|
+
'outline.kind.impl': 'impl',
|
|
1525
|
+
'outline.kind.namespace': 'namespace',
|
|
1526
|
+
'outline.kind.module': 'module',
|
|
1527
|
+
'outline.kind.function': 'function',
|
|
1528
|
+
'outline.kind.method': 'method',
|
|
1529
|
+
'outline.kind.constructor': 'constructor',
|
|
1530
|
+
'outline.kind.field': 'field',
|
|
1531
|
+
'outline.kind.variable': 'variable',
|
|
1532
|
+
'outline.kind.type': 'type',
|
|
1533
|
+
'outline.kind.macro': 'macro',
|
|
1369
1534
|
'editor.fontSmaller': 'Smaller font (Ctrl+wheel)',
|
|
1370
1535
|
'editor.fontLarger': 'Larger font (Ctrl+wheel)',
|
|
1371
1536
|
'editor.openInCenter': 'Open full width in the conversation view',
|
|
@@ -1572,6 +1737,35 @@ const en: Record<string, string> = {
|
|
|
1572
1737
|
'monitor.interval10': '10 s',
|
|
1573
1738
|
'monitor.interval30': '30 s',
|
|
1574
1739
|
'monitor.linuxOnly': 'Full metrics come from Linux /proc; other platforms show unknown.',
|
|
1740
|
+
'proc.title': 'Processes',
|
|
1741
|
+
'proc.host': 'Host',
|
|
1742
|
+
'proc.filter': 'Filter command / user / PID',
|
|
1743
|
+
'proc.sort': 'Sort',
|
|
1744
|
+
'proc.sortCpu': 'CPU (average)',
|
|
1745
|
+
'proc.sortMem': 'Memory',
|
|
1746
|
+
'proc.sortPid': 'PID',
|
|
1747
|
+
'proc.refresh': 'Refresh the process table',
|
|
1748
|
+
'proc.elapsed': 'ELAPSED',
|
|
1749
|
+
'proc.command': 'COMMAND',
|
|
1750
|
+
'proc.cpuHint': 'CPU% is the lifetime average (ps pcpu), not an instantaneous value.',
|
|
1751
|
+
'proc.killTitle': 'End process',
|
|
1752
|
+
'proc.killText': 'Send TERM to PID {pid} on {host}?\n{command}',
|
|
1753
|
+
'proc.kill': 'End',
|
|
1754
|
+
'proc.killSent': 'Sent TERM to PID {pid}.',
|
|
1755
|
+
'proc.killForceTitle': 'Force-kill process',
|
|
1756
|
+
'proc.killForceText': 'TERM did not stop PID {pid} on {host}; send KILL (uncatchable, may lose data)?\n{command}',
|
|
1757
|
+
'proc.killForce': 'Force',
|
|
1758
|
+
'proc.killForceSent': 'Sent KILL to PID {pid}.',
|
|
1759
|
+
'proc.unknown': '—',
|
|
1760
|
+
'proc.cannotEnumerate': 'Cannot enumerate remote processes (the ps probe gave no trustworthy answer).',
|
|
1761
|
+
'proc.noPs': 'The remote host has no usable ps, so processes cannot be enumerated.',
|
|
1762
|
+
'proc.truncated': 'Only the top {count} processes by CPU are listed.',
|
|
1763
|
+
'proc.noHost': 'No remote host to sample.',
|
|
1764
|
+
'proc.empty': 'No matching processes.',
|
|
1765
|
+
'proc.hostTooOld': 'Host too old: the process panel needs a newer dsh-remote-vs; upgrade the plugin and refresh.',
|
|
1766
|
+
'proc.expand': 'Expand processes',
|
|
1767
|
+
'proc.collapse': 'Collapse processes',
|
|
1768
|
+
'proc.collapsedHint': 'Expand for the remote process snapshot (sorted by CPU).',
|
|
1575
1769
|
}
|
|
1576
1770
|
|
|
1577
1771
|
export type Lang = 'zh' | 'en'
|
package/src/client/index.tsx
CHANGED
|
@@ -32,6 +32,7 @@ import { SettingsHostsSection, SettingsWorkspacesSection } from './SettingsHosts
|
|
|
32
32
|
import { openFloatingEditor, setEditorSurface } from './store.tsx'
|
|
33
33
|
import { detectLang, makeT } from './i18n.ts'
|
|
34
34
|
import { DialogHost, setIconService, toast, type IconServiceLike } from './vsc/kit.tsx'
|
|
35
|
+
import { installPreviewServices } from './vsc/preview-services.ts'
|
|
35
36
|
import { setHostNoticeEmitter } from './notices.ts'
|
|
36
37
|
|
|
37
38
|
/** Services required before mounting (slots/uiWorkspace are core web services). */
|
|
@@ -49,6 +50,9 @@ function RemoteIcon({ size }: { size?: number }): React.ReactNode {
|
|
|
49
50
|
|
|
50
51
|
/** Client plugin body. */
|
|
51
52
|
export function apply(ctx: Context): void {
|
|
53
|
+
// Document previews soft-read the host's workspaceFiles/officeKit remotes;
|
|
54
|
+
// missing services degrade to the plugin's own /download path.
|
|
55
|
+
ctx.effect(() => installPreviewServices(ctx), 'dsh-remote-vs: preview host services')
|
|
52
56
|
// Explorer surface, exactly one of two: the better-sidebar tab when that
|
|
53
57
|
// plugin is installed, else a native right-Sidebar page (same root, guide
|
|
54
58
|
// entry). No load-order edge exists (client inject metadata is
|