@dybai/dsh-editor 0.5.0 → 0.11.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.
@@ -7,15 +7,20 @@
7
7
  * - `mode_associations` — the complete set of `glob → modeId` associations
8
8
  * the "open as default" / "reset to default" menu writes;
9
9
  * - `keymap` — the framework's SELF-MANAGED key bindings for the actions
10
- * save / saveAll / deleteLines (record key = action id, value =
10
+ * save / saveAll / deleteLines / gotoLine (record key = action id, value =
11
11
  * `{ code, modifiers, updatedAt }`), written by the status-bar keymap
12
12
  * recorder;
13
13
  * - `settings` — the editor's behavior toggles (record key = setting name,
14
14
  * value = `{ value, updatedAt }`), written by the status-bar settings
15
15
  * panel; unknown-to-this-build keys are never read, so newer clients may
16
- * store more settings than this build knows.
16
+ * store more settings than this build knows;
17
+ * - `wrap_overrides` — the per-file-type word-wrap overrides (spec §6; record
18
+ * key = a glob matching `/^\*\.[a-z0-9]{1,16}$/`, value = `{ enabled,
19
+ * updatedAt }`), written by the settings center's word-wrap section; an
20
+ * empty set means "no overrides", so the client falls back to the global
21
+ * `wordWrap` setting.
17
22
  *
18
- * All tables share ONE monotonic `updatedAt` stamp carried by the unit's
23
+ * All four tables share ONE monotonic `updatedAt` stamp carried by the unit's
19
24
  * global singleton, round-tripped for compare-and-set updates.
20
25
  *
21
26
  * The module imports NOTHING on purpose: `kv` is a `StorageBackend` KvFacet
@@ -28,7 +33,8 @@
28
33
  * - the unit opens lazily on first use and the open is memoized (concurrent
29
34
  * callers share one `open` promise; a rejecting open forgets the memo so a
30
35
  * later call retries);
31
- * - every mutating call (`setModePreferences`, `setKeymap`) runs inside ONE
36
+ * - every mutating call (`setModePreferences`, `setKeymap`, `setSettings`,
37
+ * `setWrapOverrides`) runs inside ONE
32
38
  * internal write chain (promise queue) that serializes writes — the KV unit
33
39
  * does NOT serialize writes itself, and each write must read fresh state,
34
40
  * diff records, and restamp the global as one uninterrupted critical
@@ -37,11 +43,12 @@
37
43
  * honestly observe a write that settled a beat earlier.
38
44
  *
39
45
  * Shared CAS token: the unit's global `updatedAt` is the compare-and-set
40
- * guard for BOTH tables. A `setKeymap` write restamps the token, so a
46
+ * guard for ALL FOUR tables. A `setKeymap` write restamps the token, so a
41
47
  * concurrent `setModePreferences` carrying the older token fails its CAS with
42
- * `mode-preferences/conflict` (and symmetrically `keymap/conflict`) — the
43
- * client refetches and retries. That is intentional: one unit, one stamp, no
44
- * cross-table lost updates.
48
+ * `mode-preferences/conflict` (and symmetrically `keymap/conflict`,
49
+ * `settings/conflict`, `wrap-overrides/conflict`) — the client refetches and
50
+ * retries. That is intentional: one unit, one stamp, no cross-table lost
51
+ * updates.
45
52
  *
46
53
  * Failure policy: fail loud. A backend whose medium rejects (`loadAll` on an
47
54
  * unmounted backend, a closed unit) propagates that rejection to the caller.
@@ -56,11 +63,30 @@
56
63
  * the earlier `dsh-editor` / `modeAssociations` spellings were rejected by
57
64
  * `open()`, so NO data was ever persisted under them and this unit starts
58
65
  * fresh at version 1 with no migration surface.
