@singapore-editor/lsp-plugin 0.1.1 → 0.2.13

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.
Files changed (116) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +31 -77
  3. package/dist/codeActions.d.ts.map +1 -1
  4. package/dist/codeActions.js +1 -2
  5. package/dist/colorAlpha.js +1 -2
  6. package/dist/completion.js +3 -4
  7. package/dist/completion.js.map +1 -1
  8. package/dist/completionCommit.js +2 -3
  9. package/dist/completionCommit.js.map +1 -1
  10. package/dist/completionController.d.ts.map +1 -1
  11. package/dist/completionController.js +1 -2
  12. package/dist/completionProviders.d.ts.map +1 -1
  13. package/dist/completionProviders.js +2 -3
  14. package/dist/definitionLinkController.d.ts +4 -1
  15. package/dist/definitionLinkController.d.ts.map +1 -1
  16. package/dist/definitionLinkController.js +40 -20
  17. package/dist/definitionLinkController.js.map +1 -1
  18. package/dist/definitionNavigation.js +1 -2
  19. package/dist/diagnosticNotes.js +1 -2
  20. package/dist/diagnosticProjection.d.ts +1 -1
  21. package/dist/diagnosticProjection.d.ts.map +1 -1
  22. package/dist/diagnosticProjection.js +2 -3
  23. package/dist/diagnosticProjection.js.map +1 -1
  24. package/dist/diagnostics.js +1 -2
  25. package/dist/diagnosticsPresenter.d.ts.map +1 -1
  26. package/dist/diagnosticsPresenter.js +3 -4
  27. package/dist/diagnosticsPresenter.js.map +1 -1
  28. package/dist/document.d.ts +7 -6
  29. package/dist/document.d.ts.map +1 -1
  30. package/dist/document.js +36 -19
  31. package/dist/document.js.map +1 -1
  32. package/dist/documentHighlightController.d.ts.map +1 -1
  33. package/dist/documentHighlightController.js +1 -2
  34. package/dist/documentSnapshot.d.ts +3 -2
  35. package/dist/documentSnapshot.d.ts.map +1 -1
  36. package/dist/documentSnapshot.js +5 -6
  37. package/dist/documentSnapshot.js.map +1 -1
  38. package/dist/documentSync.d.ts +18 -20
  39. package/dist/documentSync.d.ts.map +1 -1
  40. package/dist/documentSync.js +120 -226
  41. package/dist/documentSync.js.map +1 -1
  42. package/dist/documentSyncController.d.ts +2 -4
  43. package/dist/documentSyncController.d.ts.map +1 -1
  44. package/dist/documentSyncController.js +2 -9
  45. package/dist/documentSyncController.js.map +1 -1
  46. package/dist/formatOnType.d.ts.map +1 -1
  47. package/dist/formatOnType.js +1 -2
  48. package/dist/formatting.js +1 -2
  49. package/dist/fuzzyMatch.js +1 -2
  50. package/dist/hoverParticipant.js +1 -2
  51. package/dist/index.d.ts +0 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +2 -3
  54. package/dist/keyCommands.d.ts +10 -10
  55. package/dist/keyCommands.d.ts.map +1 -1
  56. package/dist/keyCommands.js +1 -2
  57. package/dist/lane.d.ts +1 -1
  58. package/dist/lane.d.ts.map +1 -1
  59. package/dist/lane.js +8 -6
  60. package/dist/lane.js.map +1 -1
  61. package/dist/lspConnection.d.ts.map +1 -1
  62. package/dist/lspConnection.js +1 -2
  63. package/dist/lspConnectionPool.d.ts.map +1 -1
  64. package/dist/lspConnectionPool.js +1 -2
  65. package/dist/minimalEdits.js +1 -2
  66. package/dist/paths.js +1 -2
  67. package/dist/plugin.d.ts +1 -1
  68. package/dist/plugin.d.ts.map +1 -1
  69. package/dist/plugin.js +25 -15
  70. package/dist/plugin.js.map +1 -1
  71. package/dist/plugin.styles.js +1 -2
  72. package/dist/pluginTypes.d.ts +5 -1
  73. package/dist/pluginTypes.d.ts.map +1 -1
  74. package/dist/pullDiagnostics.d.ts.map +1 -1
  75. package/dist/pullDiagnostics.js +1 -2
  76. package/dist/renameWidget.d.ts +2 -0
  77. package/dist/renameWidget.d.ts.map +1 -1
  78. package/dist/renameWidget.js +15 -14
  79. package/dist/renameWidget.js.map +1 -1
  80. package/dist/retainedSource.d.ts +41 -0
  81. package/dist/retainedSource.d.ts.map +1 -0
  82. package/dist/retainedSource.js +200 -0
  83. package/dist/retainedSource.js.map +1 -0
  84. package/dist/semanticTokenDecoder.js +1 -2
  85. package/dist/semanticTokens.d.ts.map +1 -1
  86. package/dist/semanticTokens.js +1 -2
  87. package/dist/serverSet.d.ts.map +1 -1
  88. package/dist/serverSet.js +27 -10
  89. package/dist/serverSet.js.map +1 -1
  90. package/dist/signatureHelp.js +1 -2
  91. package/dist/signatureHelpController.d.ts.map +1 -1
  92. package/dist/signatureHelpController.js +2 -2
  93. package/dist/signatureHelpController.js.map +1 -1
  94. package/dist/sourceConnection.d.ts +4 -0
  95. package/dist/sourceConnection.d.ts.map +1 -0
  96. package/dist/sourceConnection.js +21 -0
  97. package/dist/sourceConnection.js.map +1 -0
  98. package/dist/sourceText.js +1 -2
  99. package/dist/types.d.ts +2 -2
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/types.js +1 -2
  102. package/dist/types.js.map +1 -1
  103. package/dist/viewDocumentSnapshot.js +1 -2
  104. package/dist/workspaceEdit.js +1 -2
  105. package/dist/workspaceEditProvenance.d.ts.map +1 -1
  106. package/dist/workspaceEditProvenance.js +2 -3
  107. package/dist/workspaceEditProvenance.js.map +1 -1
  108. package/dist/workspaceTextEdits.d.ts +4 -1
  109. package/dist/workspaceTextEdits.d.ts.map +1 -1
  110. package/dist/workspaceTextEdits.js +21 -12
  111. package/dist/workspaceTextEdits.js.map +1 -1
  112. package/package.json +29 -11
  113. package/dist/bufferSync.d.ts +0 -12
  114. package/dist/bufferSync.d.ts.map +0 -1
  115. package/dist/bufferSync.js +0 -35
  116. package/dist/bufferSync.js.map +0 -1
package/dist/document.js CHANGED
@@ -1,35 +1,36 @@
1
- import { bufferDocumentSnapshot } from "./documentSnapshot.js";
2
1
  import { DocumentSync } from "./documentSync.js";
3
- import { acquireResolvedLanguageServerLane, resolveLanguageServerLaneOptions } from "./lane.js";
4
2
  import { summarizeDiagnostics } from "./diagnostics.js";
