@lvce-editor/shared-process 0.100.11 → 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.11",
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.11",
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', '49d5626', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '0410e4c', 'extensions')
7
7
  return builtinExtensionsPath
8
8
  }
@@ -6,4 +6,5 @@ export const Commands = {
6
6
  complete: LanguageServer.complete,
7
7
  definition: LanguageServer.definition,
8
8
  diagnostic: LanguageServer.diagnostic,
9
+ format: LanguageServer.format,
9
10
  }
@@ -27,6 +27,14 @@ import { normalizeLanguageServerDocumentUri } from '../NormalizeLanguageServerDo
27
27
 
28
28
 
29
29
 
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
30
38
 
31
39
 
32
40
 
@@ -95,6 +103,16 @@ export const definition = async ({ argv, id, offset, rootUri, textDocument, uri
95
103
  return connection.definition(normalizedDocument, offset)
96
104
  }
97
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
+
98
116
  export const disposeAll = () => {
99
117
  for (const state of connections.values()) {
100
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 } ) {
@@ -232,6 +234,24 @@ export class LanguageServerConnection {
232
234
  })
233
235
  }
234
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
+
235
255
  configureMarkdown(languageId) {
236
256
  if (languageId !== 'markdown' || this.markdownConfigured) {
237
257
  return
@@ -319,6 +339,7 @@ export class LanguageServerConnection {
319
339
  },
320
340
  ],
321
341
  }))
342
+ this.supportsDocumentFormatting = Boolean(result?.capabilities?.documentFormattingProvider)
322
343
  this.supportsPullDiagnostics = Boolean(result?.capabilities?.diagnosticProvider)
323
344
  this.sendNotification('initialized', {})
324
345
  await Promise.race([this.initializationProgressStarted.promise, wait(100)])
@@ -214,6 +214,7 @@ export const getModuleId = (commandId) => {
214
214
  case 'LanguageServer.complete':
215
215
  case 'LanguageServer.definition':
216
216
  case 'LanguageServer.diagnostic':
217
+ case 'LanguageServer.format':
217
218
  return ModuleId.LanguageServer
218
219
  case 'ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage':
219
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.11'
64
+ export const version = '0.100.12'
65
65
 
66
- export const commit = '49d5626'
66
+ export const commit = '0410e4c'
67
67
 
68
- export const date = '2026-08-10T22:59:17.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', '49d5626', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', '0410e4c', 'packages', 'preload', 'dist', 'index.js')
6
6
  }