66
+ *
67
+ * Versioning / appending the `wrap_overrides` table (0.11.0, spec §12):
68
+ * `version` is the ON-DISK FORMAT version, not a table-set schema version.
69
+ * The `json` backend validates only unit/table names
70
+ * (`dsh-storage-json/lib/index.js`, `validateDescriptor` ~L662), then compares
71
+ * the stored stamp with `descriptor.version` / `compatibleVersions`
72
+ * (`parse` ~L106; this descriptor uses the default `single` layout, so the
73
+ * whole-unit path applies). A table ABSENT from the stored document reads as
74
+ * an empty table, never an error (`parse` ~L113-117: `records === undefined`
75
+ * → `new Map()`), and the next write serializes every declared table
76
+ * (`serialize` ~L76-88) from the preserved state (`openSingleUnit` ~L191-196).
77
+ * Conclusion: appending a table at the SAME version 1 is accepted, `version`
78
+ * needs NO increment, and the existing three tables' records are preserved
79
+ * (verified against the live medium `%USERPROFILE%\.dsh\storages\dsh_editor.json`,
80
+ * stamped `version: 1`). Bumping `version` here would instead make `open()`
81
+ * reject that file with `version-mismatch` unless `compatibleVersions` vouched
82
+ * for it. Caveat: the table list is the read projection — a pre-0.11.0 build
83
+ * ignores `wrap_overrides`, and its next whole-unit write drops that table, so
84
+ * downgrading across 0.11.0 loses only the overrides.
59
85
  */
60
86
  const UNIT_DESCRIPTOR = Object.freeze({
61
87
  name: 'dsh_editor',
62
88
  version: 1,
63
- tables: Object.freeze(['mode_associations', 'keymap', 'settings']),
89
+ tables: Object.freeze(['mode_associations', 'keymap', 'settings', 'wrap_overrides']),
64
90
  hasGlobal: true
65
91
  });
66
92
 
@@ -70,16 +96,26 @@ const TABLE = 'mode_associations';
70
96
  const KEYMAP_TABLE = 'keymap';
71
97
  /** Table whose records are the behavior toggles: record key = setting name. */
72
98
  const SETTINGS_TABLE = 'settings';
99
+ /** Table whose records are the word-wrap overrides: record key = glob. */
100
+ const WRAP_OVERRIDES_TABLE = 'wrap_overrides';
73
101
 
74
- /** Setting names this build knows; unknown keys in a payload are rejected. */
75
- const SETTINGS_KEYS = new Set(['autoReloadClean', 'highlightActiveLine', 'showLineNumbers']);
102
+ /**
103
+ * Setting names this build knows; unknown keys in a payload are rejected.
104
+ * A KNOWN key absent from storage is never invented here — `getSettings`
105
+ * reports only the records actually stored, so the client can tell "unset"
106
+ * (e.g. `wordWrap`, which then falls back to its builtin per-file default)
107
+ * from an explicitly stored value.
108
+ */
109
+ const SETTINGS_KEYS = new Set(['autoReloadClean', 'highlightActiveLine', 'showLineNumbers', 'scrollBeyondLastLine', 'wordWrap']);
76
110
 
77
- /** Keymap action ids the editor framework owns (spec §6). */
78
- const KEYMAP_ACTIONS = new Set(['save', 'saveAll', 'deleteLines']);
111
+ /** Keymap action ids the editor framework owns (spec §6; `gotoLine` v0.6.0). */
112
+ const KEYMAP_ACTIONS = new Set(['save', 'saveAll', 'deleteLines', 'gotoLine']);
79
113
  /** Storable `KeyboardEvent.code` alphabet for a keymap binding. */
80
114
  const KEYMAP_CODE_RE = /^(Key[A-Z]|Digit[0-9])$/;
81
115
  /** Abstract modifier vocabulary for a keymap binding. */
82
116
  const KEYMAP_MODIFIERS = new Set(['primary', 'control', 'alt', 'shift', 'meta']);
117
+ /** Storable record-key shape for a word-wrap override: `*.` + 1-16 [a-z0-9] (spec §6). */
118
+ const WRAP_OVERRIDE_GLOB_RE = /^\*\.[a-z0-9]{1,16}$/;
83
119
 