3
+ import { acquireResolvedLanguageServerLane, resolveLanguageServerLaneOptions } from "./lane.js";
5
4
  import { PullDiagnosticsController } from "./pullDiagnostics.js";
6
- //#region src/document.ts
5
+ import { bufferDocumentSnapshot } from "./documentSnapshot.js";
6
+ import { languageServerSourceConnection } from "./sourceConnection.js";
7
+ // src/document.ts
7
8
  /** A document's protocol state. Views borrow it; its creator disposes it. */
8
9
  var LanguageServerDocument = class {
9
10
  lanes;
10
11
  syncOptions;
11
- unsubscribe;
12
12
  disposed = false;
13
13
  constructor(source, options) {
14
14
  this.syncOptions = options.documentSync;
15
15
  this.lanes = options.lanes.map((lane) => new DocumentLanguageServerLane(source, lane, options.documentSync));
16
- this.unsubscribe = source.subscribe?.((change) => this.synchronize(change));
17
16
  }
18
- synchronize(change = null, kind = "content") {
17
+ synchronize(kind = "content") {
19
18
  if (this.disposed) return;
20
- for (const lane of this.lanes) lane.synchronize(change, kind);
19
+ for (const lane of this.lanes) lane.synchronize(kind);
21
20
  }
22
21
  dispose() {
23
22
  if (this.disposed) return;
24
23
  this.disposed = true;
25
- this.unsubscribe?.();
26
24
  for (const lane of this.lanes) lane.dispose();
27
25
  }
28
26
  };
29
27
  function createLanguageServerDocument(options) {
30
28
  return new LanguageServerDocument({
31
29
  getSnapshot: () => bufferDocumentSnapshot(options),
32
- subscribe: (listener) => options.buffer.subscribe(({ change }) => listener(change))
30
+ getSourceOwner: () => ({
31
+ buffer: options.buffer,
32
+ documentId: options.documentId ?? options.uri
33
+ })
33
34
  }, {
34
35
  lanes: options.lanes.map((lane) => resolveLanguageServerLaneOptions({
35
36
  ...lane,
@@ -69,15 +70,16 @@ var DocumentLanguageServerLane = class {
69
70
  options.onStatusChange?.(status);
70
71
  }
71
72
  }, {
73
+ beforeReady: () => this.synchronizeSource(),
72
74
  onReady: () => {
73
75
  this.unavailable = false;
74
- this.synchronize();
75
76
  if (!this.pullDiagnostics?.pending) this.pullDiagnostics?.synchronize();
76
77
  this.republishSummary();
77
78
  this.notify();
78
79
  },
79
80
  onReconnecting: () => {
80
81
  this.unavailable = true;
82
+ this.sync.close();
81
83
  this.pullDiagnostics?.cancel();
82
84
  this.sync.clearDiagnostics();
83
85
  this.notify();
@@ -89,6 +91,7 @@ var DocumentLanguageServerLane = class {
89
91
  onUnavailable: () => {
90
92
  this.connectionStatus = "error";
91
93
  this.unavailable = true;
94
+ this.sync.close();
92
95
  this.pullDiagnostics?.cancel();
93
96
  this.sync.clearDiagnostics();
94
97
  this.notify();
@@ -109,7 +112,13 @@ var DocumentLanguageServerLane = class {
109
112
  }, {
110
113
  ...syncOptions,
111
114
  logicalRevisionScope: this.connection.logicalRevisionScope,
112
- onDocumentClosed: () => this.notify()
115
+ getSourceOwner: () => this.source.getSourceOwner(),
116
+ getConnection: () => languageServerSourceConnection(this.connection.client),
117
+ onDocumentClosed: () => this.notify(),
118
+ onDocumentChanged: () => {
119
+ this.pullDiagnostics?.synchronize();
120
+ },
121
+ onError: (error) => options.onError?.(error)
113
122
  });
114
123
  this.pullDiagnostics = options.features.diagnostics === void 0 ? null : new PullDiagnosticsController({
115
124
  client: this.connection.client,
@@ -126,8 +135,7 @@ var DocumentLanguageServerLane = class {
126
135
  });
127
136
  this.registration = syncOptions.controller?.register({
128
137
  getSnapshot: () => source.getSnapshot(),
129
- sync: this.sync,
130
- workspace: this.connection.workspace
138
+ sync: this.sync
131
139
  });
132
140
  this.connection.ready.catch(() => void 0);
133
141
  }
@@ -150,24 +158,31 @@ var DocumentLanguageServerLane = class {
150
158
  this.listeners.delete(onConnectionChange);
151
159
  } };
152
160
  }
153
- synchronize(change = null, kind = "content") {
161
+ synchronize(kind = "content") {
154
162
  if (this.disposed || !this.connection.isReady()) return;
155
163
  const snapshot = this.source.getSnapshot();
156
164
  if (!this.sync.shouldSync(kind, snapshot)) return;
157
- const before = this.sync.activeDocument;
158
- this.sync.sync(snapshot, change);
159
- if (before !== this.sync.activeDocument) this.pullDiagnostics?.synchronize();
165
+ this.sync.sync(snapshot).catch((error) => {
166
+ if (!isCancellation(error)) this.options.onError?.(error);
167
+ });
160
168
  }
161
169
  dispose() {
162
170
  if (this.disposed) return;
163
171
  this.disposed = true;
164
172
  this.registration?.dispose();
165
173
  this.pullDiagnostics?.dispose();
166
- this.sync.close();
174
+ this.sync.dispose();
167
175
  this.connection.release();
168
176
  this.observers.clear();
169
177
  this.listeners.clear();
170
178
  }
179
+ async synchronizeSource() {
180
+ try {
181
+ await this.sync.sync(this.source.getSnapshot());
182
+ } catch (error) {
183
+ if (!isCancellation(error)) throw error;
184
+ }
185
+ }
171
186
  notify() {
172
187
  for (const listener of this.listeners) listener();
173
188
  }
@@ -184,7 +199,9 @@ var DocumentLanguageServerLane = class {
184
199
  this.publishSummary(active.uri, this.diagnosticsVersion, this.sync.diagnostics);
185
200
  }
186
201
  };
187
- //#endregion
202
+ function isCancellation(error) {
203
+ return error instanceof DOMException && error.name === "AbortError";
204
+ }
188
205
  export { DocumentLanguageServerLane, LanguageServerDocument, createLanguageServerDocument };
189
206
 
190
207
  //# sourceMappingURL=document.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","names":[],"sources":["../src/document.ts"],"sourcesContent":["import type { DocumentSessionChange, EditorTextBuffer } from '@singapore-editor/core/document'\nimport type {\n EditorContributionChange,\n EditorDisposable,\n EditorViewContributionUpdateKind,\n} from '@singapore-editor/core/extensions'\nimport type { LspTextDocumentSnapshot } from '@singapore-editor/lsp'\nimport type * as lsp from 'vscode-languageserver-protocol'\nimport { DocumentSync } from './documentSync'\nimport { summarizeDiagnostics } from './diagnostics'\nimport {\n acquireResolvedLanguageServerLane,\n resolveLanguageServerLaneOptions,\n type AcquiredLanguageServerLane,\n type LanguageServerResolvedLaneOptions,\n} from './lane'\nimport { PullDiagnosticsController } from './pullDiagnostics'\nimport type {\n LanguageServerDocumentSnapshot,\n LanguageServerDiagnosticsFreshness,\n LanguageServerDocumentSyncOptions,\n LanguageServerLaneOptions,\n LanguageServerStatus,\n OnApplyWorkspaceEdit,\n} from './types'\nimport { bufferDocumentSnapshot } from './documentSnapshot'\n\n/** A view's share of one lane's diagnostics for the document. */\nexport type DocumentLaneDiagnosticsObserver = {\n clear(): void\n render(document: LspTextDocumentSnapshot, diagnostics: readonly lsp.Diagnostic[]): void\n publishSummary(\n uri: lsp.DocumentUri,\n version: number | null,\n diagnostics: readonly lsp.Diagnostic[],\n freshness: LanguageServerDiagnosticsFreshness,\n ): void\n}\n\ntype DocumentSource = {\n getSnapshot(): LanguageServerDocumentSnapshot\n subscribe?(listener: (change: DocumentSessionChange) => void): () => void\n}\n\nexport type LanguageServerDocumentOptions = {\n readonly buffer: EditorTextBuffer\n readonly uri: string\n readonly languageId: string\n readonly documentId?: string\n readonly lanes: readonly LanguageServerLaneOptions[]\n readonly onApplyWorkspaceEdit?: OnApplyWorkspaceEdit\n readonly controller?: LanguageServerDocumentSyncOptions['controller']\n}\n\n/** A document's protocol state. Views borrow it; its creator disposes it. */\nexport class LanguageServerDocument {\n readonly lanes: readonly DocumentLanguageServerLane[]\n readonly syncOptions: LanguageServerDocumentSyncOptions\n private readonly unsubscribe: (() => void) | undefined\n private disposed = false\n\n constructor(\n source: DocumentSource,\n options: {\n readonly lanes: readonly LanguageServerResolvedLaneOptions[]\n readonly documentSync: LanguageServerDocumentSyncOptions\n },\n ) {\n this.syncOptions = options.documentSync\n this.lanes = options.lanes.map(\n (lane) => new DocumentLanguageServerLane(source, lane, options.documentSync),\n )\n this.unsubscribe = source.subscribe?.((change) => this.synchronize(change))\n }\n\n synchronize(\n change: EditorContributionChange | null = null,\n kind: EditorViewContributionUpdateKind = 'content',\n ): void {\n if (this.disposed) return\n for (const lane of this.lanes) lane.synchronize(change, kind)\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n this.unsubscribe?.()\n for (const lane of this.lanes) lane.dispose()\n }\n}\n\nexport function createLanguageServerDocument(\n options: LanguageServerDocumentOptions,\n): LanguageServerDocument {\n return new LanguageServerDocument(\n {\n getSnapshot: () => bufferDocumentSnapshot(options),\n subscribe: (listener) => options.buffer.subscribe(({ change }) => listener(change)),\n },\n {\n lanes: options.lanes.map((lane) =>\n resolveLanguageServerLaneOptions({\n ...lane,\n onApplyWorkspaceEdit: options.onApplyWorkspaceEdit ?? lane.onApplyWorkspaceEdit,\n }),\n ),\n documentSync: {\n controller: options.controller,\n uriForDocument: () => options.uri,\n },\n },\n )\n}\n\nexport class DocumentLanguageServerLane {\n private connectionStatus: LanguageServerStatus = 'idle'\n\n get status(): LanguageServerStatus {\n return this.connectionStatus\n }\n readonly connection: AcquiredLanguageServerLane\n readonly sync: DocumentSync\n private readonly pullDiagnostics: PullDiagnosticsController | null\n private readonly registration: EditorDisposable | undefined\n private readonly observers = new Set<DocumentLaneDiagnosticsObserver>()\n /** Whether the server has answered for the active document since it became active. */\n private diagnosticsReceived = false\n private diagnosticsVersion: number | null = null\n private unavailable = false\n private readonly listeners = new Set<() => void>()\n private disposed = false\n\n constructor(\n private readonly source: DocumentSource,\n readonly options: LanguageServerResolvedLaneOptions,\n syncOptions: LanguageServerDocumentSyncOptions,\n ) {\n this.connection = acquireResolvedLanguageServerLane(\n {\n ...options,\n onStatusChange: (status) => {\n this.connectionStatus = status\n options.onStatusChange?.(status)\n },\n },\n {\n onReady: () => {\n this.unavailable = false\n this.synchronize()\n // After a reconnect the document is the same one; only a new request can refresh it.\n if (!this.pullDiagnostics?.pending) this.pullDiagnostics?.synchronize()\n this.republishSummary()\n this.notify()\n },\n onReconnecting: () => {\n this.unavailable = true\n this.pullDiagnostics?.cancel()\n this.sync.clearDiagnostics()\n this.notify()\n },\n onDiagnosticRefresh: () => this.pullDiagnostics?.refresh(),\n onPublishDiagnostics: (params) => {\n if (options.features.diagnostics !== undefined) this.sync.publishDiagnostics(params)\n },\n onUnavailable: () => {\n this.connectionStatus = 'error'\n this.unavailable = true\n this.pullDiagnostics?.cancel()\n this.sync.clearDiagnostics()\n this.notify()\n },\n },\n )\n this.sync = new DocumentSync(\n this.connection.workspace,\n {\n clear: () => {\n for (const observer of this.observers) observer.clear()\n },\n render: (document, diagnostics) => {\n for (const observer of this.observers) observer.render(document, diagnostics)\n },\n publishSummary: (uri, version, diagnostics, kind) => {\n this.diagnosticsReceived = kind === 'result'\n this.diagnosticsVersion = version\n this.publishSummary(uri, version, diagnostics)\n },\n },\n {\n ...syncOptions,\n logicalRevisionScope: this.connection.logicalRevisionScope,\n onDocumentClosed: () => this.notify(),\n },\n )\n this.pullDiagnostics =\n options.features.diagnostics === undefined\n ? null\n : new PullDiagnosticsController({\n client: this.connection.client,\n getDocument: () => {\n const active = this.sync.activeDocument\n return active ? { uri: active.uri, version: active.lspVersion } : null\n },\n publish: (document, items) =>\n this.sync.pullDiagnostics(document.uri, document.version, items),\n onRequestError: (error) => options.onRequestError?.('textDocument/diagnostic', error),\n onPendingChange: () => this.republishSummary(),\n })\n this.registration = syncOptions.controller?.register({\n getSnapshot: () => source.getSnapshot(),\n sync: this.sync,\n workspace: this.connection.workspace,\n })\n void this.connection.ready.catch(() => undefined)\n }\n\n /** How far the active document's diagnostics can be trusted. */\n get diagnosticsFreshness(): LanguageServerDiagnosticsFreshness {\n if (this.unavailable) return 'unavailable'\n if (this.pullDiagnostics?.pending) return this.diagnosticsReceived ? 'refreshing' : 'awaiting'\n return this.diagnosticsReceived ? 'current' : 'silent'\n }\n\n attach(\n presenter: DocumentLaneDiagnosticsObserver,\n onConnectionChange: () => void,\n ): EditorDisposable {\n this.observers.add(presenter)\n this.listeners.add(onConnectionChange)\n const active = this.sync.activeDocument\n if (active) {\n presenter.render(active, this.sync.diagnostics)\n presenter.publishSummary(\n active.uri,\n this.diagnosticsVersion,\n this.sync.diagnostics,\n this.diagnosticsFreshness,\n )\n }\n return {\n dispose: () => {\n this.observers.delete(presenter)\n this.listeners.delete(onConnectionChange)\n },\n }\n }\n\n synchronize(\n change: EditorContributionChange | null = null,\n kind: EditorViewContributionUpdateKind = 'content',\n ): void {\n if (this.disposed || !this.connection.isReady()) return\n const snapshot = this.source.getSnapshot()\n if (!this.sync.shouldSync(kind, snapshot)) return\n const before = this.sync.activeDocument\n this.sync.sync(snapshot, change)\n if (before !== this.sync.activeDocument) this.pullDiagnostics?.synchronize()\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n this.registration?.dispose()\n this.pullDiagnostics?.dispose()\n this.sync.close()\n this.connection.release()\n this.observers.clear()\n this.listeners.clear()\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener()\n }\n\n private publishSummary(\n uri: lsp.DocumentUri,\n version: number | null,\n diagnostics: readonly lsp.Diagnostic[],\n ): void {\n if (this.disposed) return\n const freshness = this.diagnosticsFreshness\n this.options.onDiagnostics?.(summarizeDiagnostics(uri, version, diagnostics, freshness))\n for (const observer of this.observers)\n observer.publishSummary(uri, version, diagnostics, freshness)\n }\n\n /** The diagnostics did not change, but how far they can be trusted did. */\n private republishSummary(): void {\n const active = this.sync?.activeDocument\n if (!active) return\n this.publishSummary(active.uri, this.diagnosticsVersion, this.sync.diagnostics)\n }\n}\n"],"mappings":";;;;;;;AAuDA,IAAa,yBAAb,MAAoC;CAClC;CACA;CACA;CACA,WAAmB;CAEnB,YACE,QACA,SAIA;EACA,KAAK,cAAc,QAAQ;EAC3B,KAAK,QAAQ,QAAQ,MAAM,KACxB,SAAS,IAAI,2BAA2B,QAAQ,MAAM,QAAQ,YAAY,CAC7E;EACA,KAAK,cAAc,OAAO,aAAa,WAAW,KAAK,YAAY,MAAM,CAAC;CAC5E;CAEA,YACE,SAA0C,MAC1C,OAAyC,WACnC;EACN,IAAI,KAAK,UAAU;EACnB,KAAK,MAAM,QAAQ,KAAK,OAAO,KAAK,YAAY,QAAQ,IAAI;CAC9D;CAEA,UAAgB;EACd,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,KAAK,cAAc;EACnB,KAAK,MAAM,QAAQ,KAAK,OAAO,KAAK,QAAQ;CAC9C;AACF;AAEA,SAAgB,6BACd,SACwB;CACxB,OAAO,IAAI,uBACT;EACE,mBAAmB,uBAAuB,OAAO;EACjD,YAAY,aAAa,QAAQ,OAAO,WAAW,EAAE,aAAa,SAAS,MAAM,CAAC;CACpF,GACA;EACE,OAAO,QAAQ,MAAM,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F;EACA,OAAO,EACL,eAAe;GACb,KAAK,UAAU,OAAO,SAAS;GAC/B,KAAK,UAAU,OAAO,kBAAkB;EAC1C,EACF;CACF;CAEA,YACE,SAA0C,MAC1C,OAAyC,WACnC;EACN,IAAI,KAAK,YAAY,CAAC,KAAK,WAAW,QAAQ,GAAG;EACjD,MAAM,WAAW,KAAK,OAAO,YAAY;EACzC,IAAI,CAAC,KAAK,KAAK,WAAW,MAAM,QAAQ,GAAG;EAC3C,MAAM,SAAS,KAAK,KAAK;EACzB,KAAK,KAAK,KAAK,UAAU,MAAM;EAC/B,IAAI,WAAW,KAAK,KAAK,gBAAgB,KAAK,iBAAiB,YAAY;CAC7E;CAEA,UAAgB;EACd,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,KAAK,cAAc,QAAQ;EAC3B,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,KAAK,MAAM;EAChB,KAAK,WAAW,QAAQ;EACxB,KAAK,UAAU,MAAM;EACrB,KAAK,UAAU,MAAM;CACvB;CAEA,SAAuB;EACrB,KAAK,MAAM,YAAY,KAAK,WAAW,SAAS;CAClD;CAEA,eACE,KACA,SACA,aACM;EACN,IAAI,KAAK,UAAU;EACnB,MAAM,YAAY,KAAK;EACvB,KAAK,QAAQ,gBAAgB,qBAAqB,KAAK,SAAS,aAAa,SAAS,CAAC;EACvF,KAAK,MAAM,YAAY,KAAK,WAC1B,SAAS,eAAe,KAAK,SAAS,aAAa,SAAS;CAChE;;CAGA,mBAAiC;EAC/B,MAAM,SAAS,KAAK,MAAM;EAC1B,IAAI,CAAC,QAAQ;EACb,KAAK,eAAe,OAAO,KAAK,KAAK,oBAAoB,KAAK,KAAK,WAAW;CAChF;AACF"}
1
+ {"version":3,"file":"document.js","names":[],"sources":["../src/document.ts"],"sourcesContent":["import type { EditorTextBuffer } from '@singapore-editor/core/document'\nimport type {\n EditorDisposable,\n EditorViewContributionUpdateKind,\n} from '@singapore-editor/core/extensions'\nimport type { LspTextDocumentSnapshot } from '@singapore-editor/lsp'\nimport type * as lsp from 'vscode-languageserver-protocol'\nimport { DocumentSync } from './documentSync'\nimport { summarizeDiagnostics } from './diagnostics'\nimport {\n acquireResolvedLanguageServerLane,\n resolveLanguageServerLaneOptions,\n type AcquiredLanguageServerLane,\n type LanguageServerResolvedLaneOptions,\n} from './lane'\nimport { PullDiagnosticsController } from './pullDiagnostics'\nimport type {\n LanguageServerDocumentSnapshot,\n LanguageServerDiagnosticsFreshness,\n LanguageServerDocumentSyncOptions,\n LanguageServerLaneOptions,\n LanguageServerStatus,\n OnApplyWorkspaceEdit,\n} from './types'\nimport { bufferDocumentSnapshot } from './documentSnapshot'\nimport type { LanguageServerSourceOwner } from './retainedSource'\nimport { languageServerSourceConnection } from './sourceConnection'\n\n/** A view's share of one lane's diagnostics for the document. */\nexport type DocumentLaneDiagnosticsObserver = {\n clear(): void\n render(document: LspTextDocumentSnapshot, diagnostics: readonly lsp.Diagnostic[]): void\n publishSummary(\n uri: lsp.DocumentUri,\n version: number | null,\n diagnostics: readonly lsp.Diagnostic[],\n freshness: LanguageServerDiagnosticsFreshness,\n ): void\n}\n\ntype DocumentSource = {\n getSnapshot(): LanguageServerDocumentSnapshot\n getSourceOwner(): LanguageServerSourceOwner | null\n}\n\nexport type LanguageServerDocumentOptions = {\n readonly buffer: EditorTextBuffer\n readonly uri: string\n readonly languageId: string\n readonly documentId?: string\n readonly lanes: readonly LanguageServerLaneOptions[]\n readonly onApplyWorkspaceEdit?: OnApplyWorkspaceEdit\n readonly controller?: LanguageServerDocumentSyncOptions['controller']\n}\n\n/** A document's protocol state. Views borrow it; its creator disposes it. */\nexport class LanguageServerDocument {\n readonly lanes: readonly DocumentLanguageServerLane[]\n readonly syncOptions: LanguageServerDocumentSyncOptions\n private disposed = false\n\n constructor(\n source: DocumentSource,\n options: {\n readonly lanes: readonly LanguageServerResolvedLaneOptions[]\n readonly documentSync: LanguageServerDocumentSyncOptions\n },\n ) {\n this.syncOptions = options.documentSync\n this.lanes = options.lanes.map(\n (lane) => new DocumentLanguageServerLane(source, lane, options.documentSync),\n )\n }\n\n synchronize(kind: EditorViewContributionUpdateKind = 'content'): void {\n if (this.disposed) return\n for (const lane of this.lanes) lane.synchronize(kind)\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n for (const lane of this.lanes) lane.dispose()\n }\n}\n\nexport function createLanguageServerDocument(\n options: LanguageServerDocumentOptions,\n): LanguageServerDocument {\n return new LanguageServerDocument(\n {\n getSnapshot: () => bufferDocumentSnapshot(options),\n getSourceOwner: () => ({\n buffer: options.buffer,\n documentId: options.documentId ?? options.uri,\n }),\n },\n {\n lanes: options.lanes.map((lane) =>\n resolveLanguageServerLaneOptions({\n ...lane,\n onApplyWorkspaceEdit: options.onApplyWorkspaceEdit ?? lane.onApplyWorkspaceEdit,\n }),\n ),\n documentSync: {\n controller: options.controller,\n uriForDocument: () => options.uri,\n },\n },\n )\n}\n\nexport class DocumentLanguageServerLane {\n private connectionStatus: LanguageServerStatus = 'idle'\n\n get status(): LanguageServerStatus {\n return this.connectionStatus\n }\n readonly connection: AcquiredLanguageServerLane\n readonly sync: DocumentSync\n private readonly pullDiagnostics: PullDiagnosticsController | null\n private readonly registration: EditorDisposable | undefined\n private readonly observers = new Set<DocumentLaneDiagnosticsObserver>()\n /** Whether the server has answered for the active document since it became active. */\n private diagnosticsReceived = false\n private diagnosticsVersion: number | null = null\n private unavailable = false\n private readonly listeners = new Set<() => void>()\n private disposed = false\n\n constructor(\n private readonly source: DocumentSource,\n readonly options: LanguageServerResolvedLaneOptions,\n syncOptions: LanguageServerDocumentSyncOptions,\n ) {\n this.connection = acquireResolvedLanguageServerLane(\n {\n ...options,\n onStatusChange: (status) => {\n this.connectionStatus = status\n options.onStatusChange?.(status)\n },\n },\n {\n beforeReady: () => this.synchronizeSource(),\n onReady: () => {\n this.unavailable = false\n // After a reconnect the document is the same one; only a new request can refresh it.\n if (!this.pullDiagnostics?.pending) this.pullDiagnostics?.synchronize()\n this.republishSummary()\n this.notify()\n },\n onReconnecting: () => {\n this.unavailable = true\n this.sync.close()\n this.pullDiagnostics?.cancel()\n this.sync.clearDiagnostics()\n this.notify()\n },\n onDiagnosticRefresh: () => this.pullDiagnostics?.refresh(),\n onPublishDiagnostics: (params) => {\n if (options.features.diagnostics !== undefined) this.sync.publishDiagnostics(params)\n },\n onUnavailable: () => {\n this.connectionStatus = 'error'\n this.unavailable = true\n this.sync.close()\n this.pullDiagnostics?.cancel()\n this.sync.clearDiagnostics()\n this.notify()\n },\n },\n )\n this.sync = new DocumentSync(\n this.connection.workspace,\n {\n clear: () => {\n for (const observer of this.observers) observer.clear()\n },\n render: (document, diagnostics) => {\n for (const observer of this.observers) observer.render(document, diagnostics)\n },\n publishSummary: (uri, version, diagnostics, kind) => {\n this.diagnosticsReceived = kind === 'result'\n this.diagnosticsVersion = version\n this.publishSummary(uri, version, diagnostics)\n },\n },\n {\n ...syncOptions,\n logicalRevisionScope: this.connection.logicalRevisionScope,\n getSourceOwner: () => this.source.getSourceOwner(),\n getConnection: () => languageServerSourceConnection(this.connection.client),\n onDocumentClosed: () => this.notify(),\n onDocumentChanged: () => {\n this.pullDiagnostics?.synchronize()\n },\n onError: (error) => options.onError?.(error),\n },\n )\n this.pullDiagnostics =\n options.features.diagnostics === undefined\n ? null\n : new PullDiagnosticsController({\n client: this.connection.client,\n getDocument: () => {\n const active = this.sync.activeDocument\n return active ? { uri: active.uri, version: active.lspVersion } : null\n },\n publish: (document, items) =>\n this.sync.pullDiagnostics(document.uri, document.version, items),\n onRequestError: (error) => options.onRequestError?.('textDocument/diagnostic', error),\n onPendingChange: () => this.republishSummary(),\n })\n this.registration = syncOptions.controller?.register({\n getSnapshot: () => source.getSnapshot(),\n sync: this.sync,\n })\n void this.connection.ready.catch(() => undefined)\n }\n\n /** How far the active document's diagnostics can be trusted. */\n get diagnosticsFreshness(): LanguageServerDiagnosticsFreshness {\n if (this.unavailable) return 'unavailable'\n if (this.pullDiagnostics?.pending) return this.diagnosticsReceived ? 'refreshing' : 'awaiting'\n return this.diagnosticsReceived ? 'current' : 'silent'\n }\n\n attach(\n presenter: DocumentLaneDiagnosticsObserver,\n onConnectionChange: () => void,\n ): EditorDisposable {\n this.observers.add(presenter)\n this.listeners.add(onConnectionChange)\n const active = this.sync.activeDocument\n if (active) {\n presenter.render(active, this.sync.diagnostics)\n presenter.publishSummary(\n active.uri,\n this.diagnosticsVersion,\n this.sync.diagnostics,\n this.diagnosticsFreshness,\n )\n }\n return {\n dispose: () => {\n this.observers.delete(presenter)\n this.listeners.delete(onConnectionChange)\n },\n }\n }\n\n synchronize(kind: EditorViewContributionUpdateKind = 'content'): void {\n if (this.disposed || !this.connection.isReady()) return\n const snapshot = this.source.getSnapshot()\n if (!this.sync.shouldSync(kind, snapshot)) return\n void this.sync.sync(snapshot).catch((error) => {\n if (!isCancellation(error)) this.options.onError?.(error)\n })\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n this.registration?.dispose()\n this.pullDiagnostics?.dispose()\n this.sync.dispose()\n this.connection.release()\n this.observers.clear()\n this.listeners.clear()\n }\n\n private async synchronizeSource(): Promise<void> {\n try {\n await this.sync.sync(this.source.getSnapshot())\n } catch (error) {\n if (!isCancellation(error)) throw error\n }\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener()\n }\n\n private publishSummary(\n uri: lsp.DocumentUri,\n version: number | null,\n diagnostics: readonly lsp.Diagnostic[],\n ): void {\n if (this.disposed) return\n const freshness = this.diagnosticsFreshness\n this.options.onDiagnostics?.(summarizeDiagnostics(uri, version, diagnostics, freshness))\n for (const observer of this.observers)\n observer.publishSummary(uri, version, diagnostics, freshness)\n }\n\n /** The diagnostics did not change, but how far they can be trusted did. */\n private republishSummary(): void {\n const active = this.sync?.activeDocument\n if (!active) return\n this.publishSummary(active.uri, this.diagnosticsVersion, this.sync.diagnostics)\n }\n}\n\nfunction isCancellation(error: unknown): boolean {\n return error instanceof DOMException && error.name === 'AbortError'\n}\n"],"mappings":";;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AAgB;EACd,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,KAAK,cAAc,QAAQ;EAC3B,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,KAAK,QAAQ;EAClB,KAAK,WAAW,QAAQ;EACxB,KAAK,UAAU,MAAM;EACrB,KAAK,UAAU,MAAM;CACvB;CAEA,MAAc,oBAAmC;EAC/C,IAAI;GACF,MAAM,KAAK,KAAK,KAAK,KAAK,OAAO,YAAY,CAAC;EAChD,SAAS,OAAO;GACd,IAAI,CAAC,eAAe,KAAK,GAAG,MAAM;EACpC;CACF;CAEA,SAAuB;EACrB,KAAK,MAAM,YAAY,KAAK,WAAW,SAAS;CAClD;CAEA,eACE,KACA,SACA,aACM;EACN,IAAI,KAAK,UAAU;EACnB,MAAM,YAAY,KAAK;EACvB,KAAK,QAAQ,gBAAgB,qBAAqB,KAAK,SAAS,aAAa,SAAS,CAAC;EACvF,KAAK,MAAM,YAAY,KAAK,WAC1B,SAAS,eAAe,KAAK,SAAS,aAAa,SAAS;CAChE;;CAGA,mBAAiC;EAC/B,MAAM,SAAS,KAAK,MAAM;EAC1B,IAAI,CAAC,QAAQ;EACb,KAAK,eAAe,OAAO,KAAK,KAAK,oBAAoB,KAAK,KAAK,WAAW;CAChF;AACF;AAEA,SAAS,eAAe,OAAyB;CAC/C,OAAO,iBAAiB,gBAAgB,MAAM,SAAS;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"documentHighlightController.d.ts","sourceRoot":"","sources":["../src/documentHighlightController.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gCAAgC,EAChC,kBAAkB,EACnB,MAAM,wBAAwB,CAAA;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAK9D,MAAM,MAAM,kCAAkC,GAAG;IAC/C,QAAQ,CAAC,OAAO,EAAE,6BAA6B,C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Ac,GAAG,IAAI,CAAA;IACvD,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAClD,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,2BAA2B;IAOnB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN3C,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,SAAS,CAAI;IACrB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,QAAQ,CAAQ;IAExB,YAAoC,OAAO,EAAE,kCAAkC,EAAI;IAE5E,MAAM,CAAC,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,gCAAgC,GAAG,IAAI,CAexF;IAEM,OAAO,IAAI,IAAI,CAKrB;IAED,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,MAAM;YAOA,OAAO;IA+BrB,OAAO,CAAC,KAAK;IAiBb,OAAO,CAAC,KAAK;CAOd"}
@@ -1,5 +1,5 @@
1
1
  import { lspPositionToOffsetInSnapshot, offsetToLspPositionInSnapshot } from "@singapore-editor/lsp";
2
- //#region src/documentHighlightController.ts
2
+ // src/documentHighlightController.ts
3
3
  /** Matches the hover debounce: both answer "what is under the caret", and should feel alike. */
4
4
  var DOCUMENT_HIGHLIGHT_DEBOUNCE_MS = 150;
5
5
  /**
@@ -95,7 +95,6 @@ var DocumentHighlightController = class {
95
95
  this.options.context.clearRangeHighlight(this.options.highlightName);
96
96
  }
97
97
  };
98
- //#endregion
99
98
  export { DocumentHighlightController };
100
99
 
101
100
  //# sourceMappingURL=documentHighlightController.js.map
@@ -1,9 +1,10 @@
1
- import type { EditorTextBuffer } from '@singapore-editor/core/document';
1
+ import type { EditorTextBuffer, EditorTextBufferChange } from '@singapore-editor/core/document';
2
2
  import type { LanguageServerDocumentSnapshot } from './types';
3
- export declare function bufferDocumentSnapshot({ buffer, documentId, uri, languageId, }: {
3
+ export declare function bufferDocumentSnapshot({ buffer, documentId, uri, languageId, publication, }: {
4
4
  readonly buffer: EditorTextBuffer;
5
5
  readonly documentId?: string;
6
6
  readonly uri: string;
7
7
  readonly languageId: string;
8
+ readonly publication?: EditorTextBufferChange;
8
9
  }): LanguageServerDocumentSnapshot;
9
10
  //# sourceMappingURL=documentSnapshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"documentSnapshot.d.ts","sourceRoot":"","sources":["../src/documentSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAE7D,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,UAAU,EACV,GAAG,EACH,UAAU,GACX,EAAE;IACD,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B,GAAG,8BAA8B,CA4BjC"}
1
+ {"version":3,"file":"documentSnapshot.d.ts","sourceRoot":"","sources":["../src/documentSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAC/F,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAE7D,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,UAAU,EACV,GAAG,EACH,UAAU,EACV,WAAW,GACZ,EAAE;IACD,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,sBAAsB,CAAA;CAC9C,GAAG,8BAA8B,CA8BjC"}
@@ -1,7 +1,7 @@
1
- //#region src/documentSnapshot.ts
2
- function bufferDocumentSnapshot({ buffer, documentId, uri, languageId }) {
3
- const textSnapshot = buffer.getTextSnapshot();
4
- const point = buffer.getDocumentSyncPoint();
1
+ // src/documentSnapshot.ts
2
+ function bufferDocumentSnapshot({ buffer, documentId, uri, languageId, publication }) {
3
+ const textSnapshot = publication?.change.textSnapshot ?? buffer.getTextSnapshot();
4
+ const point = publication?.syncPointAfter ?? buffer.getDocumentSyncPoint();
5
5
  const lineStartsView = {
6
6
  length: textSnapshot.lineCount,
7
7
  at: (index) => index < 0 || index >= textSnapshot.lineCount ? void 0 : textSnapshot.lineStart(index),
@@ -18,14 +18,13 @@ function bufferDocumentSnapshot({ buffer, documentId, uri, languageId }) {
18
18
  textSnapshot,
19
19
  textVersion: point.textVersion,
20
20
  documentSyncPoint: point,
21
- changesSinceDocumentSyncPoint: (previous, scope) => buffer.changesSinceDocumentSyncPoint(previous, scope),
21
+ changesSinceDocumentSyncPoint: (previous, scope) => publication ? publication.changesSinceDocumentSyncPoint(previous, scope) : buffer.changesSinceDocumentSyncPoint(previous, scope),
22
22
  lineStartsView,
23
23
  get lineStarts() {
24
24
  return lineStartsView.toArray();
25
25
  }
26
26
  };
27
27
  }
28
- //#endregion
29
28
  export { bufferDocumentSnapshot };
30
29
 
31
30
  //# sourceMappingURL=documentSnapshot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"documentSnapshot.js","names":[],"sources":["../src/documentSnapshot.ts"],"sourcesContent":["import type { EditorTextBuffer } from '@singapore-editor/core/document'\nimport type { LanguageServerDocumentSnapshot } from './types'\n\nexport function bufferDocumentSnapshot({\n buffer,\n documentId,\n uri,\n languageId,\n}: {\n readonly buffer: EditorTextBuffer\n readonly documentId?: string\n readonly uri: string\n readonly languageId: string\n}): LanguageServerDocumentSnapshot {\n const textSnapshot = buffer.getTextSnapshot()\n const point = buffer.getDocumentSyncPoint()\n const lineStartsView = {\n length: textSnapshot.lineCount,\n at: (index: number) =>\n index < 0 || index >= textSnapshot.lineCount ? undefined : textSnapshot.lineStart(index),\n indexForOffset: (offset: number) => textSnapshot.lineAt(offset),\n firstIndexAtOrAfter: (offset: number) => {\n const index = textSnapshot.lineAt(offset)\n return textSnapshot.lineStart(index) < offset ? index + 1 : index\n },\n toArray: () =>\n Array.from({ length: textSnapshot.lineCount }, (_, index) => textSnapshot.lineStart(index)),\n }\n return {\n documentId: documentId ?? uri,\n languageId,\n textSnapshot,\n textVersion: point.textVersion,\n documentSyncPoint: point,\n changesSinceDocumentSyncPoint: (previous, scope) =>\n buffer.changesSinceDocumentSyncPoint(previous, scope),\n lineStartsView,\n get lineStarts() {\n return lineStartsView.toArray()\n },\n }\n}\n"],"mappings":";AAGA,SAAgB,uBAAuB,EACrC,QACA,YACA,KACA,cAMiC;CACjC,MAAM,eAAe,OAAO,gBAAgB;CAC5C,MAAM,QAAQ,OAAO,qBAAqB;CAC1C,MAAM,iBAAiB;EACrB,QAAQ,aAAa;EACrB,KAAK,UACH,QAAQ,KAAK,SAAS,aAAa,YAAY,KAAA,IAAY,aAAa,UAAU,KAAK;EACzF,iBAAiB,WAAmB,aAAa,OAAO,MAAM;EAC9D,sBAAsB,WAAmB;GACvC,MAAM,QAAQ,aAAa,OAAO,MAAM;GACxC,OAAO,aAAa,UAAU,KAAK,IAAI,SAAS,QAAQ,IAAI;EAC9D;EACA,eACE,MAAM,KAAK,EAAE,QAAQ,aAAa,UAAU,IAAI,GAAG,UAAU,aAAa,UAAU,KAAK,CAAC;CAC9F;CACA,OAAO;EACL,YAAY,cAAc;EAC1B;EACA;EACA,aAAa,MAAM;EACnB,mBAAmB;EACnB,gCAAgC,UAAU,UACxC,OAAO,8BAA8B,UAAU,KAAK;EACtD;EACA,IAAI,aAAa;GACf,OAAO,eAAe,QAAQ;EAChC;CACF;AACF"}
1
+ {"version":3,"file":"documentSnapshot.js","names":[],"sources":["../src/documentSnapshot.ts"],"sourcesContent":["import type { EditorTextBuffer, EditorTextBufferChange } from '@singapore-editor/core/document'\nimport type { LanguageServerDocumentSnapshot } from './types'\n\nexport function bufferDocumentSnapshot({\n buffer,\n documentId,\n uri,\n languageId,\n publication,\n}: {\n readonly buffer: EditorTextBuffer\n readonly documentId?: string\n readonly uri: string\n readonly languageId: string\n readonly publication?: EditorTextBufferChange\n}): LanguageServerDocumentSnapshot {\n const textSnapshot = publication?.change.textSnapshot ?? buffer.getTextSnapshot()\n const point = publication?.syncPointAfter ?? buffer.getDocumentSyncPoint()\n const lineStartsView = {\n length: textSnapshot.lineCount,\n at: (index: number) =>\n index < 0 || index >= textSnapshot.lineCount ? undefined : textSnapshot.lineStart(index),\n indexForOffset: (offset: number) => textSnapshot.lineAt(offset),\n firstIndexAtOrAfter: (offset: number) => {\n const index = textSnapshot.lineAt(offset)\n return textSnapshot.lineStart(index) < offset ? index + 1 : index\n },\n toArray: () =>\n Array.from({ length: textSnapshot.lineCount }, (_, index) => textSnapshot.lineStart(index)),\n }\n return {\n documentId: documentId ?? uri,\n languageId,\n textSnapshot,\n textVersion: point.textVersion,\n documentSyncPoint: point,\n changesSinceDocumentSyncPoint: (previous, scope) =>\n publication\n ? publication.changesSinceDocumentSyncPoint(previous, scope)\n : buffer.changesSinceDocumentSyncPoint(previous, scope),\n lineStartsView,\n get lineStarts() {\n return lineStartsView.toArray()\n },\n }\n}\n"],"mappings":";AAGA,SAAgB,uBAAuB,EACrC,QACA,YACA,KACA,YACA,eAOiC;CACjC,MAAM,eAAe,aAAa,OAAO,gBAAgB,OAAO,gBAAgB;CAChF,MAAM,QAAQ,aAAa,kBAAkB,OAAO,qBAAqB;CACzE,MAAM,iBAAiB;EACrB,QAAQ,aAAa;EACrB,KAAK,UACH,QAAQ,KAAK,SAAS,aAAa,YAAY,KAAA,IAAY,aAAa,UAAU,KAAK;EACzF,iBAAiB,WAAmB,aAAa,OAAO,MAAM;EAC9D,sBAAsB,WAAmB;GACvC,MAAM,QAAQ,aAAa,OAAO,MAAM;GACxC,OAAO,aAAa,UAAU,KAAK,IAAI,SAAS,QAAQ,IAAI;EAC9D;EACA,eACE,MAAM,KAAK,EAAE,QAAQ,aAAa,UAAU,IAAI,GAAG,UAAU,aAAa,UAAU,KAAK,CAAC;CAC9F;CACA,OAAO;EACL,YAAY,cAAc;EAC1B;EACA;EACA,aAAa,MAAM;EACnB,mBAAmB;EACnB,gCAAgC,UAAU,UACxC,cACI,YAAY,8BAA8B,UAAU,KAAK,IACzD,OAAO,8BAA8B,UAAU,KAAK;EAC1D;EACA,IAAI,aAAa;GACf,OAAO,eAAe,QAAQ;EAChC;CACF;AACF"}
@@ -1,12 +1,11 @@
1
- import type { LanguageServerDocumentSnapshot } from './types';
2
- import { type DocumentLogicalRevisionScope } from '@singapore-editor/core/document';
3
- import type { EditorContributionChange, EditorViewContributionUpdateKind } from '@singapore-editor/core/extensions';
4
- import { type LspTextDocumentSnapshot, type LspWorkspace } from '@singapore-editor/lsp';
1
+ import type { LanguageServerDocumentSnapshot, LanguageServerDocumentSyncOptions } from './types';
2
+ import type { DocumentLogicalRevisionScope } from '@singapore-editor/core/document';
3
+ import type { EditorViewContributionUpdateKind } from '@singapore-editor/core/extensions';
4
+ import type { LspTextDocumentSnapshot, LspWorkspace } from '@singapore-editor/lsp';
5
5
  import type * as lsp from 'vscode-languageserver-protocol';
6
6
  import type { LanguageServerDocumentUriTransition } from './documentSyncController';
7
7
  import type { ActiveDocument } from './pluginTypes';
8
- import type { LanguageServerDocumentSyncOptions } from './types';
9
- /** `result` came from the server; `reset` is the client emptying the list itself. */
8
+ import { type LanguageServerSourceConnection, type LanguageServerSourceOwner } from './retainedSource';
10
9
  export type DocumentSyncSummaryKind = 'result' | 'reset';
11
10
  export type DocumentSyncDiagnosticsPresenter = {
12
11
  clear(): void;
@@ -15,39 +14,38 @@ export type DocumentSyncDiagnosticsPresenter = {
15
14
  };
16
15
  export type DocumentSyncOptions = LanguageServerDocumentSyncOptions & {
17
16
  readonly logicalRevisionScope: DocumentLogicalRevisionScope;
17
+ getSourceOwner(): LanguageServerSourceOwner | null;
18
+ getConnection(): LanguageServerSourceConnection | null;
18
19
  onDocumentClosed(): void;
20
+ onDocumentChanged(): void;
21
+ onError(error: unknown): void;
19
22
  };
20
23
  export declare class DocumentSync {
21
24
  private readonly workspace;
22
25
  private readonly presenter;
23
26
  private readonly options;
24
- private attachment;
27
+ private binding;
25
28
  private document;
26
29
  private diagnosticItems;
27
- private readonly logicalRevisionScope;
28
30
  private pendingUriProjection;
29
- private syncPoint;
31
+ private readonly unsubscribe;
30
32
  constructor(workspace: LspWorkspace, presenter: DocumentSyncDiagnosticsPresenter, options: DocumentSyncOptions);
31
33
  get activeDocument(): ActiveDocument | null;
32
34
  get diagnostics(): readonly lsp.Diagnostic[];
33
35
  shouldSync(kind: EditorViewContributionUpdateKind, snapshot: LanguageServerDocumentSnapshot): boolean;
34
- sync(snapshot: LanguageServerDocumentSnapshot, change: EditorContributionChange | null): void;
36
+ sync(snapshot: LanguageServerDocumentSnapshot): Promise<void>;
35
37
  close(): void;
38
+ dispose(): void;
36
39
  transitionDocumentUri(snapshot: LanguageServerDocumentSnapshot, transition: LanguageServerDocumentUriTransition): boolean;
37
- private detachDocument;
38
- private matchesTransitionSource;
39
- private projectedDocumentUri;
40
40
  publishDiagnostics(params: unknown): void;
41
41
  pullDiagnostics(uri: lsp.DocumentUri, version: number, diagnostics: readonly lsp.Diagnostic[]): void;
42
42
  clearDiagnostics(): void;
43
- private openOrUpdateDocument;
43
+ private descriptor;
44
+ private bind;
45
+ private detach;
46
+ private clearDocument;
47
+ private readonly adoptPublication;
44
48
  private replaceDiagnostics;
45
- private openDocument;
46
- private replaceOrTransitionDocument;
47
- private transitionDocument;
48
- private updateDocument;
49
- private synchronizeWorkspaceDocument;
50
- private adoptDocumentTransition;
51
49
  }
52
50
  export declare function activeDocumentForSnapshot(snapshot: LanguageServerDocumentSnapshot, options: LanguageServerDocumentSyncOptions): ActiveDocument | null;
53
51
  //# sourceMappingURL=documentSync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"documentSync.d.ts","sourceRoot":"","sources":["../src/documentSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAC7D,OAAO,EACL,KAAK,4BAA4B,EAIlC,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EACV,wBAAwB,EACxB,gCAAgC,EACjC,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAGL,KAAK,uBAAuB,EAG5B,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,KAAK,GAAG,MAAM,gCAAgC,CAAA;AAG1D,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAA;AAEnF,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,eAAe,CAAA;AACvE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAA;AAGhE,qFAAqF;AACrF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAExD,MAAM,MAAM,gCAAgC,GAAG;IAC7C,KAAK,IAAI,IAAI,CAAA;IACb,MAAM,CAAC,QAAQ,EAAE,uBAAuB,EAAE,WAAW,EAAE,SAAS,GAAG,CAAC,UAAU,EAAE,GAAG,IAAI,CAAA;IACvF,cAAc,CACZ,GAAG,EAAE,GAAG,CAAC,WAAW,EACpB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,WAAW,EAAE,SAAS,GAAG,CAAC,UAAU,EAAE,EACtC,IAAI,EAAE,uBAAuB,GAC5B,IAAI,CAAA;CACR,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,iCAAiC,GAAG;IACpE,QAAQ,CAAC,oBAAoB,EAAE,4BAA4B,CAAA;IAC3D,gBAAgB,IAAI,IAAI,CAAA;CACzB,CAAA;AAED,qBAAa,YAAY;IASrB,OAAO,CA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