@lvce-editor/shared-process 0.100.10 → 0.100.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.100.10",
3
+ "version": "0.100.12",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.9.0",
21
- "@lvce-editor/extension-host-helper-process": "0.100.10",
21
+ "@lvce-editor/extension-host-helper-process": "0.100.12",
22
22
  "@lvce-editor/ipc": "16.10.0",
23
23
  "@lvce-editor/json-rpc": "8.6.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.0",
@@ -3,6 +3,6 @@ import { fileURLToPath } from 'url'
3
3
 
4
4
  export const getBuiltinExtensionsPath = () => {
5
5
  const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'))
6
- const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'a7f0576', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '0410e4c', 'extensions')
7
7
  return builtinExtensionsPath
8
8
  }
@@ -4,5 +4,7 @@ export const name = 'LanguageServer'
4
4
 
5
5
  export const Commands = {
6
6
  complete: LanguageServer.complete,
7
+ definition: LanguageServer.definition,
7
8
  diagnostic: LanguageServer.diagnostic,
9
+ format: LanguageServer.format,
8
10
  }
@@ -21,6 +21,16 @@ import { normalizeLanguageServerDocumentUri } from '../NormalizeLanguageServerDo
21
21
 
22
22
 
23
23
 
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
24
34
 
25
35
 
26
36
 
@@ -83,6 +93,26 @@ export const diagnostic = async ({ argv, id, rootUri, textDocument, uri }
83
93
  return connection.diagnostic(normalizedDocument)
84
94
  }
85
95
 
96
+ export const definition = async ({ argv, id, offset, rootUri, textDocument, uri } ) => {
97
+ const normalizedDocument = {
98
+ ...textDocument,
99
+ uri: normalizeLanguageServerDocumentUri(textDocument.uri),
100
+ }
101
+ const normalizedRootUri = rootUri ? normalizeLanguageServerDocumentUri(rootUri) : getRootUri(normalizedDocument.uri)
102
+ const connection = getConnection(`${id}:${normalizedRootUri}`, uri, argv, normalizedRootUri)
103
+ return connection.definition(normalizedDocument, offset)
104
+ }
105
+
106
+ export const format = async ({ argv, id, rootUri, textDocument, uri } ) => {
107
+ const normalizedDocument = {
108
+ ...textDocument,
109
+ uri: normalizeLanguageServerDocumentUri(textDocument.uri),
110
+ }
111
+ const normalizedRootUri = rootUri ? normalizeLanguageServerDocumentUri(rootUri) : getRootUri(normalizedDocument.uri)
112
+ const connection = getConnection(`${id}:${normalizedRootUri}`, uri, argv, normalizedRootUri)
113
+ return connection.format(normalizedDocument)
114
+ }
115
+
86
116
  export const disposeAll = () => {
87
117
  for (const state of connections.values()) {
88
118
  state.connection.dispose()
@@ -32,6 +32,7 @@ import { normalizeLanguageServerDocumentUri } from '../NormalizeLanguageServerDo
32
32
 
33
33
 
34
34
 
35
+
35
36
 
36
37
 
37
38
 
@@ -131,6 +132,7 @@ export class LanguageServerConnection {
131
132
  nextRequestId = 1
132
133
  running = true
133
134
  stderr = ''
135
+ supportsDocumentFormatting = false
134
136
  supportsPullDiagnostics = false
135
137
 
136
138
  constructor({ argv, rootUri, uri } ) {
@@ -220,6 +222,36 @@ export class LanguageServerConnection {
220
222
  return diagnostics
221
223
  }
222
224
 
225
+ async definition(textDocument, offset) {
226
+ await this.ready
227
+ this.configureMarkdown(textDocument.languageId)
228
+ this.syncDocument(textDocument)
229
+ return this.sendRequest('textDocument/definition', {
230
+ position: getPosition(textDocument.text, offset),
231
+ textDocument: {
232
+ uri: textDocument.uri,
233
+ },
234
+ })
235
+ }
236
+
237
+ async format(textDocument) {
238
+ await this.ready
239
+ if (!this.supportsDocumentFormatting) {
240
+ return []
241
+ }
242
+ this.syncDocument(textDocument)
243
+ const result = await this.sendRequest('textDocument/formatting', {
244
+ options: {
245
+ insertSpaces: true,
246
+ tabSize: 2,
247
+ },
248
+ textDocument: {
249
+ uri: textDocument.uri,
250
+ },
251
+ })
252
+ return Array.isArray(result) ? result : []
253
+ }
254
+
223
255
  configureMarkdown(languageId) {
224
256
  if (languageId !== 'markdown' || this.markdownConfigured) {
225
257
  return
@@ -307,6 +339,7 @@ export class LanguageServerConnection {
307
339
  },
308
340
  ],
309
341
  }))
342
+ this.supportsDocumentFormatting = Boolean(result?.capabilities?.documentFormattingProvider)
310
343
  this.supportsPullDiagnostics = Boolean(result?.capabilities?.diagnosticProvider)
311
344
  this.sendNotification('initialized', {})
312
345
  await Promise.race([this.initializationProgressStarted.promise, wait(100)])
@@ -212,7 +212,9 @@ export const getModuleId = (commandId) => {
212
212
  case 'IsAutoUpdateSupported.isAutoUpdateSupported':
213
213
  return ModuleId.IsAutoUpdateSupported
214
214
  case 'LanguageServer.complete':
215
+ case 'LanguageServer.definition':
215
216
  case 'LanguageServer.diagnostic':
217
+ case 'LanguageServer.format':
216
218
  return ModuleId.LanguageServer
217
219
  case 'ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage':
218
220
  return ModuleId.ListProcessesWithMemoryUsage
@@ -61,11 +61,11 @@ export const getSetupName = () => {
61
61
  return 'Lvce-Setup'
62
62
  }
63
63
 
64
- export const version = '0.100.10'
64
+ export const version = '0.100.12'
65
65
 
66
- export const commit = 'a7f0576'
66
+ export const commit = '0410e4c'
67
67
 
68
- export const date = '2026-08-10T19:41:34.000Z'
68
+ export const date = '2026-08-10T23:15:31.000Z'
69
69
 
70
70
  export const getVersion = () => {
71
71
  return version
@@ -2,5 +2,5 @@ import { join } from 'node:path'
2
2
  import * as Root from '../Root/Root.js'
3
3
 
4
4
  export const getPreloadUrl = () => {
5
- return join(Root.root, 'static', 'a7f0576', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', '0410e4c', 'packages', 'preload', 'dist', 'index.js')
6
6
  }