84
120
  /**
85
121
  * Build the plain-Error stand-in for a DOMException AbortError; the storage
@@ -138,7 +174,7 @@ function tableOf(snapshot, name) {
138
174
 
139
175
  /**
140
176
  * Validate the keymap payload: a NON-EMPTY array of
141
- * `{ action ∈ {save, saveAll, deleteLines}, code: /^(Key[A-Z]|Digit[0-9])$/,
177
+ * `{ action ∈ {save, saveAll, deleteLines, gotoLine}, code: /^(Key[A-Z]|Digit[0-9])$/,
142
178
  * modifiers: array ⊆ {primary, control, alt, shift, meta} }` with unique
143
179
  * action ids and no two bindings sharing one (code, modifier-set) combo — a
144
180
  * duplicated combo would make dispatch ambiguous. Extra properties are
@@ -205,6 +241,30 @@ function isValidSettings(settings) {
205
241
  return true;
206
242
  }
207
243
 
244
+ /**
245
+ * Validate the word-wrap overrides payload: an array (an EMPTY array is valid
246
+ * — the full-set replace then deletes every record, i.e. resets to "no
247
+ * overrides") of `{ glob: /^\*\.[a-z0-9]{1,16}$/, enabled: boolean }`. A
248
+ * duplicated glob is rejected instead of letting the last entry win: one glob
249
+ * maps to exactly one override, so a duplicate is a client bug that would
250
+ * otherwise persist an arbitrary winner. Extra properties are tolerated (only
251
+ * the contract fields are read).
252
+ * @param overrides - the caller's payload.
253
+ * @returns whether the payload is storable.
254
+ */
255
+ function isValidWrapOverrides(overrides) {
256
+ if (!Array.isArray(overrides)) return false;
257
+ const globs = new Set();
258
+ for (const entry of overrides) {
259
+ if (entry === null || typeof entry !== 'object') return false;
260
+ if (typeof entry.glob !== 'string' || !WRAP_OVERRIDE_GLOB_RE.test(entry.glob)) return false;
261
+ if (globs.has(entry.glob)) return false; // duplicate glob
262
+ globs.add(entry.glob);
263
+ if (typeof entry.enabled !== 'boolean') return false;
264
+ }
265
+ return true;
266
+ }
267
+
208
268
  /**
209
269
  * Build the mode-preferences service.
210
270
  * @param kv - a `StorageBackend` KvFacet (`open(descriptor)` → `KvUnit`).
@@ -457,6 +517,75 @@ export function createPreferencesService({ kv, now }) {
457
517
  });
458
518
  },
459
519
 
520
+ /**
521
+ * Read the stored per-file-type word-wrap overrides (spec §6).
522
+ * @param signal - caller cancellation (last parameter, SRC convention).
523
+ * @returns `{ overrides: [{ glob, enabled }] sorted by glob, updatedAt }`
524
+ * — `overrides` is empty before the first successful set (the client
525
+ * then falls back to the global `wordWrap` setting); `updatedAt` is the
526
+ * SHARED token (see the module doc).
527
+ */
528
+ async getWrapOverrides(signal) {
529
+ throwIfAborted(signal);
530
+ const unit = await openUnit();
531
+ const snapshot = await unit.loadAll();
532
+ throwIfAborted(signal);
533
+ const records = tableOf(snapshot, WRAP_OVERRIDES_TABLE);
534
+ const overrides = Object.keys(records)
535
+ .filter((glob) => {
536
+ const value = records[glob];
537
+ return value !== null && typeof value === 'object' && typeof value.enabled === 'boolean';
538
+ })
539
+ .sort()
540
+ .map((glob) => ({ glob, enabled: records[glob].enabled }));
541
+ return { overrides, updatedAt: globalUpdatedAt(snapshot.global) };
542
+ },
543
+
544
+ /**
545
+ * Replace the complete word-wrap override set (records absent from the
546
+ * array are deleted; `[]` resets to "no overrides"), restamping the
547
+ * unit's SHARED global `updatedAt` — which invalidates any pending
548
+ * associations / keymap / settings CAS against the older token.
549
+ * @param overrides - the complete new set
550
+ * (`[{ glob: /^\*\.[a-z0-9]{1,16}$/, enabled: boolean }]`, unique
551
+ * globs); validated before the write chain, so an invalid payload never
552
+ * touches storage.
553
+ * @param expectedUpdatedAt - compare-and-set guard against the SHARED
554
+ * token: when provided and not equal to the storage's current
555
+ * `updatedAt`, the write rejects with `wrap-overrides/conflict` and
556
+ * storage is untouched. Omit (or pass `undefined`) to write
557
+ * unconditionally.
558
+ * @param signal - caller cancellation (last parameter, SRC convention).
559
+ * @returns `{ updatedAt }` of the settled write.
560
+ */
561
+ async setWrapOverrides(overrides, expectedUpdatedAt, signal) {
562
+ if (!isValidWrapOverrides(overrides)) {
563
+ throw codedError('wrap-overrides/invalid');
564
+ }
565
+ throwIfAborted(signal);
566
+ return enqueue(async () => {
567
+ throwIfAborted(signal);
568
+ const unit = await openUnit();
569
+ const snapshot = await unit.loadAll();
570
+ const records = tableOf(snapshot, WRAP_OVERRIDES_TABLE);
571
+ const currentUpdatedAt = globalUpdatedAt(snapshot.global);
572
+ if (expectedUpdatedAt !== undefined && expectedUpdatedAt !== currentUpdatedAt) {
573
+ throw codedError('wrap-overrides/conflict');
574
+ }
575
+ const existingKeys = Object.keys(records);
576
+ if (existingKeys.length > 0) {
577
+ await unit.deleteRecords(WRAP_OVERRIDES_TABLE, existingKeys);
578
+ }
579
+ const updatedAt = now();
580
+ for (const { glob, enabled } of overrides) {
581
+ await unit.putRecord(WRAP_OVERRIDES_TABLE, glob, { enabled, updatedAt });
582
+ }
583
+ await unit.setGlobal({ updatedAt });
584
+ throwIfAborted(signal);
585
+ return { updatedAt };
586
+ });
587
+ },
588
+
460
589
  /**
461
590
  * Drain the write chain, close the unit when one was opened, and forget
462
591
  * the open so a later call reopens lazily. Idempotent; wired into the
package/index.js CHANGED
@@ -7,20 +7,26 @@
7
7
  * Remote marker on the prototype make the Typert Gateway's conservative SRC
8
8
  * discovery claim `dshEditor/writeFile`, `dshEditor/getModePreferences`,
9
9
  * `dshEditor/setModePreferences`, `dshEditor/getKeymap`,
10
- * `dshEditor/setKeymap`, `dshEditor/getSettings` and
11
- * `dshEditor/setSettings`, so no generated Typert artifacts are needed.
10
+ * `dshEditor/setKeymap`, `dshEditor/getSettings`,
11
+ * `dshEditor/setSettings`, `dshEditor/getWrapOverrides`,
12
+ * `dshEditor/setWrapOverrides` and `dshEditor/appendLogs` (the client log
13
+ * channel's flush endpoint), so no generated Typert artifacts are needed.
12
14
  *
13
15
  * Deliberately imports no `@deepseek-ai/*` package: every capability comes
14
- * from the Cordis context (`fs`, `sandboxPolicy`, `sessions`, `storage`), so
15
- * the bundle loads under any profile node_modules layout. The service bodies
16
- * live in `host/write-service.js` and `host/preferences-service.js` and are
17
- * composed here onto one prototype that carries all five Remote markers.
16
+ * from the Cordis context (`fs`, `sandboxPolicy`, `sessions`, `storage`),
17
+ * so the bundle loads under any profile node_modules layout. The service
18
+ * bodies live in `host/write-service.js`, `host/preferences-service.js` and
19
+ * `host/log-service.js` and are composed here onto one prototype that
20
+ * carries all ten Remote markers; the log service's exporter is also
21
+ * registered on `ctx.logger` inside the effect so this plugin's own Host
22
+ * records persist through the same chain.
18
23
  *
19
24
  * @module @dybai/dsh-editor
20
25
  */
21
26
 
22
27
  import { createFileService } from './host/write-service.js';
23
28
  import { createPreferencesService } from './host/preferences-service.js';
29
+ import { createLogService } from './host/log-service.js';
24
30
 
25
31
  /** Cordis service key and wire namespace of the editor Host service. */
26
32
  const SERVICE_KEY = 'dshEditor';
@@ -105,6 +111,10 @@ function resolveKvFacet(storage) {
105
111
  * @returns the effect disposer cordis owns.
106
112
  */
107
113
  export function apply(ctx) {
114
+ // Named Host logger for this plugin's own records. A context without a
115
+ // logger degrades silently — the iron rule: logging must never break apply.
116
+ const hostLog = typeof ctx.logger === 'function' ? ctx.logger('dsh-editor') : null;
117
+ hostLog?.info('lifecycle', 'host apply begin');
108
118
  const fs = ctx.get('fs');
109
119
  if (fs === undefined || typeof fs.resolve !== 'function' || typeof fs.writeText !== 'function') {
110
120
  throw new Error('dsh-editor: the Host filesystem service with resolve/writeText is unavailable');
@@ -121,7 +131,22 @@ export function apply(ctx) {
121
131
 
122
132
  const files = createFileService(fs, sandboxPolicy, sessions);
123
133
  const preferences = createPreferencesService({ kv, now: Date.now });
124
- // One wire service: exactly the seven Remote-marked methods on one
134
+ // Same shared KV facet, its own unit (opened per-descriptor): the
135
+ // persistent log store behind `appendLogs` and the ctx.logger exporter.
136
+ // Rotation anomalies are plugin-observable events, so their `warn` routes
137
+ // through the named logger and persists (spec §7.2 打点); the module's own
138
+ // failures stay on `report.error` → console only (spec §8: they must never
139
+ // re-enter the channel — the exporter's re-entrancy guard keeps the warn
140
+ // routing loop-safe).
141
+ const logService = createLogService({
142
+ kv,
143
+ now: Date.now,
144
+ report: {
145
+ warn: (msg) => (hostLog !== null ? hostLog.warn('logs', msg) : console.warn('[dsh-editor]', msg)),
146
+ error: console.error.bind(console)
147
+ }
148
+ });
149
+ // One wire service: exactly the ten Remote-marked methods on one
125
150
  // prototype, each delegating to its factory's closure.
126
151
  const service = Object.create({
127
152
  writeFile: files.writeFile,
@@ -130,7 +155,10 @@ export function apply(ctx) {
130
155
  getKeymap: preferences.getKeymap,
131
156
  setKeymap: preferences.setKeymap,
132
157
  getSettings: preferences.getSettings,
133
- setSettings: preferences.setSettings
158
+ setSettings: preferences.setSettings,
159
+ getWrapOverrides: preferences.getWrapOverrides,
160
+ setWrapOverrides: preferences.setWrapOverrides,
161
+ appendLogs: (entries) => logService.appendEntries(entries)
134
162
  });
135
163
  const prototype = Object.getPrototypeOf(service);
136
164
  const markerKey = remoteMarkerKey(ctx);
@@ -163,20 +191,40 @@ export function apply(ctx) {
163
191
  Object.freeze({
164
192
  method: 'setSettings',
165
193
  invocation: Object.freeze({ kind: 'direct' })
194
+ }),
195
+ Object.freeze({
196
+ method: 'getWrapOverrides',
197
+ invocation: Object.freeze({ kind: 'direct' })
198
+ }),
199
+ Object.freeze({
200
+ method: 'setWrapOverrides',
201
+ invocation: Object.freeze({ kind: 'direct' })
202
+ }),
203
+ Object.freeze({
204
+ method: 'appendLogs',
205
+ invocation: Object.freeze({ kind: 'direct' })
166
206
  })
167
207
  ])
168
208
  })
169
209
  });
170
210
  service.typertRemote = Object.freeze({ service, serviceKey: SERVICE_KEY, namespace: SERVICE_KEY });
171
211
 
172
- return ctx.effect(() => {
212
+ const effect = ctx.effect(() => {
173
213
  const disposeProvide = ctx.provide(SERVICE_KEY, service);
214
+ // Funnel this plugin's own named Host logger records into the same
215
+ // persistent store. cordis's `exporter()` registers via `ctx.effect`
216
+ // and returns a bare callable effect disposer (no `.dispose`); the
217
+ // fiber owns that registration, so disposal covers exporter removal.
218
+ ctx.logger.exporter(logService.createExporter({ loggerName: 'dsh-editor' }));
174
219
  return () => {
175
220
  disposeProvide();
176
- // Release the KV unit so a fiber restart never trips the storage
221
+ // Release the KV units so a fiber restart never trips the storage
177
222
  // contract's "same unit opened twice" rejection; failure here must
178
223
  // not break disposal.
179
224
  preferences.close().catch(() => {});
225
+ logService.close().catch(() => {});
180
226
  };
181
227
  }, 'dsh-editor: workspace file-write and preference services');
228
+ hostLog?.info('lifecycle', 'host apply complete');
229
+ return effect;
182
230
  }
package/locale/en.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "File editor",
4
- "description": "Makes text files in the side pane editable: open a file, edit it in place, and save back to disk with Ctrl+S (rebindable from the status-bar keyboard icon), with stale-version conflict prompts and reload; external modifications and deletions are detected and surfaced."
4
+ "description": "Makes text files in the side pane editable: open a file, edit it in place, and save back to disk with Ctrl+S (rebindable in the settings center opened from the status-bar gear), jump to a line with Ctrl+G, with stale-version conflict prompts and reload; external modifications and deletions are detected and surfaced."
5
5
  },
6
6
  "action": {
7
7
  "save": "Save",
@@ -50,20 +50,29 @@
50
50
  "conflict": "Mode preferences changed elsewhere; reloaded, please retry."
51
51
  },
52
52
  "keymap": {
53
- "buttonTitle": "Editor shortcuts",
54
53
  "save": "Save",
55
54
  "saveAll": "Save all",
56
55
  "deleteLines": "Delete lines",
56
+ "gotoLine": "Go to line",
57
57
  "record": "Record",
58
58
  "recording": "Press the new combo… (Esc to cancel)",
59
59
  "reset": "Restore defaults",
60
- "resetTitle": "Restore the default keys (Ctrl+S / Ctrl+Shift+S / Ctrl+D)",
60
+ "resetTitle": "Restore the default keys (Ctrl+S / Ctrl+Shift+S / Ctrl+D / Ctrl+G)",
61
61
  "duplicate": "That combo is already used by another action; pick another one.",
62
62
  "reserved": "This combination is reserved by the browser (e.g. close/new tab) and cannot be recorded",
63
63
  "reservedHint": "Browser-reserved combos (Ctrl/⌘+W, T, N, Q, …) cannot be recorded",
64
64
  "writeFailed": "Failed to save shortcuts",
65
65
  "conflict": "Shortcuts changed elsewhere; reloaded, please retry."
66
66
  },
67
+ "goto": {
68
+ "title": "Go to line",
69
+ "context": "Ln {line} of {max}",
70
+ "placeholder": "Line (1–{max})",
71
+ "jump": "Go",
72
+ "jumpTitle": "Jump to the entered line (Enter)",
73
+ "invalid": "Enter a line between 1 and {max}",
74
+ "loading": "Loading the file…"
75
+ },
67
76
  "external": {
68
77
  "modified": "The file was modified externally. Reload it?",
69
78
  "deleted": "The file was deleted externally. Close this tab?",
@@ -87,11 +96,31 @@
87
96
  "highlightActiveLineNote": "The built-in plain-text mode always honors this; other editor modes may declare support via their descriptor.",
88
97
  "showLineNumbers": "Show line numbers",
89
98
  "showLineNumbersTitle": "Draw the line-number column beside the content",
99
+ "scrollBeyondLastLine": "Scroll past last line",
100
+ "scrollBeyondLastLineTitle": "Keep scrollable blank space past the end of content so the last line can scroll to the top of the viewport",
101
+ "wordWrap": "Word wrap",
102
+ "wordWrapTitle": "Wrap overly long lines within the editor width",
90
103
  "on": "On",
91
104
  "off": "Off",
92
105
  "writeFailed": "Failed to save settings",
93
106
  "conflict": "Settings changed elsewhere; reloaded, please retry."
94
107
  },
108
+ "settingsCenter": {
109
+ "title": "Editor settings",
110
+ "close": "Close",
111
+ "section": {
112
+ "appearance": "Appearance",
113
+ "behavior": "Behavior",
114
+ "wrap": "Word wrap",
115
+ "keymap": "Shortcuts"
116
+ },
117
+ "wordWrapGlobalNote": "When unset, the per-extension default applies (md-like files wrap)",
118
+ "wrapOverrideLabel": "Word wrap for this type",
119
+ "wrapOverrideFollow": "Follow global",
120
+ "wrapOverrideOn": "Force on",
121
+ "wrapOverrideOff": "Force off",
122
+ "wrapOverrideNoExtension": "(no extension)"
123
+ },
95
124
  "status": {
96
125
  "lines": "lines",
97
126
  "chars": "chars"
package/locale/zh.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "文件编辑器",
4
- "description": "让分栏里的文本文件可以直接编辑:打开文件就地修改并保存到磁盘(Ctrl+S,可在状态栏键盘图标中改键),带版本冲突提示与重新加载;文件被外部修改或删除时主动提示。"
4
+ "description": "让分栏里的文本文件可以直接编辑:打开文件就地修改并保存到磁盘(Ctrl+S,可在状态栏齿轮打开的设置中心里改键),Ctrl+G 跳转到指定行,带版本冲突提示与重新加载;文件被外部修改或删除时主动提示。"
5
5
  },
6
6
  "action": {
7
7
  "save": "保存",
@@ -50,20 +50,29 @@
50
50
  "conflict": "模式偏好已被其他位置修改,已重新读取,请重试。"
51
51
  },
52
52
  "keymap": {
53
- "buttonTitle": "编辑器快捷键",
54
53
  "save": "保存",
55
54
  "saveAll": "保存全部",
56
55
  "deleteLines": "删行",
56
+ "gotoLine": "跳转到行",
57
57
  "record": "录制",
58
58
  "recording": "按下新组合…(Esc 取消)",
59
59
  "reset": "恢复默认",
60
- "resetTitle": "把三个动作的键位恢复为默认(Ctrl+S / Ctrl+Shift+S / Ctrl+D)",
60
+ "resetTitle": "把四个动作的键位恢复为默认(Ctrl+S / Ctrl+Shift+S / Ctrl+D / Ctrl+G)",
61
61
  "duplicate": "该组合已被其他动作占用,请换一个组合。",
62
62
  "reserved": "该组合被浏览器保留(如关闭/新建标签页),无法录制",
63
63
  "reservedHint": "浏览器保留组合(Ctrl/⌘+W、T、N、Q 等)无法录制",
64
64
  "writeFailed": "保存快捷键失败",
65
65
  "conflict": "快捷键已被其他位置修改,已重新读取,请重试。"
66
66
  },
67
+ "goto": {
68
+ "title": "跳转到行",
69
+ "context": "当前 {line} 行 · 共 {max} 行",
70
+ "placeholder": "行号(1–{max})",
71
+ "jump": "跳转",
72
+ "jumpTitle": "跳转到输入的行(Enter)",
73
+ "invalid": "请输入 1–{max} 之间的行号",
74
+ "loading": "正在加载文件…"
75
+ },
67
76
  "external": {
68
77
  "modified": "文件已被外部修改。是否重新加载?",
69
78
  "deleted": "文件已被外部删除。是否关闭页签?",
@@ -87,11 +96,31 @@
87
96
  "highlightActiveLineNote": "内置纯文本模式始终支持;其他编辑模式可经描述符 activeLine 声明遵循同一开关。",
88
97
  "showLineNumbers": "显示行号",
89
98
  "showLineNumbersTitle": "在内容左侧显示行号列",
99
+ "scrollBeyondLastLine": "滚动越过最后一行",
100
+ "scrollBeyondLastLineTitle": "在内容末尾之后保留可滚动空白,最后一行可滚动到视口顶部",
101
+ "wordWrap": "自动换行",
102
+ "wordWrapTitle": "过长的行在编辑区宽度内自动折行显示",
90
103
  "on": "开",
91
104
  "off": "关",
92
105
  "writeFailed": "保存设置失败",
93
106
  "conflict": "设置已被其他位置修改,已重新读取,请重试。"
94
107
  },
108
+ "settingsCenter": {
109
+ "title": "编辑器设置",
110
+ "close": "关闭",
111
+ "section": {
112
+ "appearance": "外观",
113
+ "behavior": "行为",
114
+ "wrap": "换行",
115
+ "keymap": "快捷键"
116
+ },
117
+ "wordWrapGlobalNote": "未设置时按扩展名默认(md 系开)",
118
+ "wrapOverrideLabel": "本类型换行",
119
+ "wrapOverrideFollow": "跟随全局",
120
+ "wrapOverrideOn": "强制开",
121
+ "wrapOverrideOff": "强制关",
122
+ "wrapOverrideNoExtension": "(无扩展名)"
123
+ },
95
124
  "status": {
96
125
  "lines": "行",
97
126
  "chars": "字符"
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dybai/dsh-editor",
3
- "version": "0.5.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "test": "node --test src/**/*.test.js host/**/*.test.js",
6
+ "test": "node --test index.test.js src/**/*.test.js host/**/*.test.js",
7
7
  "build": "node scripts/build.mjs"
8
8
  },
9
9
  "description": "Edit workspace text files in place: an extension tab type takes over session file addresses with a save/reload editor backed by a Host file-write service",
@@ -17,6 +17,8 @@
17
17
  "index.js",
18
18
  "host/write-service.js",
19
19
  "host/preferences-service.js",
20
+ "host/log-service.js",
21
+ "host/log-serialize.js",
20
22
  "client.js",
21
23
  "cordis.patch.yml",
22
24
  "locale/en.json",