@singapore-editor/lsp-plugin 0.1.1 → 0.2.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.
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
@@ -0,0 +1,4 @@
1
+ import type { LspClient } from '@singapore-editor/lsp';
2
+ import type { LanguageServerSourceConnection } from './retainedSource';
3
+ export declare function languageServerSourceConnection(client: LspClient): LanguageServerSourceConnection | null;
4
+ //# sourceMappingURL=sourceConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceConnection.d.ts","sourceRoot":"","sources":["../src/sourceConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AAQtE,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,GAChB,8BAA8B,GAAG,IAAI,CAYvC"}
@@ -0,0 +1,21 @@
1
+ // src/sourceConnection.ts
2
+ var epochs = /* @__PURE__ */ new WeakMap();
3
+ function languageServerSourceConnection(client) {
4
+ const initialization = client.initialization;
5
+ if (!initialization || !client.initialized) return null;
6
+ const previous = epochs.get(client);
7
+ if (previous?.initialization === initialization) return previous.connection;
8
+ const connection = {
9
+ generation: (previous?.connection.generation ?? 0) + 1,
10
+ ready: initialization,
11
+ isCurrent: () => client.initialization === initialization && client.initialized
12
+ };
13
+ epochs.set(client, {
14
+ initialization,
15
+ connection
16
+ });
17
+ return connection;
18
+ }
19
+ export { languageServerSourceConnection };
20
+
21
+ //# sourceMappingURL=sourceConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceConnection.js","names":[],"sources":["../src/sourceConnection.ts"],"sourcesContent":["import type { LspClient } from '@singapore-editor/lsp'\nimport type { LanguageServerSourceConnection } from './retainedSource'\n\ntype ConnectionEpoch = {\n readonly initialization: Promise<void>\n readonly connection: LanguageServerSourceConnection\n}\nconst epochs = new WeakMap<LspClient, ConnectionEpoch>()\n\nexport function languageServerSourceConnection(\n client: LspClient,\n): LanguageServerSourceConnection | null {\n const initialization = client.initialization\n if (!initialization || !client.initialized) return null\n const previous = epochs.get(client)\n if (previous?.initialization === initialization) return previous.connection\n const connection: LanguageServerSourceConnection = {\n generation: (previous?.connection.generation ?? 0) + 1,\n ready: initialization,\n isCurrent: () => client.initialization === initialization && client.initialized,\n }\n epochs.set(client, { initialization, connection })\n return connection\n}\n"],"mappings":";AAOA,IAAM,yBAAS,IAAI,QAAoC;AAEvD,SAAgB,+BACd,QACuC;CACvC,MAAM,iBAAiB,OAAO;CAC9B,IAAI,CAAC,kBAAkB,CAAC,OAAO,aAAa,OAAO;CACnD,MAAM,WAAW,OAAO,IAAI,MAAM;CAClC,IAAI,UAAU,mBAAmB,gBAAgB,OAAO,SAAS;CACjE,MAAM,aAA6C;EACjD,aAAa,UAAU,WAAW,cAAc,KAAK;EACrD,OAAO;EACP,iBAAiB,OAAO,mBAAmB,kBAAkB,OAAO;CACtE;CACA,OAAO,IAAI,QAAQ;EAAE;EAAgB;CAAW,CAAC;CACjD,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- //#region src/sourceText.ts
1
+ // src/sourceText.ts
2
2
  var INITIAL_RADIUS = 256;
3
3
  function rowBounds(document, offset) {
4
4
  const length = document.textSnapshot.length;
@@ -64,7 +64,6 @@ function textReadSnapshotOf(document) {
64
64
  forEachTextChunk: (visit) => textSnapshot.forEachTextChunk(visit)
65
65
  };
66
66
  }
67
- //#endregion
68
67
  export { characterAt, rangeAroundOffset, rowBounds, textReadSnapshotOf };
69
68
 
70
69
  //# sourceMappingURL=sourceText.js.map
package/dist/types.d.ts CHANGED
@@ -12,7 +12,7 @@ import type { WorkspaceTextDocumentProvenance } from './workspaceTextEdits';
12
12
  export type { LanguageServerConnectionContext } from './connectionContext';
13
13
  import type { LanguageServerSemanticTokensFactory, LanguageServerSemanticTokensOptions } from './semanticTokens';
14
14
  export type LanguageServerStatus = 'idle' | 'loading' | 'ready' | 'error';
15
- export declare const LANGUAGE_SERVER_FEATURE_IDS: readonly ["completion", "hover", "navigation", "signatureHelp", "diagnostics", "codeActions", "formatting", "rename", "documentHighlights", "semanticTokens"];
15
+ export declare const LANGUAGE_SERVER_FEATURE_IDS: readonly ['completion', 'hover', 'navigation', 'signatureHelp', 'diagnostics', 'codeActions', 'formatting', 'rename', 'documentHighlights', 'semanticTokens'];
16
16
  export type LanguageServerFeatureId = (typeof LANGUAGE_SERVER_FEATURE_IDS)[number];
17
17
  export type LanguageServerFeatureRanks = Partial<Readonly<Record<LanguageServerFeatureId, number>>>;
18
18
  export type LanguageServerReadyNotification = {
@@ -186,7 +186,7 @@ export type LanguageServerPluginOptions = LanguageServerLaneHostOptions & {
186
186
  readonly onInteractiveReady?: () => void;
187
187
  readonly onRequestError?: (serverId: string, method: string, error: unknown) => void;
188
188
  /** Reports the selected destination when Ctrl/Cmd-hover renders a jumpable link. */
189
- readonly onDefinitionLinkHover?: (target: LanguageServerDefinitionTarget) => void;
189
+ readonly onDefinitionLinkHover?: (target: LanguageServerDefinitionTarget) => void | (() => void);
190
190
  readonly onOpenDefinition?: (target: LanguageServerDefinitionTarget, options?: LanguageServerNavigationOptions) => void | boolean;
191
191
  readonly onOpenReferences?: (result: LanguageServerReferencesResult) => void | boolean;
192
192
  readonly onError?: (error: unknown) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AACnF,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EACV,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,KAAK,GAAG,MAAM,gCAAgC,CAAA;AAE1D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAA;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAA;AAC3E,Y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,CAAC,EAAE,KAAK,CAAA;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,iCAAiC,CAAA;IACzD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;CACrD,GACD;IACE,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;IACtB,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,CAAA;IAC7B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAA;CACtC,CACJ,CAAA;AAEH,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,OAAO,CAAC,8BAA8B,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;CAAE,CAAC,EACtF,OAAO,GAAG,UAAU,CACrB,GAAG;IACF,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,KAAK,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAA"}
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/types.ts
1
+ // src/types.ts
2
2
  var LANGUAGE_SERVER_FEATURE_IDS = [
3
3
  "completion",
4
4
  "hover",
@@ -11,7 +11,6 @@ var LANGUAGE_SERVER_FEATURE_IDS = [
11
11
  "documentHighlights",
12
12
  "semanticTokens"
13
13
  ];
14
- //#endregion
15
14
  export { LANGUAGE_SERVER_FEATURE_IDS };
16
15
 
17
16
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { TooltipAction } from '@singapore-editor/plugin-ui/tooltip'\nimport type { LanguageServerDocument } from './document'\nimport type { DocumentLogicalRevisionScope } from '@singapore-editor/core/document'\nimport type {\n EditorDisposable,\n EditorPlugin,\n EditorTextAnchor,\n EditorViewSnapshot,\n} from '@singapore-editor/core/extensions'\nimport type {\n LspClient,\n LspNotificationHandler,\n LspServerRequestHandler,\n LspWebSocketTransportOptions,\n} from '@singapore-editor/lsp'\nimport type * as lsp from 'vscode-languageserver-protocol'\n\nimport type { LanguageServerConnectionContext } from './connectionContext'\nimport type { LanguageServerDocumentSyncController } from './documentSyncController'\nimport type { LspConnectionProvider, LspReconnectOptions } from './lspConnection'\nimport type { ParsedWorkspaceEdit } from './workspaceEdit'\nimport type { WorkspaceTextDocumentProvenance } from './workspaceTextEdits'\nexport type { LanguageServerConnectionContext } from './connectionContext'\nimport type {\n LanguageServerSemanticTokensFactory,\n LanguageServerSemanticTokensOptions,\n} from './semanticTokens'\n\nexport type LanguageServerStatus = 'idle' | 'loading' | 'ready' | 'error'\n\nexport const LANGUAGE_SERVER_FEATURE_IDS = [\n 'completion',\n 'hover',\n 'navigation',\n 'signatureHelp',\n 'diagnostics',\n 'codeActions',\n 'formatting',\n 'rename',\n 'documentHighlights',\n 'semanticTokens',\n] as const\n\nexport type LanguageServerFeatureId = (typeof LANGUAGE_SERVER_FEATURE_IDS)[number]\n\nexport type LanguageServerFeatureRanks = Partial<Readonly<Record<LanguageServerFeatureId, number>>>\n\nexport type LanguageServerReadyNotification = {\n readonly method: string\n readonly params: unknown\n}\n\nexport type LanguageServerDiagnosticCounts = {\n readonly error: number\n readonly warning: number\n readonly information: number\n readonly hint: number\n readonly total: number\n}\n\n/**\n * How far a summary's diagnostics can be trusted, so an empty list is never mistaken for a clean\n * file. `awaiting`: a first result is being asked for. `refreshing`: a result is shown and a newer\n * one is being asked for. `current`: nothing is pending. `silent`: the server has said nothing and\n * nothing is pending — a push-only server may never publish, so this never waits. `unavailable`:\n * the connection is gone and what was shown was cleared.\n */\nexport type LanguageServerDiagnosticsFreshness =\n | 'awaiting'\n | 'refreshing'\n | 'current'\n | 'silent'\n | 'unavailable'\n\nexport type LanguageServerDiagnosticSummary = {\n readonly uri: lsp.DocumentUri | null\n readonly version: number | null\n readonly diagnostics: readonly lsp.Diagnostic[]\n readonly counts: LanguageServerDiagnosticCounts\n readonly freshness: LanguageServerDiagnosticsFreshness\n}\n\nexport type LanguageServerDiagnosticMarkerEvent = {\n readonly direction: 'next' | 'previous'\n readonly diagnostic: lsp.Diagnostic\n readonly documentUri: lsp.DocumentUri\n readonly textVersion: number\n readonly anchor: EditorTextAnchor\n}\n\nexport type LanguageServerDiagnosticMarkerClaim =\n | { readonly kind: 'claimed'; dispose(): void }\n | { readonly kind: 'ignored' }\n\nexport type LanguageServerDefinitionTarget = {\n readonly uri: lsp.DocumentUri\n readonly path: string\n readonly range: lsp.Range\n}\n\nexport type LanguageServerNavigationKind =\n | 'definition'\n | 'references'\n | 'implementation'\n | 'typeDefinition'\n\nexport type LanguageServerNavigationOpenMode = 'default' | 'peek' | 'aside'\n\nexport type LanguageServerNavigationOptions = {\n readonly kind: LanguageServerNavigationKind\n readonly openMode: LanguageServerNavigationOpenMode\n}\n\nexport type LanguageServerReferencesResult = {\n readonly uri: lsp.DocumentUri\n readonly targets: readonly LanguageServerDefinitionTarget[]\n}\n\nexport type LanguageServerDocumentSnapshot = Pick<\n EditorViewSnapshot,\n | 'documentId'\n | 'languageId'\n | 'textSnapshot'\n | 'textVersion'\n | 'documentSyncPoint'\n | 'changesSinceDocumentSyncPoint'\n | 'lineStarts'\n | 'lineStartsView'\n>\n\nexport type LanguageServerDocumentSyncOptions = {\n /** Projects a live path transition before deferred view publication catches up. */\n readonly controller?: LanguageServerDocumentSyncController\n /** Resolves opaque editor identities to protocol URIs. Returning null disables synchronization. */\n uriForDocument?(snapshot: LanguageServerDocumentSnapshot): lsp.DocumentUri | null\n /**\n * The language id sent to the server when the editor and protocol use different names.\n * Returning undefined keeps the editor's id.\n */\n languageIdForDocument?(languageId: string, uri: lsp.DocumentUri): string | undefined\n shouldSyncLanguageId?(languageId: string, snapshot: LanguageServerDocumentSnapshot): boolean\n shouldSyncUri?(uri: lsp.DocumentUri, snapshot: LanguageServerDocumentSnapshot): boolean\n}\n\nexport type { WorkspaceTextDocumentProvenance } from './workspaceTextEdits'\n\nexport type WorkspaceEditOriginGuard = {\n readonly documents: readonly WorkspaceTextDocumentProvenance[]\n isCurrent(uri: string): boolean\n}\n\nexport type ApplyWorkspaceEditRequest = {\n readonly guard: WorkspaceEditOriginGuard\n readonly label: string\n readonly logicalRevisionScope: DocumentLogicalRevisionScope\n readonly originUri: string\n readonly originVersion: number\n readonly plan: ParsedWorkspaceEdit\n readonly serverId: string\n readonly signal: AbortSignal\n readonly source: 'code-action' | 'rename'\n}\n\nexport type ApplyWorkspaceEditResult =\n | { readonly status: 'applied' }\n | { readonly status: 'cancelled' }\n | { readonly code: string; readonly message: string; readonly status: 'failed' }\n | { readonly code: string; readonly message: string; readonly status: 'rolled-back' }\n | {\n readonly affectedPaths: readonly string[]\n readonly code: string\n readonly message: string\n readonly status: 'recovery-required'\n }\n\nexport type OnApplyWorkspaceEdit = (\n request: ApplyWorkspaceEditRequest,\n) => Promise<ApplyWorkspaceEditResult>\n\nexport type LanguageServerLaneHostOptions = {\n readonly onApplyWorkspaceEdit?: OnApplyWorkspaceEdit\n}\n\nexport type LanguageServerRenamePrompt = {\n readonly anchor: DOMRect\n readonly currentName: string\n readonly signal: AbortSignal\n}\n\nexport type LanguageServerDiagnosticActionContext = {\n readonly documentUri: lsp.DocumentUri\n readonly textVersion: number\n readonly diagnostic: lsp.Diagnostic\n}\n\nexport type LanguageServerDiagnosticActions = (\n context: LanguageServerDiagnosticActionContext,\n) => readonly TooltipAction[]\n\nexport type LanguageServerPluginOptions = LanguageServerLaneHostOptions & {\n readonly rootUri?: lsp.DocumentUri | null\n readonly initializationOptions?: unknown\n readonly timeoutMs?: number\n /**\n * Merged over `defaultClientCapabilities()`, so a host declares only what it adds. Build a\n * semantic-tokens block with `semanticTokensClientCapability()` from `@singapore-editor/lsp` rather than\n * by hand: it refuses the flags this editor cannot honour, each of which a real server acts on.\n */\n readonly capabilities?: lsp.ClientCapabilities\n /** At least one real server branches on this. The value is the host's to pick. */\n readonly clientInfo?: lsp.InitializeParams['clientInfo']\n /**\n * Merged around the plugin's own handlers. An entry for `textDocument/publishDiagnostics` runs\n * after the plugin's and cannot displace it, because the diagnostics feature hangs off it.\n */\n readonly notificationHandlers?: Readonly<Record<string, LspNotificationHandler<LspClient>>>\n /**\n * Answers requests the server sends the client, such as a server asking the host for files.\n * A method the plugin answers itself (`workspace/diagnostic/refresh`) stays the plugin's.\n */\n readonly serverRequestHandlers?: Readonly<Record<string, LspServerRequestHandler<LspClient>>>\n /** Which documents reach the server, and under what language id. */\n readonly documentSync?: LanguageServerDocumentSyncOptions\n readonly webSocketRoute: string | URL\n readonly webSocketTransportOptions?: LspWebSocketTransportOptions\n /**\n * Borrows the connection rather than owning one per view, so a file switch that rebuilds the view\n * does not also rebuild the websocket and re-run `initialize`. The route and options above still\n * describe the connection — the provider is handed them and builds from them the first time it\n * sees a key. See `LspConnectionProvider`.\n */\n readonly connectionProvider?: LspConnectionProvider\n /**\n * Turns on the semantic token layer, and is how the host gets hold of one: a layer needs a\n * viewport, a snapshot and a lifecycle, so the contribution creates it and hands it over through\n * `onLayer`. Supplying nothing creates no layer and fires no demand signal.\n */\n readonly semanticTokens?: LanguageServerSemanticTokensOptions\n /**\n * Hands the host the connection the moment it exists, which is the only way to reach the\n * `LspClient` — and therefore the only way to issue a request, override the timeout for one, or\n * cancel one. Returning a disposable ties the host's own controller to the connection's life.\n */\n onConnectionCreated?(context: LanguageServerConnectionContext): EditorDisposable | void\n /** The same context again, once `initialize` has come back and server capabilities are known. */\n onConnected?(context: LanguageServerConnectionContext): void\n readonly onStatusChange?: (status: LanguageServerStatus) => void\n readonly onDiagnostics?: (summary: LanguageServerDiagnosticSummary) => void\n readonly getDiagnosticActions?: LanguageServerDiagnosticActions\n readonly onDidNavigateDiagnostic?: (\n event: LanguageServerDiagnosticMarkerEvent,\n ) => LanguageServerDiagnosticMarkerClaim\n readonly onInteractiveReady?: () => void\n readonly onRequestError?: (serverId: string, method: string, error: unknown) => void\n /** Reports the selected destination when Ctrl/Cmd-hover renders a jumpable link. */\n readonly onDefinitionLinkHover?: (target: LanguageServerDefinitionTarget) => void\n readonly onOpenDefinition?: (\n target: LanguageServerDefinitionTarget,\n options?: LanguageServerNavigationOptions,\n ) => void | boolean\n readonly onOpenReferences?: (result: LanguageServerReferencesResult) => void | boolean\n readonly onError?: (error: unknown) => void\n}\n\nexport type LanguageServerLaneOptions = LanguageServerLaneHostOptions & {\n readonly id: string\n readonly features: LanguageServerFeatureRanks\n readonly rootUri?: lsp.DocumentUri | null\n readonly initializationOptions?: unknown\n readonly timeoutMs?: number\n readonly capabilities?: lsp.ClientCapabilities\n readonly clientInfo?: lsp.InitializeParams['clientInfo']\n readonly notificationHandlers?: Readonly<Record<string, LspNotificationHandler<LspClient>>>\n readonly serverRequestHandlers?: Readonly<Record<string, LspServerRequestHandler<LspClient>>>\n readonly webSocketRoute: string | URL\n readonly webSocketTransportOptions?: LspWebSocketTransportOptions\n readonly connectionProvider?: LspConnectionProvider\n /** Reconnects after the server goes away on its own; off unless given. */\n readonly reconnect?: LspReconnectOptions\n readonly readyNotifications?: readonly LanguageServerReadyNotification[]\n onConnectionCreated?(context: LanguageServerConnectionContext): EditorDisposable | void\n onConnected?(context: LanguageServerConnectionContext): void\n readonly onStatusChange?: (status: LanguageServerStatus) => void\n readonly onDiagnostics?: (summary: LanguageServerDiagnosticSummary) => void\n readonly onInteractiveReady?: () => void\n readonly onRequestError?: (method: string, error: unknown) => void\n readonly onError?: (error: unknown) => void\n}\n\nexport type LanguageServerSetPluginOptions = Pick<\n LanguageServerPluginOptions,\n | 'onDiagnostics'\n | 'onDidNavigateDiagnostic'\n | 'getDiagnosticActions'\n | 'onInteractiveReady'\n | 'onRequestError'\n | 'onDefinitionLinkHover'\n | 'onOpenDefinition'\n | 'onOpenReferences'\n | 'onError'\n> & {\n readonly semanticTokens?: LanguageServerSemanticTokensFactory\n} & (\n | {\n readonly lanes: readonly LanguageServerLaneOptions[]\n readonly document?: never\n readonly documentSync?: LanguageServerDocumentSyncOptions\n readonly onApplyWorkspaceEdit?: OnApplyWorkspaceEdit\n }\n | {\n readonly document: LanguageServerDocument\n readonly lanes?: never\n readonly documentSync?: never\n readonly onApplyWorkspaceEdit?: never\n }\n )\n\nexport type LanguageServerDocumentPluginOptions = Omit<\n Extract<LanguageServerSetPluginOptions, { readonly document: LanguageServerDocument }>,\n 'lanes' | 'document'\n> & {\n readonly document: LanguageServerDocument\n readonly webSocketRoute?: never\n}\n\nexport type LanguageServerPlugin = EditorPlugin\n"],"mappings":";AA8BA,IAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { TooltipAction } from '@singapore-editor/plugin-ui/tooltip'\nimport type { LanguageServerDocument } from './document'\nimport type { DocumentLogicalRevisionScope } from '@singapore-editor/core/document'\nimport type {\n EditorDisposable,\n EditorPlugin,\n EditorTextAnchor,\n EditorViewSnapshot,\n} from '@singapore-editor/core/extensions'\nimport type {\n LspClient,\n LspNotificationHandler,\n LspServerRequestHandler,\n LspWebSocketTransportOptions,\n} from '@singapore-editor/lsp'\nimport type * as lsp from 'vscode-languageserver-protocol'\n\nimport type { LanguageServerConnectionContext } from './connectionContext'\nimport type { LanguageServerDocumentSyncController } from './documentSyncController'\nimport type { LspConnectionProvider, LspReconnectOptions } from './lspConnection'\nimport type { ParsedWorkspaceEdit } from './workspaceEdit'\nimport type { WorkspaceTextDocumentProvenance } from './workspaceTextEdits'\nexport type { LanguageServerConnectionContext } from './connectionContext'\nimport type {\n LanguageServerSemanticTokensFactory,\n LanguageServerSemanticTokensOptions,\n} from './semanticTokens'\n\nexport type LanguageServerStatus = 'idle' | 'loading' | 'ready' | 'error'\n\nexport const LANGUAGE_SERVER_FEATURE_IDS = [\n 'completion',\n 'hover',\n 'navigation',\n 'signatureHelp',\n 'diagnostics',\n 'codeActions',\n 'formatting',\n 'rename',\n 'documentHighlights',\n 'semanticTokens',\n] as const\n\nexport type LanguageServerFeatureId = (typeof LANGUAGE_SERVER_FEATURE_IDS)[number]\n\nexport type LanguageServerFeatureRanks = Partial<Readonly<Record<LanguageServerFeatureId, number>>>\n\nexport type LanguageServerReadyNotification = {\n readonly method: string\n readonly params: unknown\n}\n\nexport type LanguageServerDiagnosticCounts = {\n readonly error: number\n readonly warning: number\n readonly information: number\n readonly hint: number\n readonly total: number\n}\n\n/**\n * How far a summary's diagnostics can be trusted, so an empty list is never mistaken for a clean\n * file. `awaiting`: a first result is being asked for. `refreshing`: a result is shown and a newer\n * one is being asked for. `current`: nothing is pending. `silent`: the server has said nothing and\n * nothing is pending — a push-only server may never publish, so this never waits. `unavailable`:\n * the connection is gone and what was shown was cleared.\n */\nexport type LanguageServerDiagnosticsFreshness =\n | 'awaiting'\n | 'refreshing'\n | 'current'\n | 'silent'\n | 'unavailable'\n\nexport type LanguageServerDiagnosticSummary = {\n readonly uri: lsp.DocumentUri | null\n readonly version: number | null\n readonly diagnostics: readonly lsp.Diagnostic[]\n readonly counts: LanguageServerDiagnosticCounts\n readonly freshness: LanguageServerDiagnosticsFreshness\n}\n\nexport type LanguageServerDiagnosticMarkerEvent = {\n readonly direction: 'next' | 'previous'\n readonly diagnostic: lsp.Diagnostic\n readonly documentUri: lsp.DocumentUri\n readonly textVersion: number\n readonly anchor: EditorTextAnchor\n}\n\nexport type LanguageServerDiagnosticMarkerClaim =\n | { readonly kind: 'claimed'; dispose(): void }\n | { readonly kind: 'ignored' }\n\nexport type LanguageServerDefinitionTarget = {\n readonly uri: lsp.DocumentUri\n readonly path: string\n readonly range: lsp.Range\n}\n\nexport type LanguageServerNavigationKind =\n | 'definition'\n | 'references'\n | 'implementation'\n | 'typeDefinition'\n\nexport type LanguageServerNavigationOpenMode = 'default' | 'peek' | 'aside'\n\nexport type LanguageServerNavigationOptions = {\n readonly kind: LanguageServerNavigationKind\n readonly openMode: LanguageServerNavigationOpenMode\n}\n\nexport type LanguageServerReferencesResult = {\n readonly uri: lsp.DocumentUri\n readonly targets: readonly LanguageServerDefinitionTarget[]\n}\n\nexport type LanguageServerDocumentSnapshot = Pick<\n EditorViewSnapshot,\n | 'documentId'\n | 'languageId'\n | 'textSnapshot'\n | 'textVersion'\n | 'documentSyncPoint'\n | 'changesSinceDocumentSyncPoint'\n | 'lineStarts'\n | 'lineStartsView'\n>\n\nexport type LanguageServerDocumentSyncOptions = {\n /** Projects a live path transition before deferred view publication catches up. */\n readonly controller?: LanguageServerDocumentSyncController\n /** Resolves opaque editor identities to protocol URIs. Returning null disables synchronization. */\n uriForDocument?(snapshot: LanguageServerDocumentSnapshot): lsp.DocumentUri | null\n /**\n * The language id sent to the server when the editor and protocol use different names.\n * Returning undefined keeps the editor's id.\n */\n languageIdForDocument?(languageId: string, uri: lsp.DocumentUri): string | undefined\n shouldSyncLanguageId?(languageId: string, snapshot: LanguageServerDocumentSnapshot): boolean\n shouldSyncUri?(uri: lsp.DocumentUri, snapshot: LanguageServerDocumentSnapshot): boolean\n}\n\nexport type { WorkspaceTextDocumentProvenance } from './workspaceTextEdits'\n\nexport type WorkspaceEditOriginGuard = {\n readonly documents: readonly WorkspaceTextDocumentProvenance[]\n isCurrent(uri: string): boolean\n}\n\nexport type ApplyWorkspaceEditRequest = {\n readonly guard: WorkspaceEditOriginGuard\n readonly label: string\n readonly logicalRevisionScope: DocumentLogicalRevisionScope\n readonly originUri: string\n readonly originVersion: number\n readonly plan: ParsedWorkspaceEdit\n readonly serverId: string\n readonly signal: AbortSignal\n readonly source: 'code-action' | 'rename'\n}\n\nexport type ApplyWorkspaceEditResult =\n | { readonly status: 'applied' }\n | { readonly status: 'cancelled' }\n | { readonly code: string; readonly message: string; readonly status: 'failed' }\n | { readonly code: string; readonly message: string; readonly status: 'rolled-back' }\n | {\n readonly affectedPaths: readonly string[]\n readonly code: string\n readonly message: string\n readonly status: 'recovery-required'\n }\n\nexport type OnApplyWorkspaceEdit = (\n request: ApplyWorkspaceEditRequest,\n) => Promise<ApplyWorkspaceEditResult>\n\nexport type LanguageServerLaneHostOptions = {\n readonly onApplyWorkspaceEdit?: OnApplyWorkspaceEdit\n}\n\nexport type LanguageServerRenamePrompt = {\n readonly anchor: DOMRect\n readonly currentName: string\n readonly signal: AbortSignal\n}\n\nexport type LanguageServerDiagnosticActionContext = {\n readonly documentUri: lsp.DocumentUri\n readonly textVersion: number\n readonly diagnostic: lsp.Diagnostic\n}\n\nexport type LanguageServerDiagnosticActions = (\n context: LanguageServerDiagnosticActionContext,\n) => readonly TooltipAction[]\n\nexport type LanguageServerPluginOptions = LanguageServerLaneHostOptions & {\n readonly rootUri?: lsp.DocumentUri | null\n readonly initializationOptions?: unknown\n readonly timeoutMs?: number\n /**\n * Merged over `defaultClientCapabilities()`, so a host declares only what it adds. Build a\n * semantic-tokens block with `semanticTokensClientCapability()` from `@singapore-editor/lsp` rather than\n * by hand: it refuses the flags this editor cannot honour, each of which a real server acts on.\n */\n readonly capabilities?: lsp.ClientCapabilities\n /** At least one real server branches on this. The value is the host's to pick. */\n readonly clientInfo?: lsp.InitializeParams['clientInfo']\n /**\n * Merged around the plugin's own handlers. An entry for `textDocument/publishDiagnostics` runs\n * after the plugin's and cannot displace it, because the diagnostics feature hangs off it.\n */\n readonly notificationHandlers?: Readonly<Record<string, LspNotificationHandler<LspClient>>>\n /**\n * Answers requests the server sends the client, such as a server asking the host for files.\n * A method the plugin answers itself (`workspace/diagnostic/refresh`) stays the plugin's.\n */\n readonly serverRequestHandlers?: Readonly<Record<string, LspServerRequestHandler<LspClient>>>\n /** Which documents reach the server, and under what language id. */\n readonly documentSync?: LanguageServerDocumentSyncOptions\n readonly webSocketRoute: string | URL\n readonly webSocketTransportOptions?: LspWebSocketTransportOptions\n /**\n * Borrows the connection rather than owning one per view, so a file switch that rebuilds the view\n * does not also rebuild the websocket and re-run `initialize`. The route and options above still\n * describe the connection — the provider is handed them and builds from them the first time it\n * sees a key. See `LspConnectionProvider`.\n */\n readonly connectionProvider?: LspConnectionProvider\n /**\n * Turns on the semantic token layer, and is how the host gets hold of one: a layer needs a\n * viewport, a snapshot and a lifecycle, so the contribution creates it and hands it over through\n * `onLayer`. Supplying nothing creates no layer and fires no demand signal.\n */\n readonly semanticTokens?: LanguageServerSemanticTokensOptions\n /**\n * Hands the host the connection the moment it exists, which is the only way to reach the\n * `LspClient` — and therefore the only way to issue a request, override the timeout for one, or\n * cancel one. Returning a disposable ties the host's own controller to the connection's life.\n */\n onConnectionCreated?(context: LanguageServerConnectionContext): EditorDisposable | void\n /** The same context again, once `initialize` has come back and server capabilities are known. */\n onConnected?(context: LanguageServerConnectionContext): void\n readonly onStatusChange?: (status: LanguageServerStatus) => void\n readonly onDiagnostics?: (summary: LanguageServerDiagnosticSummary) => void\n readonly getDiagnosticActions?: LanguageServerDiagnosticActions\n readonly onDidNavigateDiagnostic?: (\n event: LanguageServerDiagnosticMarkerEvent,\n ) => LanguageServerDiagnosticMarkerClaim\n readonly onInteractiveReady?: () => void\n readonly onRequestError?: (serverId: string, method: string, error: unknown) => void\n /** Reports the selected destination when Ctrl/Cmd-hover renders a jumpable link. */\n readonly onDefinitionLinkHover?: (target: LanguageServerDefinitionTarget) => void | (() => void)\n readonly onOpenDefinition?: (\n target: LanguageServerDefinitionTarget,\n options?: LanguageServerNavigationOptions,\n ) => void | boolean\n readonly onOpenReferences?: (result: LanguageServerReferencesResult) => void | boolean\n readonly onError?: (error: unknown) => void\n}\n\nexport type LanguageServerLaneOptions = LanguageServerLaneHostOptions & {\n readonly id: string\n readonly features: LanguageServerFeatureRanks\n readonly rootUri?: lsp.DocumentUri | null\n readonly initializationOptions?: unknown\n readonly timeoutMs?: number\n readonly capabilities?: lsp.ClientCapabilities\n readonly clientInfo?: lsp.InitializeParams['clientInfo']\n readonly notificationHandlers?: Readonly<Record<string, LspNotificationHandler<LspClient>>>\n readonly serverRequestHandlers?: Readonly<Record<string, LspServerRequestHandler<LspClient>>>\n readonly webSocketRoute: string | URL\n readonly webSocketTransportOptions?: LspWebSocketTransportOptions\n readonly connectionProvider?: LspConnectionProvider\n /** Reconnects after the server goes away on its own; off unless given. */\n readonly reconnect?: LspReconnectOptions\n readonly readyNotifications?: readonly LanguageServerReadyNotification[]\n onConnectionCreated?(context: LanguageServerConnectionContext): EditorDisposable | void\n onConnected?(context: LanguageServerConnectionContext): void\n readonly onStatusChange?: (status: LanguageServerStatus) => void\n readonly onDiagnostics?: (summary: LanguageServerDiagnosticSummary) => void\n readonly onInteractiveReady?: () => void\n readonly onRequestError?: (method: string, error: unknown) => void\n readonly onError?: (error: unknown) => void\n}\n\nexport type LanguageServerSetPluginOptions = Pick<\n LanguageServerPluginOptions,\n | 'onDiagnostics'\n | 'onDidNavigateDiagnostic'\n | 'getDiagnosticActions'\n | 'onInteractiveReady'\n | 'onRequestError'\n | 'onDefinitionLinkHover'\n | 'onOpenDefinition'\n | 'onOpenReferences'\n | 'onError'\n> & {\n readonly semanticTokens?: LanguageServerSemanticTokensFactory\n} & (\n | {\n readonly lanes: readonly LanguageServerLaneOptions[]\n readonly document?: never\n readonly documentSync?: LanguageServerDocumentSyncOptions\n readonly onApplyWorkspaceEdit?: OnApplyWorkspaceEdit\n }\n | {\n readonly document: LanguageServerDocument\n readonly lanes?: never\n readonly documentSync?: never\n readonly onApplyWorkspaceEdit?: never\n }\n )\n\nexport type LanguageServerDocumentPluginOptions = Omit<\n Extract<LanguageServerSetPluginOptions, { readonly document: LanguageServerDocument }>,\n 'lanes' | 'document'\n> & {\n readonly document: LanguageServerDocument\n readonly webSocketRoute?: never\n}\n\nexport type LanguageServerPlugin = EditorPlugin\n"],"mappings":";AA8BA,IAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -1,4 +1,4 @@
1
- //#region src/viewDocumentSnapshot.ts
1
+ // src/viewDocumentSnapshot.ts
2
2
  /** The view's text and line-start index as an LSP document snapshot, so nothing rescans the text. */
3
3
  function viewDocumentSnapshot(snapshot) {
4
4
  return {
@@ -6,7 +6,6 @@ function viewDocumentSnapshot(snapshot) {
6
6
  lineStarts: snapshot.lineStartsView
7
7
  };
8
8
  }
9
- //#endregion
10
9
  export { viewDocumentSnapshot };
11
10
 
12
11
  //# sourceMappingURL=viewDocumentSnapshot.js.map
@@ -1,5 +1,5 @@
1
1
  import { prepareWorkspaceTextReplay } from "./workspaceTextEdits.js";
2
- //#region src/workspaceEdit.ts
2
+ // src/workspaceEdit.ts
3
3
  var EMPTY_OPERATIONS = Object.freeze([]);
4
4
  function parseWorkspaceEdit(input) {
5
5
  if (input === null || input === void 0) return emptyWorkspaceEdit();
@@ -270,7 +270,6 @@ function compareCodeUnits(left, right) {
270
270
  if (left > right) return 1;
271
271
  return 0;
272
272
  }
273
- //#endregion
274
273
  export { parseWorkspaceEdit, prepareWorkspaceTextReplay };
275
274
 
276
275
  //# sourceMappingURL=workspaceEdit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceEditProvenance.d.ts","sourceRoot":"","sources":["../src/workspaceEditProvenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAA;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,wBAAwB,EAC/B,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,mBAAmB,GACxB,+BAA+B,GAAG,IAAI,CAexC"}
1
+ {"version":3,"file":"workspaceEditProvenance.d.ts","sourceRoot":"","sources":["../src/workspaceEditProvenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAA;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,wBAAwB,EAC/B,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,mBAAmB,GACxB,+BAA+B,GAAG,IAAI,CAoBxC"}
@@ -1,7 +1,7 @@
1
- //#region src/workspaceEditProvenance.ts
1
+ // src/workspaceEditProvenance.ts
2
2
  function currentWorkspaceEditOrigin(guard, active, plan) {
3
3
  const origin = guard.documents.find((document) => document.uri === active.uri);
4
- if (!origin || origin.textSnapshot !== active.textSnapshot) return null;
4
+ if (!origin || origin.sourceRevision !== active.sourceRevision || origin.sourceSegment !== active.sourceSegment) return null;
5
5
  if (!guard.isCurrent(active.uri)) return null;
6
6
  const affectedUris = new Set(plan.operations.flatMap((operation) => operation.kind === "rename" ? [operation.oldUri, operation.newUri] : [operation.uri]));
7
7
  for (const document of guard.documents) {
@@ -10,7 +10,6 @@ function currentWorkspaceEditOrigin(guard, active, plan) {
10
10
  }
11
11
  return origin;
12
12
  }
13
- //#endregion
14
13
  export { currentWorkspaceEditOrigin };
15
14
 
16
15
  //# sourceMappingURL=workspaceEditProvenance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceEditProvenance.js","names":[],"sources":["../src/workspaceEditProvenance.ts"],"sourcesContent":["import type { ActiveDocument } from './pluginTypes'\nimport type { WorkspaceEditOriginGuard, WorkspaceTextDocumentProvenance } from './types'\nimport type { ParsedWorkspaceEdit } from './workspaceEdit'\n\nexport function currentWorkspaceEditOrigin(\n guard: WorkspaceEditOriginGuard,\n active: ActiveDocument,\n plan: ParsedWorkspaceEdit,\n): WorkspaceTextDocumentProvenance | null {\n const origin = guard.documents.find((document) => document.uri === active.uri)\n if (!origin || origin.textSnapshot !== active.textSnapshot) return null\n if (!guard.isCurrent(active.uri)) return null\n\n const affectedUris = new Set(\n plan.operations.flatMap((operation) =>\n operation.kind === 'rename' ? [operation.oldUri, operation.newUri] : [operation.uri],\n ),\n )\n for (const document of guard.documents) {\n if (!affectedUris.has(document.uri)) continue\n if (!guard.isCurrent(document.uri)) return null\n }\n return origin\n}\n"],"mappings":";AAIA,SAAgB,2BACd,OACA,QACA,MACwC;CACxC,MAAM,SAAS,MAAM,UAAU,MAAM,aAAa,SAAS,QAAQ,OAAO,GAAG;CAC7E,IAAI,CAAC,UAAU,OAAO,iBAAiB,OAAO,cAAc,OAAO;CACnE,IAAI,CAAC,MAAM,UAAU,OAAO,GAAG,GAAG,OAAO;CAEzC,MAAM,eAAe,IAAI,IACvB,KAAK,WAAW,SAAS,cACvB,UAAU,SAAS,WAAW,CAAC,UAAU,QAAQ,UAAU,MAAM,IAAI,CAAC,UAAU,GAAG,CACrF,CACF;CACA,KAAK,MAAM,YAAY,MAAM,WAAW;EACtC,IAAI,CAAC,aAAa,IAAI,SAAS,GAAG,GAAG;EACrC,IAAI,CAAC,MAAM,UAAU,SAAS,GAAG,GAAG,OAAO;CAC7C;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"workspaceEditProvenance.js","names":[],"sources":["../src/workspaceEditProvenance.ts"],"sourcesContent":["import type { ActiveDocument } from './pluginTypes'\nimport type { WorkspaceEditOriginGuard, WorkspaceTextDocumentProvenance } from './types'\nimport type { ParsedWorkspaceEdit } from './workspaceEdit'\n\nexport function currentWorkspaceEditOrigin(\n guard: WorkspaceEditOriginGuard,\n active: ActiveDocument,\n plan: ParsedWorkspaceEdit,\n): WorkspaceTextDocumentProvenance | null {\n const origin = guard.documents.find((document) => document.uri === active.uri)\n if (\n !origin ||\n origin.sourceRevision !== active.sourceRevision ||\n origin.sourceSegment !== active.sourceSegment\n )\n return null\n if (!guard.isCurrent(active.uri)) return null\n\n const affectedUris = new Set(\n plan.operations.flatMap((operation) =>\n operation.kind === 'rename' ? [operation.oldUri, operation.newUri] : [operation.uri],\n ),\n )\n for (const document of guard.documents) {\n if (!affectedUris.has(document.uri)) continue\n if (!guard.isCurrent(document.uri)) return null\n }\n return origin\n}\n"],"mappings":";AAIA,SAAgB,2BACd,OACA,QACA,MACwC;CACxC,MAAM,SAAS,MAAM,UAAU,MAAM,aAAa,SAAS,QAAQ,OAAO,GAAG;CAC7E,IACE,CAAC,UACD,OAAO,mBAAmB,OAAO,kBACjC,OAAO,kBAAkB,OAAO,eAEhC,OAAO;CACT,IAAI,CAAC,MAAM,UAAU,OAAO,GAAG,GAAG,OAAO;CAEzC,MAAM,eAAe,IAAI,IACvB,KAAK,WAAW,SAAS,cACvB,UAAU,SAAS,WAAW,CAAC,UAAU,QAAQ,UAAU,MAAM,IAAI,CAAC,UAAU,GAAG,CACrF,CACF;CACA,KAAK,MAAM,YAAY,MAAM,WAAW;EACtC,IAAI,CAAC,aAAa,IAAI,SAAS,GAAG,GAAG;EACrC,IAAI,CAAC,MAAM,UAAU,SAAS,GAAG,GAAG,OAAO;CAC7C;CACA,OAAO;AACT"}
@@ -1,10 +1,12 @@
1
- import type { DocumentLogicalRevisionScope, DocumentTextSnapshot, EditorTextBuffer, PieceTableSnapshot, PreparedDocumentTransactionSequence, TextEdit } from '@singapore-editor/core/document';
1
+ import type { DocumentLogicalRevisionScope, DocumentSyncPoint, DocumentTextSnapshot, EditorTextBuffer, PieceTableSnapshot, PreparedDocumentTransactionSequence, TextEdit } from '@singapore-editor/core/document';
2
2
  import type { LspTextSnapshot } from '@singapore-editor/lsp';
3
3
  import type { WorkspaceEditFailure, WorkspaceEditOperation } from './workspaceEdit';
4
4
  export type WorkspaceTextDocumentProvenance = {
5
5
  readonly textSnapshot: LspTextSnapshot;
6
6
  readonly uri: string;
7
7
  readonly version: number;
8
+ readonly sourceRevision: number;
9
+ readonly sourceSegment: object;
8
10
  };
9
11
  export type WorkspaceTextReplaySegmentInput = {
10
12
  readonly operations: readonly {
@@ -20,6 +22,7 @@ export type WorkspaceTextReplayTarget = {
20
22
  readonly buffer: EditorTextBuffer;
21
23
  readonly expectedRevision: number;
22
24
  readonly initialSnapshot: DocumentTextSnapshot;
25
+ readonly initialSyncPoint: DocumentSyncPoint;
23
26
  };
24
27
  export type WorkspaceTextReplayInput = {
25
28
  readonly logicalRevisionScope: DocumentLogicalRevisionScope;
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceTextEdits.d.ts","sourceRoot":"","sources":["../src/workspaceTextEdits.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mCAAmC,EACnC,QAAQ,EAET,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAGV,oBAAoB,EAEpB,sBAAsB,EACvB,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAA;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS;QAC5B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,sBAAsB,EAAE;YAAE,IAAI,EAAE,eAAe,CAAA;SAAE,CAAC,CAAA;QAC9E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;KAChC,EAAE,CAAA;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,oBAAoB,CAAA;CAC/C,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,CAAC,oBAAoB,EAAE,4BAA4B,C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AC3C,QAAQ,CAAC,KAAK,EAAE,SAAS,yBAAyB,EAAE,CAAA;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,gCAAgC,GACxC;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;IACjB,QAAQ,CAAC,QAAQ,EAAE,SAAS,4BAA4B,EAAE,CAAA;IAC1D,QAAQ,CAAC,QAAQ,EAAE,mCAAmC,GAAG,IAAI,CAAA;CAC9D,GACD;IAAE,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAA;AAgDhE,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,wBAAwB,GAC9B,gCAAgC,CAkClC"}
@@ -1,5 +1,5 @@
1
1
  import { applyBatchToPieceTable, createDocumentTextSnapshot, diffPieceTableSnapshots, offsetToPoint, pieceTableSnapshotsHaveSameText, pointToOffset, prepareDocumentTransactionSequence, readPieceTableTextRange } from "@singapore-editor/core/document";
2
- //#region src/workspaceTextEdits.ts
2
+ // src/workspaceTextEdits.ts
3
3
  function prepareWorkspaceTextReplay(input) {
4
4
  const targetFailure = targetGuardFailure(input.target);
5
5
  if (targetFailure) return {
@@ -30,24 +30,29 @@ function prepareWorkspaceTextReplay(input) {
30
30
  function targetGuardFailure(target) {
31
31
  if (target.buffer.getRevision() !== target.expectedRevision) return failure("snapshot-drift", "Target buffer revision does not match the replay guard");
32
32
  if (target.buffer.getSnapshot() !== target.initialSnapshot.snapshot) return failure("snapshot-drift", "Target buffer snapshot does not match the replay guard");
33
+ const point = target.buffer.getDocumentSyncPoint();
34
+ const captured = target.initialSyncPoint;
35
+ if (point.segment !== captured.segment || point.revision !== captured.revision || point.textVersion !== captured.textVersion) return failure("snapshot-drift", "Target source point does not match the replay guard");
33
36
  return null;
34
37
  }
35
38
  function initialReplayState(input) {
36
39
  const uri = input.segments[0]?.uri ?? null;
37
- const provenance = uri ? exactProvenance(input.provenance, uri, input.target.initialSnapshot) : null;
40
+ const provenance = uri ? exactProvenance(input.provenance, uri, input.target.initialSyncPoint) : null;
38
41
  const version = validProvenanceVersion(provenance) ? provenance.version : null;
39
42
  return {
40
43
  snapshot: input.target.initialSnapshot.snapshot,
41
44
  textSnapshot: input.target.initialSnapshot,
42
45
  uri,
43
46
  version,
44
- versionUri: version === null ? null : uri
47
+ versionUri: version === null ? null : uri,
48
+ sourcePoint: input.target.initialSyncPoint
45
49
  };
46
50
  }
47
51
  function simulateSegment(input, state, segment) {
48
52
  enterSegmentUri(input.provenance, state, segment.uri);
49
53
  const snapshotBefore = state.snapshot;
50
54
  const textSnapshotBefore = state.textSnapshot;
55
+ const sourcePointBefore = state.sourcePoint;
51
56
  const simulatedVersionBefore = state.version;
52
57
  const steps = [];
53
58
  let logicalRevisionCount = 0;
@@ -57,7 +62,7 @@ function simulateSegment(input, state, segment) {
57
62
  if (result.effective) logicalRevisionCount += 1;
58
63
  steps.push(result.step);
59
64
  }
60
- canonicalizeSegmentSnapshot(state, steps, snapshotBefore, textSnapshotBefore);
65
+ canonicalizeSegmentSnapshot(state, steps, snapshotBefore, textSnapshotBefore, sourcePointBefore);
61
66
  return {
62
67
  ok: true,
63
68
  segment: Object.freeze({
@@ -76,7 +81,7 @@ function enterSegmentUri(provenance, state, uri) {
76
81
  if (state.uri === uri) return;
77
82
  state.uri = uri;
78
83
  state.versionUri = null;
79
- const mapped = exactProvenance(provenance, uri, state.textSnapshot);
84
+ const mapped = exactProvenance(provenance, uri, state.sourcePoint);
80
85
  if (!validProvenanceVersion(mapped)) return;
81
86
  if (state.version !== null && state.version !== mapped.version) return;
82
87
  state.version = mapped.version;
@@ -95,7 +100,10 @@ function simulateStep(provenance, state, segment, entry) {
95
100
  const candidate = applyBatchToPieceTable(snapshotBefore, converted.value.applicationEdits);
96
101
  const effective = !pieceTableSnapshotsHaveSameText(snapshotBefore, candidate);
97
102
  state.snapshot = effective ? candidate : snapshotBefore;
98
- if (effective) state.textSnapshot = createDocumentTextSnapshot(state.snapshot);
103
+ if (effective) {
104
+ state.textSnapshot = createDocumentTextSnapshot(state.snapshot);
105
+ state.sourcePoint = null;
106
+ }
99
107
  const versionAdvanceFailure = advanceSimulatedVersion(state, effective, entry.operationIndex);
100
108
  if (versionAdvanceFailure) return {
101
109
  error: versionAdvanceFailure,
@@ -124,7 +132,7 @@ function validateOperationVersion(provenance, state, entry) {
124
132
  }
125
133
  function establishVersionLineage(provenance, state, entry) {
126
134
  if (state.versionUri === entry.operation.uri && state.version !== null) return null;
127
- const mapped = exactProvenance(provenance, entry.operation.uri, state.textSnapshot);
135
+ const mapped = exactProvenance(provenance, entry.operation.uri, state.sourcePoint);
128
136
  if (!validProvenanceVersion(mapped)) return failure("version-mismatch", "No exact lane provenance exists for this text snapshot", { operationIndex: entry.operationIndex });
129
137
  if (state.version !== null && state.version !== mapped.version) return failure("version-mismatch", "URI provenance does not continue the simulated version", { operationIndex: entry.operationIndex });
130
138
  state.version = mapped.version;
@@ -147,7 +155,7 @@ function convertWorkspaceTextBatch(snapshot, edits, operationIndex) {
147
155
  editIndex
148
156
  });
149
157
  }
150
- const sorted = converted.toSorted(compareIndexedEdits);
158
+ const sorted = converted.sort(compareIndexedEdits);
151
159
  const conflict = textBatchConflict(sorted, operationIndex);
152
160
  if (conflict) return {
153
161
  error: conflict,
@@ -285,10 +293,11 @@ function batchBoundaryCounts(edits) {
285
293
  starts
286
294
  };
287
295
  }
288
- function canonicalizeSegmentSnapshot(state, steps, snapshotBefore, textSnapshotBefore) {
296
+ function canonicalizeSegmentSnapshot(state, steps, snapshotBefore, textSnapshotBefore, sourcePointBefore) {
289
297
  if (!pieceTableSnapshotsHaveSameText(snapshotBefore, state.snapshot)) return;
290
298
  state.snapshot = snapshotBefore;
291
299
  state.textSnapshot = textSnapshotBefore;
300
+ state.sourcePoint = sourcePointBefore;
292
301
  const last = steps.at(-1);
293
302
  if (!last) return;
294
303
  steps[steps.length - 1] = Object.freeze({
@@ -344,8 +353,9 @@ function bindStepBoundaries(steps, snapshotBefore, snapshotAfter) {
344
353
  snapshotBefore: index === 0 ? snapshotBefore : step.snapshotBefore
345
354
  })));
346
355
  }
347
- function exactProvenance(provenance, uri, textSnapshot) {
348
- return provenance.find((entry) => entry.uri === uri && entry.textSnapshot === textSnapshot) ?? null;
356
+ function exactProvenance(provenance, uri, point) {
357
+ if (!point) return null;
358
+ return provenance.find((entry) => entry.uri === uri && entry.sourceRevision === point.revision && entry.sourceSegment === point.segment) ?? null;
349
359
  }
350
360
  function validProvenanceVersion(provenance) {
351
361
  return provenance !== null && Number.isSafeInteger(provenance.version);
@@ -389,7 +399,6 @@ function failure(code, reason, indices = {}) {
389
399
  ...indices.editIndex === void 0 ? {} : { editIndex: indices.editIndex }
390
400
  });
391
401
  }
392
- //#endregion
393
402
  export { prepareWorkspaceTextReplay };
394
403
 
395
404
  //# sourceMappingURL=workspaceTextEdits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceTextEdits.js","names":[],"sources":["../src/workspaceTextEdits.ts"],"sourcesContent":["import {\n applyBatchToPieceTable,\n createDocumentTextSnapshot,\n diffPieceTableSnapshots,\n offsetToPoint,\n pieceTableSnapshotsHaveSameText,\n pointToOffset,\n prepareDocumentTransactionSequence,\n readPieceTableTextRange,\n} from '@singapore-editor/core/document'\nimport type {\n DocumentLogicalRevisionScope,\n DocumentTextSnapshot,\n EditorTextBuffer,\n PieceTableSnapshot,\n PreparedDocumentTransactionSequence,\n TextEdit,\n TextSnapshot,\n} from '@singapore-editor/core/document'\n\nimport type { LspTextSnapshot } from '@singapore-editor/lsp'\n\nimport type {\n ParsedWorkspacePosition,\n ParsedWorkspaceTextEdit,\n WorkspaceEditFailure,\n WorkspaceEditFailureCode,\n WorkspaceEditOperation,\n} from './workspaceEdit'\n\nexport type WorkspaceTextDocumentProvenance = {\n readonly textSnapshot: LspTextSnapshot\n readonly uri: string\n readonly version: number\n}\n\nexport type WorkspaceTextReplaySegmentInput = {\n readonly operations: readonly {\n readonly operation: Extract<WorkspaceEditOperation, { kind: 'text-document' }>\n readonly operationIndex: number\n }[]\n readonly segmentIndex: number\n readonly uri: string\n}\n\nexport type WorkspaceTextReplayTarget = {\n readonly buffer: EditorTextBuffer\n readonly expectedRevision: number\n readonly initialSnapshot: DocumentTextSnapshot\n}\n\nexport type WorkspaceTextReplayInput = {\n readonly logicalRevisionScope: DocumentLogicalRevisionScope\n readonly provenance: readonly WorkspaceTextDocumentProvenance[]\n readonly segments: readonly WorkspaceTextReplaySegmentInput[]\n readonly target: WorkspaceTextReplayTarget\n}\n\nexport type PreparedWorkspaceTextEdit = TextEdit & {\n readonly annotationId?: string\n}\n\nexport type PreparedWorkspaceTextStep = {\n readonly edits: readonly PreparedWorkspaceTextEdit[]\n readonly operationIndex: number\n readonly snapshotAfter: PieceTableSnapshot\n readonly snapshotBefore: PieceTableSnapshot\n readonly uri: string\n}\n\nexport type PreparedWorkspaceTextSegment = {\n readonly logicalRevisionCount: number\n readonly segmentIndex: number\n readonly sequenceSegmentIndex: number | null\n readonly simulatedVersionAfter: number | null\n readonly simulatedVersionBefore: number | null\n readonly snapshotAfter: PieceTableSnapshot\n readonly snapshotBefore: PieceTableSnapshot\n readonly steps: readonly PreparedWorkspaceTextStep[]\n readonly uri: string\n}\n\nexport type PrepareWorkspaceTextReplayResult =\n | {\n readonly ok: true\n readonly segments: readonly PreparedWorkspaceTextSegment[]\n readonly sequence: PreparedDocumentTransactionSequence | null\n }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype ReplayState = {\n snapshot: PieceTableSnapshot\n textSnapshot: TextSnapshot\n uri: string | null\n version: number | null\n versionUri: string | null\n}\n\ntype SimulatedWorkspaceTextSegment = Omit<PreparedWorkspaceTextSegment, 'sequenceSegmentIndex'>\n\ntype SimulateSegmentResult =\n | { readonly ok: true; readonly segment: SimulatedWorkspaceTextSegment }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype SimulateStepResult =\n | {\n readonly effective: boolean\n readonly ok: true\n readonly step: PreparedWorkspaceTextStep\n }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype ConvertedWorkspaceTextBatch = {\n readonly applicationEdits: readonly TextEdit[]\n readonly preparedEdits: readonly PreparedWorkspaceTextEdit[]\n}\n\ntype ConvertWorkspaceTextBatchResult =\n | { readonly ok: true; readonly value: ConvertedWorkspaceTextBatch }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype SnapPreparedTextEditsResult =\n | { readonly ok: true; readonly value: readonly PreparedWorkspaceTextEdit[] }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype IndexedPreparedWorkspaceTextEdit = {\n readonly edit: PreparedWorkspaceTextEdit\n readonly editIndex: number\n}\n\ntype BoundaryCounts = {\n readonly ends: ReadonlyMap<number, number>\n readonly starts: ReadonlyMap<number, number>\n}\n\nexport function prepareWorkspaceTextReplay(\n input: WorkspaceTextReplayInput,\n): PrepareWorkspaceTextReplayResult {\n const targetFailure = targetGuardFailure(input.target)\n if (targetFailure) return { error: targetFailure, ok: false }\n\n const state = initialReplayState(input)\n const simulated: SimulatedWorkspaceTextSegment[] = []\n for (const segment of input.segments) {\n const result = simulateSegment(input, state, segment)\n if (!result.ok) return result\n simulated.push(result.segment)\n }\n\n const effective = simulated.filter((segment) => segment.logicalRevisionCount > 0)\n if (effective.length === 0) {\n return {\n ok: true,\n segments: bindNoOpSegments(simulated, input.target.initialSnapshot.snapshot),\n sequence: null,\n }\n }\n\n const sequence = prepareDocumentTransactionSequence(\n input.target.buffer,\n effective.map((segment) => sequenceInput(input.logicalRevisionScope, segment)),\n )\n if (!sequenceMatchesTarget(sequence, input.target)) {\n return replayFailed('snapshot-drift', 'Target buffer changed before replay was bound')\n }\n\n return {\n ok: true,\n segments: bindPreparedSegments(simulated, sequence),\n sequence,\n }\n}\n\nfunction targetGuardFailure(target: WorkspaceTextReplayTarget): WorkspaceEditFailure | null {\n if (target.buffer.getRevision() !== target.expectedRevision) {\n return failure('snapshot-drift', 'Target buffer revision does not match the replay guard')\n }\n if (target.buffer.getSnapshot() !== target.initialSnapshot.snapshot) {\n return failure('snapshot-drift', 'Target buffer snapshot does not match the replay guard')\n }\n return null\n}\n\nfunction initialReplayState(input: WorkspaceTextReplayInput): ReplayState {\n const uri = input.segments[0]?.uri ?? null\n const provenance = uri\n ? exactProvenance(input.provenance, uri, input.target.initialSnapshot)\n : null\n const version = validProvenanceVersion(provenance) ? provenance.version : null\n return {\n snapshot: input.target.initialSnapshot.snapshot,\n textSnapshot: input.target.initialSnapshot,\n uri,\n version,\n versionUri: version === null ? null : uri,\n }\n}\n\nfunction simulateSegment(\n input: WorkspaceTextReplayInput,\n state: ReplayState,\n segment: WorkspaceTextReplaySegmentInput,\n): SimulateSegmentResult {\n enterSegmentUri(input.provenance, state, segment.uri)\n const snapshotBefore = state.snapshot\n const textSnapshotBefore = state.textSnapshot\n const simulatedVersionBefore = state.version\n const steps: PreparedWorkspaceTextStep[] = []\n let logicalRevisionCount = 0\n\n for (const entry of segment.operations) {\n const result = simulateStep(input.provenance, state, segment, entry)\n if (!result.ok) return result\n if (result.effective) logicalRevisionCount += 1\n steps.push(result.step)\n }\n\n canonicalizeSegmentSnapshot(state, steps, snapshotBefore, textSnapshotBefore)\n return {\n ok: true,\n segment: Object.freeze({\n logicalRevisionCount,\n segmentIndex: segment.segmentIndex,\n simulatedVersionAfter: state.version,\n simulatedVersionBefore,\n snapshotAfter: state.snapshot,\n snapshotBefore,\n steps: Object.freeze(steps),\n uri: segment.uri,\n }),\n }\n}\n\nfunction enterSegmentUri(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n uri: string,\n): void {\n if (state.uri === uri) return\n state.uri = uri\n state.versionUri = null\n\n const mapped = exactProvenance(provenance, uri, state.textSnapshot)\n if (!validProvenanceVersion(mapped)) return\n if (state.version !== null && state.version !== mapped.version) return\n state.version = mapped.version\n state.versionUri = uri\n}\n\nfunction simulateStep(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n segment: WorkspaceTextReplaySegmentInput,\n entry: WorkspaceTextReplaySegmentInput['operations'][number],\n): SimulateStepResult {\n if (entry.operation.uri !== segment.uri) {\n return replayFailed(\n 'invalid-workspace-edit',\n 'Text operation URI does not match its replay segment',\n entry.operationIndex,\n )\n }\n\n const versionFailure = validateOperationVersion(provenance, state, entry)\n if (versionFailure) return { error: versionFailure, ok: false }\n const converted = convertWorkspaceTextBatch(\n state.snapshot,\n entry.operation.edits,\n entry.operationIndex,\n )\n if (!converted.ok) return converted\n\n const snapshotBefore = state.snapshot\n const candidate = applyBatchToPieceTable(snapshotBefore, converted.value.applicationEdits)\n const effective = !pieceTableSnapshotsHaveSameText(snapshotBefore, candidate)\n state.snapshot = effective ? candidate : snapshotBefore\n if (effective) state.textSnapshot = createDocumentTextSnapshot(state.snapshot)\n\n const versionAdvanceFailure = advanceSimulatedVersion(state, effective, entry.operationIndex)\n if (versionAdvanceFailure) return { error: versionAdvanceFailure, ok: false }\n return {\n effective,\n ok: true,\n step: Object.freeze({\n edits: converted.value.preparedEdits,\n operationIndex: entry.operationIndex,\n snapshotAfter: state.snapshot,\n snapshotBefore,\n uri: segment.uri,\n }),\n }\n}\n\nfunction validateOperationVersion(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n entry: WorkspaceTextReplaySegmentInput['operations'][number],\n): WorkspaceEditFailure | null {\n const declared = entry.operation.version\n if (declared === null) return null\n if (!Number.isSafeInteger(declared)) {\n return failure('version-mismatch', 'Text document version must be a safe integer', {\n operationIndex: entry.operationIndex,\n })\n }\n\n const lineageFailure = establishVersionLineage(provenance, state, entry)\n if (lineageFailure) return lineageFailure\n if (state.version === declared) return null\n return failure('version-mismatch', 'Text document version does not match replay provenance', {\n operationIndex: entry.operationIndex,\n })\n}\n\nfunction establishVersionLineage(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n entry: WorkspaceTextReplaySegmentInput['operations'][number],\n): WorkspaceEditFailure | null {\n if (state.versionUri === entry.operation.uri && state.version !== null) return null\n\n const mapped = exactProvenance(provenance, entry.operation.uri, state.textSnapshot)\n if (!validProvenanceVersion(mapped)) {\n return failure('version-mismatch', 'No exact lane provenance exists for this text snapshot', {\n operationIndex: entry.operationIndex,\n })\n }\n if (state.version !== null && state.version !== mapped.version) {\n return failure('version-mismatch', 'URI provenance does not continue the simulated version', {\n operationIndex: entry.operationIndex,\n })\n }\n\n state.version = mapped.version\n state.versionUri = entry.operation.uri\n return null\n}\n\nfunction advanceSimulatedVersion(\n state: ReplayState,\n effective: boolean,\n operationIndex: number,\n): WorkspaceEditFailure | null {\n if (!effective || state.version === null) return null\n if (!Number.isSafeInteger(state.version + 1)) {\n return failure('version-mismatch', 'Simulated text document version overflowed', {\n operationIndex,\n })\n }\n state.version += 1\n return null\n}\n\nfunction convertWorkspaceTextBatch(\n snapshot: PieceTableSnapshot,\n edits: readonly ParsedWorkspaceTextEdit[],\n operationIndex: number,\n): ConvertWorkspaceTextBatchResult {\n const converted: IndexedPreparedWorkspaceTextEdit[] = []\n for (let editIndex = 0; editIndex < edits.length; editIndex += 1) {\n const result = convertWorkspaceTextEdit(snapshot, edits[editIndex]!, operationIndex, editIndex)\n if (!result.ok) return result\n converted.push({ edit: result.value, editIndex })\n }\n\n const sorted = converted.toSorted(compareIndexedEdits)\n const conflict = textBatchConflict(sorted, operationIndex)\n if (conflict) return { error: conflict, ok: false }\n\n const effective = sorted.filter(({ edit }) => edit.from !== edit.to || edit.text.length > 0)\n const snapped = snapPreparedTextEdits(snapshot, effective, operationIndex)\n if (!snapped.ok) return snapped\n\n return {\n ok: true,\n value: Object.freeze({\n applicationEdits: Object.freeze(snapped.value.map(textEditWithoutAnnotation)),\n preparedEdits: snapped.value,\n }),\n }\n}\n\nfunction convertWorkspaceTextEdit(\n snapshot: PieceTableSnapshot,\n edit: ParsedWorkspaceTextEdit,\n operationIndex: number,\n editIndex: number,\n):\n | { readonly ok: true; readonly value: PreparedWorkspaceTextEdit }\n | { readonly error: WorkspaceEditFailure; readonly ok: false } {\n const from = strictPositionOffset(snapshot, edit.range.start)\n if (from === null) return invalidPosition(operationIndex, editIndex, 'Invalid range start')\n const to = strictPositionOffset(snapshot, edit.range.end)\n if (to === null) return invalidPosition(operationIndex, editIndex, 'Invalid range end')\n if (from > to) {\n return replayFailed('reversed-range', 'Text edit range is reversed', operationIndex, editIndex)\n }\n\n return {\n ok: true,\n value: Object.freeze({\n ...(edit.annotationId === undefined ? {} : { annotationId: edit.annotationId }),\n from,\n text: normalizeInsertedText(edit.newText),\n to,\n }),\n }\n}\n\nfunction strictPositionOffset(\n snapshot: PieceTableSnapshot,\n position: ParsedWorkspacePosition,\n): number | null {\n if (!Number.isInteger(position.line) || position.line < 0) return null\n if (!Number.isInteger(position.character) || position.character < 0) return null\n\n const offset = pointToOffset(snapshot, { column: position.character, row: position.line })\n const roundTrip = offsetToPoint(snapshot, offset)\n if (roundTrip.row !== position.line || roundTrip.column !== position.character) return null\n return offset\n}\n\nfunction textBatchConflict(\n edits: readonly IndexedPreparedWorkspaceTextEdit[],\n operationIndex: number,\n): WorkspaceEditFailure | null {\n let previous: IndexedPreparedWorkspaceTextEdit | null = null\n for (const current of edits) {\n const conflict = conflictWithPrevious(previous, current, operationIndex)\n if (conflict) return conflict\n if (!previous || current.edit.to > previous.edit.to) previous = current\n }\n return null\n}\n\nfunction conflictWithPrevious(\n previous: IndexedPreparedWorkspaceTextEdit | null,\n current: IndexedPreparedWorkspaceTextEdit,\n operationIndex: number,\n): WorkspaceEditFailure | null {\n if (!previous) return null\n const previousIsInsert = previous.edit.from === previous.edit.to\n const currentIsInsert = current.edit.from === current.edit.to\n if (previousIsInsert && currentIsInsert && previous.edit.from === current.edit.from) {\n return failure('ambiguous-inserts', 'Coincident inserts have no defined protocol order', {\n editIndex: current.editIndex,\n operationIndex,\n })\n }\n if (current.edit.from >= previous.edit.to) return null\n return failure('overlapping-edits', 'Text edit ranges overlap', {\n editIndex: current.editIndex,\n operationIndex,\n })\n}\n\nfunction snapPreparedTextEdits(\n snapshot: PieceTableSnapshot,\n edits: readonly IndexedPreparedWorkspaceTextEdit[],\n operationIndex: number,\n): SnapPreparedTextEditsResult {\n const boundaries = batchBoundaryCounts(edits)\n const snapped = edits.map(({ edit, editIndex }) => ({\n edit: snapPreparedTextEdit(snapshot, edit, boundaries),\n editIndex,\n }))\n return mergeSnappedPreparedTextEdits(snapped, operationIndex)\n}\n\nfunction mergeSnappedPreparedTextEdits(\n edits: readonly IndexedPreparedWorkspaceTextEdit[],\n operationIndex: number,\n): SnapPreparedTextEditsResult {\n const merged: PreparedWorkspaceTextEdit[] = []\n for (const current of edits) {\n const previous = merged.at(-1)\n if (!previous || current.edit.from >= previous.to) {\n merged.push(current.edit)\n continue\n }\n if (previous.annotationId !== current.edit.annotationId) {\n return replayFailed(\n 'overlapping-edits',\n 'Surrogate snapping cannot merge edits with different annotation ids',\n operationIndex,\n current.editIndex,\n )\n }\n\n merged[merged.length - 1] = Object.freeze({\n ...(previous.annotationId === undefined ? {} : { annotationId: previous.annotationId }),\n from: previous.from,\n text: previous.text + current.edit.text,\n to: Math.max(previous.to, current.edit.to),\n })\n }\n return { ok: true, value: Object.freeze(merged) }\n}\n\nfunction snapPreparedTextEdit(\n snapshot: PieceTableSnapshot,\n edit: PreparedWorkspaceTextEdit,\n boundaries: BoundaryCounts,\n): PreparedWorkspaceTextEdit {\n const snapStart = orphansSurrogateAtStart(snapshot, edit, boundaries)\n const snapEnd = orphansSurrogateAtEnd(snapshot, edit, boundaries)\n if (!snapStart && !snapEnd) return edit\n\n const collapsed = edit.from === edit.to\n let from = edit.from\n let to = edit.to\n if (collapsed || snapStart) from -= 1\n if (collapsed) to -= 1\n if (!collapsed && snapEnd) to += 1\n return Object.freeze({ ...edit, from, to })\n}\n\nfunction orphansSurrogateAtStart(\n snapshot: PieceTableSnapshot,\n edit: PreparedWorkspaceTextEdit,\n boundaries: BoundaryCounts,\n): boolean {\n if (!splitsSurrogatePair(snapshot, edit.from)) return false\n if ((boundaries.ends.get(edit.from) ?? 0) > 0) return false\n return !isLowSurrogate(edit.text.charCodeAt(0))\n}\n\nfunction orphansSurrogateAtEnd(\n snapshot: PieceTableSnapshot,\n edit: PreparedWorkspaceTextEdit,\n boundaries: BoundaryCounts,\n): boolean {\n if (!splitsSurrogatePair(snapshot, edit.to)) return false\n if ((boundaries.starts.get(edit.to) ?? 0) > 0) return false\n return !isHighSurrogate(edit.text.charCodeAt(edit.text.length - 1))\n}\n\nfunction splitsSurrogatePair(snapshot: PieceTableSnapshot, offset: number): boolean {\n if (offset <= 0 || offset >= snapshot.length) return false\n const pair = readPieceTableTextRange(snapshot, offset - 1, offset + 1)\n return isHighSurrogate(pair.charCodeAt(0)) && isLowSurrogate(pair.charCodeAt(1))\n}\n\nfunction batchBoundaryCounts(edits: readonly IndexedPreparedWorkspaceTextEdit[]): BoundaryCounts {\n const starts = new Map<number, number>()\n const ends = new Map<number, number>()\n for (const { edit } of edits) {\n if (edit.from === edit.to) continue\n starts.set(edit.from, (starts.get(edit.from) ?? 0) + 1)\n ends.set(edit.to, (ends.get(edit.to) ?? 0) + 1)\n }\n return { ends, starts }\n}\n\nfunction canonicalizeSegmentSnapshot(\n state: ReplayState,\n steps: PreparedWorkspaceTextStep[],\n snapshotBefore: PieceTableSnapshot,\n textSnapshotBefore: TextSnapshot,\n): void {\n if (!pieceTableSnapshotsHaveSameText(snapshotBefore, state.snapshot)) return\n state.snapshot = snapshotBefore\n state.textSnapshot = textSnapshotBefore\n\n const last = steps.at(-1)\n if (!last) return\n steps[steps.length - 1] = Object.freeze({ ...last, snapshotAfter: snapshotBefore })\n}\n\nfunction sequenceInput(\n logicalRevisionScope: DocumentLogicalRevisionScope,\n segment: SimulatedWorkspaceTextSegment,\n) {\n const edit = diffPieceTableSnapshots(segment.snapshotBefore, segment.snapshotAfter)\n return {\n edits: edit ? [edit] : [],\n logicalRevisionCount: segment.logicalRevisionCount,\n logicalRevisionScope,\n }\n}\n\nfunction sequenceMatchesTarget(\n sequence: PreparedDocumentTransactionSequence,\n target: WorkspaceTextReplayTarget,\n): boolean {\n return (\n sequence.expectedRevision === target.expectedRevision &&\n sequence.snapshotBefore === target.initialSnapshot.snapshot\n )\n}\n\nfunction bindNoOpSegments(\n simulated: readonly SimulatedWorkspaceTextSegment[],\n snapshot: PieceTableSnapshot,\n): readonly PreparedWorkspaceTextSegment[] {\n return Object.freeze(simulated.map((segment) => bindSegment(segment, null, snapshot, snapshot)))\n}\n\nfunction bindPreparedSegments(\n simulated: readonly SimulatedWorkspaceTextSegment[],\n sequence: PreparedDocumentTransactionSequence,\n): readonly PreparedWorkspaceTextSegment[] {\n const bound: PreparedWorkspaceTextSegment[] = []\n let sequenceSegmentIndex = 0\n let snapshot = sequence.snapshotBefore\n for (const segment of simulated) {\n if (segment.logicalRevisionCount === 0) {\n bound.push(bindSegment(segment, null, snapshot, snapshot))\n continue\n }\n\n const prepared = sequence.segments[sequenceSegmentIndex]!\n bound.push(\n bindSegment(segment, sequenceSegmentIndex, prepared.snapshotBefore, prepared.snapshotAfter),\n )\n snapshot = prepared.snapshotAfter\n sequenceSegmentIndex += 1\n }\n return Object.freeze(bound)\n}\n\nfunction bindSegment(\n segment: SimulatedWorkspaceTextSegment,\n sequenceSegmentIndex: number | null,\n snapshotBefore: PieceTableSnapshot,\n snapshotAfter: PieceTableSnapshot,\n): PreparedWorkspaceTextSegment {\n return Object.freeze({\n ...segment,\n sequenceSegmentIndex,\n snapshotAfter,\n snapshotBefore,\n steps: bindStepBoundaries(segment.steps, snapshotBefore, snapshotAfter),\n })\n}\n\nfunction bindStepBoundaries(\n steps: readonly PreparedWorkspaceTextStep[],\n snapshotBefore: PieceTableSnapshot,\n snapshotAfter: PieceTableSnapshot,\n): readonly PreparedWorkspaceTextStep[] {\n if (steps.length === 0) return steps\n const lastIndex = steps.length - 1\n return Object.freeze(\n steps.map((step, index) =>\n Object.freeze({\n ...step,\n snapshotAfter: index === lastIndex ? snapshotAfter : step.snapshotAfter,\n snapshotBefore: index === 0 ? snapshotBefore : step.snapshotBefore,\n }),\n ),\n )\n}\n\nfunction exactProvenance(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n uri: string,\n textSnapshot: TextSnapshot,\n): WorkspaceTextDocumentProvenance | null {\n return (\n provenance.find((entry) => entry.uri === uri && entry.textSnapshot === textSnapshot) ?? null\n )\n}\n\nfunction validProvenanceVersion(\n provenance: WorkspaceTextDocumentProvenance | null,\n): provenance is WorkspaceTextDocumentProvenance {\n return provenance !== null && Number.isSafeInteger(provenance.version)\n}\n\nfunction textEditWithoutAnnotation(edit: PreparedWorkspaceTextEdit): TextEdit {\n return Object.freeze({ from: edit.from, text: edit.text, to: edit.to })\n}\n\nfunction compareIndexedEdits(\n left: IndexedPreparedWorkspaceTextEdit,\n right: IndexedPreparedWorkspaceTextEdit,\n): number {\n return left.edit.from - right.edit.from || left.edit.to - right.edit.to\n}\n\nfunction normalizeInsertedText(text: string): string {\n return /[\\r\\u2028\\u2029]/.test(text) ? text.replace(/\\r\\n|[\\r\\u2028\\u2029]/g, '\\n') : text\n}\n\nfunction isHighSurrogate(code: number): boolean {\n return code >= 0xd800 && code <= 0xdbff\n}\n\nfunction isLowSurrogate(code: number): boolean {\n return code >= 0xdc00 && code <= 0xdfff\n}\n\nfunction invalidPosition(\n operationIndex: number,\n editIndex: number,\n reason: string,\n): { readonly error: WorkspaceEditFailure; readonly ok: false } {\n return replayFailed('invalid-position', reason, operationIndex, editIndex)\n}\n\nfunction replayFailed(\n code: WorkspaceEditFailureCode,\n reason: string,\n operationIndex?: number,\n editIndex?: number,\n): { readonly error: WorkspaceEditFailure; readonly ok: false } {\n return {\n error: failure(code, reason, { editIndex, operationIndex }),\n ok: false,\n }\n}\n\nfunction failure(\n code: WorkspaceEditFailureCode,\n reason: string,\n indices: { readonly editIndex?: number; readonly operationIndex?: number } = {},\n): WorkspaceEditFailure {\n return Object.freeze({\n code,\n reason,\n ...(indices.operationIndex === undefined ? {} : { operationIndex: indices.operationIndex }),\n ...(indices.editIndex === undefined ? {} : { editIndex: indices.editIndex }),\n })\n}\n"],"mappings":";;AAuIA,SAAgB,2BACd,OACkC;CAClC,MAAM,gBAAgB,mBAAmB,MAAM,MAAM;CACrD,IAAI,eAAe,OAAO;EAAE,OAAO;EAAe,IAAI;CAAM;CAE5D,MAAM,QAAQ,mBAAmB,KAAK;CACtC,MAAM,YAA6C,CAAC;CACpD,KAAK,MAAM,WAAW,MAAM,UAAU;EACpC,MAAM,SAAS,gBAAgB,OAAO,OAAO,OAAO;EACpD,IAAI,CAAC,OAAO,IAAI,OAAO;EACvB,UAAU,KAAK,OAAO,OAAO;CAC/B;CAEA,MAAM,YAAY,UAAU,QAAQ,YAAY,QAAQ,uBAAuB,CAAC;CAChF,IAAI,UAAU,WAAW,GACvB,OAAO;EACL,IAAI;EACJ,UAAU,iBAAiB,WAAW,MAAM,OAAO,gBAAgB,QAAQ;EAC3E,UAAU;CACZ;CAGF,MAAM,WAAW,mCACf,MAAM,OAAO,QACb,UAAU,KAAK,YAAY,cAAc,MAAM,sBAAsB,OAAO,CAAC,CAC/E;CACA,IAAI,CAAC,sBAAsB,UAAU,MAAM,MAAM,GAC/C,OAAO,aAAa,kBAAkB,+CAA+C;CAGvF,OAAO;EACL,IAAI;EACJ,UAAU,qBAAqB,WAAW,QAAQ;EAClD;CACF;AACF;AAEA,SAAS,mBAAmB,QAAgE;CAC1F,IAAI,OAAO,OAAO,YAAY,MAAM,OAAO,kBACzC,OAAO,QAAQ,kBAAkB,wDAAwD;CAE3F,IAAI,OAAO,OAAO,YAAY,MAAM,OAAO,gBAAgB,UACzD,OAAO,QAAQ,kBAAkB,wDAAwD;CAE3F,OAAO;AACT;AAEA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,MAAM,MAAM,SAAS,EAAE,EAAE,OAAO;CACtC,MAAM,aAAa,MACf,gBAAgB,MAAM,YAAY,KAAK,MAAM,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,gBACA,WAC8D;CAC9D,OAAO;EACL,OAAO,QAAQ,MAAM,QAAQ;GAAE;GAAW;EAAe,CAAC;EAC1D,IAAI;CACN;AACF;AAEA,SAAS,QACP,MACA,QACA,UAA6E,CAAC,GACxD;CACtB,OAAO,OAAO,OAAO;EACnB;EACA;EACA,GAAI,QAAQ,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,QAAQ,eAAe;EACzF,GAAI,QAAQ,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,QAAQ,UAAU;CAC5E,CAAC;AACH"}
1
+ {"version":3,"file":"workspaceTextEdits.js","names":[],"sources":["../src/workspaceTextEdits.ts"],"sourcesContent":["import {\n applyBatchToPieceTable,\n createDocumentTextSnapshot,\n diffPieceTableSnapshots,\n offsetToPoint,\n pieceTableSnapshotsHaveSameText,\n pointToOffset,\n prepareDocumentTransactionSequence,\n readPieceTableTextRange,\n} from '@singapore-editor/core/document'\nimport type {\n DocumentLogicalRevisionScope,\n DocumentSyncPoint,\n DocumentTextSnapshot,\n EditorTextBuffer,\n PieceTableSnapshot,\n PreparedDocumentTransactionSequence,\n TextEdit,\n TextSnapshot,\n} from '@singapore-editor/core/document'\n\nimport type { LspTextSnapshot } from '@singapore-editor/lsp'\n\nimport type {\n ParsedWorkspacePosition,\n ParsedWorkspaceTextEdit,\n WorkspaceEditFailure,\n WorkspaceEditFailureCode,\n WorkspaceEditOperation,\n} from './workspaceEdit'\n\nexport type WorkspaceTextDocumentProvenance = {\n readonly textSnapshot: LspTextSnapshot\n readonly uri: string\n readonly version: number\n readonly sourceRevision: number\n readonly sourceSegment: object\n}\n\nexport type WorkspaceTextReplaySegmentInput = {\n readonly operations: readonly {\n readonly operation: Extract<WorkspaceEditOperation, { kind: 'text-document' }>\n readonly operationIndex: number\n }[]\n readonly segmentIndex: number\n readonly uri: string\n}\n\nexport type WorkspaceTextReplayTarget = {\n readonly buffer: EditorTextBuffer\n readonly expectedRevision: number\n readonly initialSnapshot: DocumentTextSnapshot\n readonly initialSyncPoint: DocumentSyncPoint\n}\n\nexport type WorkspaceTextReplayInput = {\n readonly logicalRevisionScope: DocumentLogicalRevisionScope\n readonly provenance: readonly WorkspaceTextDocumentProvenance[]\n readonly segments: readonly WorkspaceTextReplaySegmentInput[]\n readonly target: WorkspaceTextReplayTarget\n}\n\nexport type PreparedWorkspaceTextEdit = TextEdit & {\n readonly annotationId?: string\n}\n\nexport type PreparedWorkspaceTextStep = {\n readonly edits: readonly PreparedWorkspaceTextEdit[]\n readonly operationIndex: number\n readonly snapshotAfter: PieceTableSnapshot\n readonly snapshotBefore: PieceTableSnapshot\n readonly uri: string\n}\n\nexport type PreparedWorkspaceTextSegment = {\n readonly logicalRevisionCount: number\n readonly segmentIndex: number\n readonly sequenceSegmentIndex: number | null\n readonly simulatedVersionAfter: number | null\n readonly simulatedVersionBefore: number | null\n readonly snapshotAfter: PieceTableSnapshot\n readonly snapshotBefore: PieceTableSnapshot\n readonly steps: readonly PreparedWorkspaceTextStep[]\n readonly uri: string\n}\n\nexport type PrepareWorkspaceTextReplayResult =\n | {\n readonly ok: true\n readonly segments: readonly PreparedWorkspaceTextSegment[]\n readonly sequence: PreparedDocumentTransactionSequence | null\n }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype ReplayState = {\n snapshot: PieceTableSnapshot\n textSnapshot: TextSnapshot\n uri: string | null\n version: number | null\n versionUri: string | null\n sourcePoint: Pick<DocumentSyncPoint, 'revision' | 'segment'> | null\n}\n\ntype SimulatedWorkspaceTextSegment = Omit<PreparedWorkspaceTextSegment, 'sequenceSegmentIndex'>\n\ntype SimulateSegmentResult =\n | { readonly ok: true; readonly segment: SimulatedWorkspaceTextSegment }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype SimulateStepResult =\n | {\n readonly effective: boolean\n readonly ok: true\n readonly step: PreparedWorkspaceTextStep\n }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype ConvertedWorkspaceTextBatch = {\n readonly applicationEdits: readonly TextEdit[]\n readonly preparedEdits: readonly PreparedWorkspaceTextEdit[]\n}\n\ntype ConvertWorkspaceTextBatchResult =\n | { readonly ok: true; readonly value: ConvertedWorkspaceTextBatch }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype SnapPreparedTextEditsResult =\n | { readonly ok: true; readonly value: readonly PreparedWorkspaceTextEdit[] }\n | { readonly error: WorkspaceEditFailure; readonly ok: false }\n\ntype IndexedPreparedWorkspaceTextEdit = {\n readonly edit: PreparedWorkspaceTextEdit\n readonly editIndex: number\n}\n\ntype BoundaryCounts = {\n readonly ends: ReadonlyMap<number, number>\n readonly starts: ReadonlyMap<number, number>\n}\n\nexport function prepareWorkspaceTextReplay(\n input: WorkspaceTextReplayInput,\n): PrepareWorkspaceTextReplayResult {\n const targetFailure = targetGuardFailure(input.target)\n if (targetFailure) return { error: targetFailure, ok: false }\n\n const state = initialReplayState(input)\n const simulated: SimulatedWorkspaceTextSegment[] = []\n for (const segment of input.segments) {\n const result = simulateSegment(input, state, segment)\n if (!result.ok) return result\n simulated.push(result.segment)\n }\n\n const effective = simulated.filter((segment) => segment.logicalRevisionCount > 0)\n if (effective.length === 0) {\n return {\n ok: true,\n segments: bindNoOpSegments(simulated, input.target.initialSnapshot.snapshot),\n sequence: null,\n }\n }\n\n const sequence = prepareDocumentTransactionSequence(\n input.target.buffer,\n effective.map((segment) => sequenceInput(input.logicalRevisionScope, segment)),\n )\n if (!sequenceMatchesTarget(sequence, input.target)) {\n return replayFailed('snapshot-drift', 'Target buffer changed before replay was bound')\n }\n\n return {\n ok: true,\n segments: bindPreparedSegments(simulated, sequence),\n sequence,\n }\n}\n\nfunction targetGuardFailure(target: WorkspaceTextReplayTarget): WorkspaceEditFailure | null {\n if (target.buffer.getRevision() !== target.expectedRevision) {\n return failure('snapshot-drift', 'Target buffer revision does not match the replay guard')\n }\n if (target.buffer.getSnapshot() !== target.initialSnapshot.snapshot) {\n return failure('snapshot-drift', 'Target buffer snapshot does not match the replay guard')\n }\n const point = target.buffer.getDocumentSyncPoint()\n const captured = target.initialSyncPoint\n if (\n point.segment !== captured.segment ||\n point.revision !== captured.revision ||\n point.textVersion !== captured.textVersion\n ) {\n return failure('snapshot-drift', 'Target source point does not match the replay guard')\n }\n return null\n}\n\nfunction initialReplayState(input: WorkspaceTextReplayInput): ReplayState {\n const uri = input.segments[0]?.uri ?? null\n const provenance = uri\n ? exactProvenance(input.provenance, uri, input.target.initialSyncPoint)\n : null\n const version = validProvenanceVersion(provenance) ? provenance.version : null\n return {\n snapshot: input.target.initialSnapshot.snapshot,\n textSnapshot: input.target.initialSnapshot,\n uri,\n version,\n versionUri: version === null ? null : uri,\n sourcePoint: input.target.initialSyncPoint,\n }\n}\n\nfunction simulateSegment(\n input: WorkspaceTextReplayInput,\n state: ReplayState,\n segment: WorkspaceTextReplaySegmentInput,\n): SimulateSegmentResult {\n enterSegmentUri(input.provenance, state, segment.uri)\n const snapshotBefore = state.snapshot\n const textSnapshotBefore = state.textSnapshot\n const sourcePointBefore = state.sourcePoint\n const simulatedVersionBefore = state.version\n const steps: PreparedWorkspaceTextStep[] = []\n let logicalRevisionCount = 0\n\n for (const entry of segment.operations) {\n const result = simulateStep(input.provenance, state, segment, entry)\n if (!result.ok) return result\n if (result.effective) logicalRevisionCount += 1\n steps.push(result.step)\n }\n\n canonicalizeSegmentSnapshot(state, steps, snapshotBefore, textSnapshotBefore, sourcePointBefore)\n return {\n ok: true,\n segment: Object.freeze({\n logicalRevisionCount,\n segmentIndex: segment.segmentIndex,\n simulatedVersionAfter: state.version,\n simulatedVersionBefore,\n snapshotAfter: state.snapshot,\n snapshotBefore,\n steps: Object.freeze(steps),\n uri: segment.uri,\n }),\n }\n}\n\nfunction enterSegmentUri(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n uri: string,\n): void {\n if (state.uri === uri) return\n state.uri = uri\n state.versionUri = null\n\n const mapped = exactProvenance(provenance, uri, state.sourcePoint)\n if (!validProvenanceVersion(mapped)) return\n if (state.version !== null && state.version !== mapped.version) return\n state.version = mapped.version\n state.versionUri = uri\n}\n\nfunction simulateStep(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n segment: WorkspaceTextReplaySegmentInput,\n entry: WorkspaceTextReplaySegmentInput['operations'][number],\n): SimulateStepResult {\n if (entry.operation.uri !== segment.uri) {\n return replayFailed(\n 'invalid-workspace-edit',\n 'Text operation URI does not match its replay segment',\n entry.operationIndex,\n )\n }\n\n const versionFailure = validateOperationVersion(provenance, state, entry)\n if (versionFailure) return { error: versionFailure, ok: false }\n const converted = convertWorkspaceTextBatch(\n state.snapshot,\n entry.operation.edits,\n entry.operationIndex,\n )\n if (!converted.ok) return converted\n\n const snapshotBefore = state.snapshot\n const candidate = applyBatchToPieceTable(snapshotBefore, converted.value.applicationEdits)\n const effective = !pieceTableSnapshotsHaveSameText(snapshotBefore, candidate)\n state.snapshot = effective ? candidate : snapshotBefore\n if (effective) {\n state.textSnapshot = createDocumentTextSnapshot(state.snapshot)\n state.sourcePoint = null\n }\n\n const versionAdvanceFailure = advanceSimulatedVersion(state, effective, entry.operationIndex)\n if (versionAdvanceFailure) return { error: versionAdvanceFailure, ok: false }\n return {\n effective,\n ok: true,\n step: Object.freeze({\n edits: converted.value.preparedEdits,\n operationIndex: entry.operationIndex,\n snapshotAfter: state.snapshot,\n snapshotBefore,\n uri: segment.uri,\n }),\n }\n}\n\nfunction validateOperationVersion(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n entry: WorkspaceTextReplaySegmentInput['operations'][number],\n): WorkspaceEditFailure | null {\n const declared = entry.operation.version\n if (declared === null) return null\n if (!Number.isSafeInteger(declared)) {\n return failure('version-mismatch', 'Text document version must be a safe integer', {\n operationIndex: entry.operationIndex,\n })\n }\n\n const lineageFailure = establishVersionLineage(provenance, state, entry)\n if (lineageFailure) return lineageFailure\n if (state.version === declared) return null\n return failure('version-mismatch', 'Text document version does not match replay provenance', {\n operationIndex: entry.operationIndex,\n })\n}\n\nfunction establishVersionLineage(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n state: ReplayState,\n entry: WorkspaceTextReplaySegmentInput['operations'][number],\n): WorkspaceEditFailure | null {\n if (state.versionUri === entry.operation.uri && state.version !== null) return null\n\n const mapped = exactProvenance(provenance, entry.operation.uri, state.sourcePoint)\n if (!validProvenanceVersion(mapped)) {\n return failure('version-mismatch', 'No exact lane provenance exists for this text snapshot', {\n operationIndex: entry.operationIndex,\n })\n }\n if (state.version !== null && state.version !== mapped.version) {\n return failure('version-mismatch', 'URI provenance does not continue the simulated version', {\n operationIndex: entry.operationIndex,\n })\n }\n\n state.version = mapped.version\n state.versionUri = entry.operation.uri\n return null\n}\n\nfunction advanceSimulatedVersion(\n state: ReplayState,\n effective: boolean,\n operationIndex: number,\n): WorkspaceEditFailure | null {\n if (!effective || state.version === null) return null\n if (!Number.isSafeInteger(state.version + 1)) {\n return failure('version-mismatch', 'Simulated text document version overflowed', {\n operationIndex,\n })\n }\n state.version += 1\n return null\n}\n\nfunction convertWorkspaceTextBatch(\n snapshot: PieceTableSnapshot,\n edits: readonly ParsedWorkspaceTextEdit[],\n operationIndex: number,\n): ConvertWorkspaceTextBatchResult {\n const converted: IndexedPreparedWorkspaceTextEdit[] = []\n for (let editIndex = 0; editIndex < edits.length; editIndex += 1) {\n const result = convertWorkspaceTextEdit(snapshot, edits[editIndex]!, operationIndex, editIndex)\n if (!result.ok) return result\n converted.push({ edit: result.value, editIndex })\n }\n\n const sorted = converted.sort(compareIndexedEdits)\n const conflict = textBatchConflict(sorted, operationIndex)\n if (conflict) return { error: conflict, ok: false }\n\n const effective = sorted.filter(({ edit }) => edit.from !== edit.to || edit.text.length > 0)\n const snapped = snapPreparedTextEdits(snapshot, effective, operationIndex)\n if (!snapped.ok) return snapped\n\n return {\n ok: true,\n value: Object.freeze({\n applicationEdits: Object.freeze(snapped.value.map(textEditWithoutAnnotation)),\n preparedEdits: snapped.value,\n }),\n }\n}\n\nfunction convertWorkspaceTextEdit(\n snapshot: PieceTableSnapshot,\n edit: ParsedWorkspaceTextEdit,\n operationIndex: number,\n editIndex: number,\n):\n | { readonly ok: true; readonly value: PreparedWorkspaceTextEdit }\n | { readonly error: WorkspaceEditFailure; readonly ok: false } {\n const from = strictPositionOffset(snapshot, edit.range.start)\n if (from === null) return invalidPosition(operationIndex, editIndex, 'Invalid range start')\n const to = strictPositionOffset(snapshot, edit.range.end)\n if (to === null) return invalidPosition(operationIndex, editIndex, 'Invalid range end')\n if (from > to) {\n return replayFailed('reversed-range', 'Text edit range is reversed', operationIndex, editIndex)\n }\n\n return {\n ok: true,\n value: Object.freeze({\n ...(edit.annotationId === undefined ? {} : { annotationId: edit.annotationId }),\n from,\n text: normalizeInsertedText(edit.newText),\n to,\n }),\n }\n}\n\nfunction strictPositionOffset(\n snapshot: PieceTableSnapshot,\n position: ParsedWorkspacePosition,\n): number | null {\n if (!Number.isInteger(position.line) || position.line < 0) return null\n if (!Number.isInteger(position.character) || position.character < 0) return null\n\n const offset = pointToOffset(snapshot, { column: position.character, row: position.line })\n const roundTrip = offsetToPoint(snapshot, offset)\n if (roundTrip.row !== position.line || roundTrip.column !== position.character) return null\n return offset\n}\n\nfunction textBatchConflict(\n edits: readonly IndexedPreparedWorkspaceTextEdit[],\n operationIndex: number,\n): WorkspaceEditFailure | null {\n let previous: IndexedPreparedWorkspaceTextEdit | null = null\n for (const current of edits) {\n const conflict = conflictWithPrevious(previous, current, operationIndex)\n if (conflict) return conflict\n if (!previous || current.edit.to > previous.edit.to) previous = current\n }\n return null\n}\n\nfunction conflictWithPrevious(\n previous: IndexedPreparedWorkspaceTextEdit | null,\n current: IndexedPreparedWorkspaceTextEdit,\n operationIndex: number,\n): WorkspaceEditFailure | null {\n if (!previous) return null\n const previousIsInsert = previous.edit.from === previous.edit.to\n const currentIsInsert = current.edit.from === current.edit.to\n if (previousIsInsert && currentIsInsert && previous.edit.from === current.edit.from) {\n return failure('ambiguous-inserts', 'Coincident inserts have no defined protocol order', {\n editIndex: current.editIndex,\n operationIndex,\n })\n }\n if (current.edit.from >= previous.edit.to) return null\n return failure('overlapping-edits', 'Text edit ranges overlap', {\n editIndex: current.editIndex,\n operationIndex,\n })\n}\n\nfunction snapPreparedTextEdits(\n snapshot: PieceTableSnapshot,\n edits: readonly IndexedPreparedWorkspaceTextEdit[],\n operationIndex: number,\n): SnapPreparedTextEditsResult {\n const boundaries = batchBoundaryCounts(edits)\n const snapped = edits.map(({ edit, editIndex }) => ({\n edit: snapPreparedTextEdit(snapshot, edit, boundaries),\n editIndex,\n }))\n return mergeSnappedPreparedTextEdits(snapped, operationIndex)\n}\n\nfunction mergeSnappedPreparedTextEdits(\n edits: readonly IndexedPreparedWorkspaceTextEdit[],\n operationIndex: number,\n): SnapPreparedTextEditsResult {\n const merged: PreparedWorkspaceTextEdit[] = []\n for (const current of edits) {\n const previous = merged.at(-1)\n if (!previous || current.edit.from >= previous.to) {\n merged.push(current.edit)\n continue\n }\n if (previous.annotationId !== current.edit.annotationId) {\n return replayFailed(\n 'overlapping-edits',\n 'Surrogate snapping cannot merge edits with different annotation ids',\n operationIndex,\n current.editIndex,\n )\n }\n\n merged[merged.length - 1] = Object.freeze({\n ...(previous.annotationId === undefined ? {} : { annotationId: previous.annotationId }),\n from: previous.from,\n text: previous.text + current.edit.text,\n to: Math.max(previous.to, current.edit.to),\n })\n }\n return { ok: true, value: Object.freeze(merged) }\n}\n\nfunction snapPreparedTextEdit(\n snapshot: PieceTableSnapshot,\n edit: PreparedWorkspaceTextEdit,\n boundaries: BoundaryCounts,\n): PreparedWorkspaceTextEdit {\n const snapStart = orphansSurrogateAtStart(snapshot, edit, boundaries)\n const snapEnd = orphansSurrogateAtEnd(snapshot, edit, boundaries)\n if (!snapStart && !snapEnd) return edit\n\n const collapsed = edit.from === edit.to\n let from = edit.from\n let to = edit.to\n if (collapsed || snapStart) from -= 1\n if (collapsed) to -= 1\n if (!collapsed && snapEnd) to += 1\n return Object.freeze({ ...edit, from, to })\n}\n\nfunction orphansSurrogateAtStart(\n snapshot: PieceTableSnapshot,\n edit: PreparedWorkspaceTextEdit,\n boundaries: BoundaryCounts,\n): boolean {\n if (!splitsSurrogatePair(snapshot, edit.from)) return false\n if ((boundaries.ends.get(edit.from) ?? 0) > 0) return false\n return !isLowSurrogate(edit.text.charCodeAt(0))\n}\n\nfunction orphansSurrogateAtEnd(\n snapshot: PieceTableSnapshot,\n edit: PreparedWorkspaceTextEdit,\n boundaries: BoundaryCounts,\n): boolean {\n if (!splitsSurrogatePair(snapshot, edit.to)) return false\n if ((boundaries.starts.get(edit.to) ?? 0) > 0) return false\n return !isHighSurrogate(edit.text.charCodeAt(edit.text.length - 1))\n}\n\nfunction splitsSurrogatePair(snapshot: PieceTableSnapshot, offset: number): boolean {\n if (offset <= 0 || offset >= snapshot.length) return false\n const pair = readPieceTableTextRange(snapshot, offset - 1, offset + 1)\n return isHighSurrogate(pair.charCodeAt(0)) && isLowSurrogate(pair.charCodeAt(1))\n}\n\nfunction batchBoundaryCounts(edits: readonly IndexedPreparedWorkspaceTextEdit[]): BoundaryCounts {\n const starts = new Map<number, number>()\n const ends = new Map<number, number>()\n for (const { edit } of edits) {\n if (edit.from === edit.to) continue\n starts.set(edit.from, (starts.get(edit.from) ?? 0) + 1)\n ends.set(edit.to, (ends.get(edit.to) ?? 0) + 1)\n }\n return { ends, starts }\n}\n\nfunction canonicalizeSegmentSnapshot(\n state: ReplayState,\n steps: PreparedWorkspaceTextStep[],\n snapshotBefore: PieceTableSnapshot,\n textSnapshotBefore: TextSnapshot,\n sourcePointBefore: ReplayState['sourcePoint'],\n): void {\n if (!pieceTableSnapshotsHaveSameText(snapshotBefore, state.snapshot)) return\n state.snapshot = snapshotBefore\n state.textSnapshot = textSnapshotBefore\n state.sourcePoint = sourcePointBefore\n\n const last = steps.at(-1)\n if (!last) return\n steps[steps.length - 1] = Object.freeze({ ...last, snapshotAfter: snapshotBefore })\n}\n\nfunction sequenceInput(\n logicalRevisionScope: DocumentLogicalRevisionScope,\n segment: SimulatedWorkspaceTextSegment,\n) {\n const edit = diffPieceTableSnapshots(segment.snapshotBefore, segment.snapshotAfter)\n return {\n edits: edit ? [edit] : [],\n logicalRevisionCount: segment.logicalRevisionCount,\n logicalRevisionScope,\n }\n}\n\nfunction sequenceMatchesTarget(\n sequence: PreparedDocumentTransactionSequence,\n target: WorkspaceTextReplayTarget,\n): boolean {\n return (\n sequence.expectedRevision === target.expectedRevision &&\n sequence.snapshotBefore === target.initialSnapshot.snapshot\n )\n}\n\nfunction bindNoOpSegments(\n simulated: readonly SimulatedWorkspaceTextSegment[],\n snapshot: PieceTableSnapshot,\n): readonly PreparedWorkspaceTextSegment[] {\n return Object.freeze(simulated.map((segment) => bindSegment(segment, null, snapshot, snapshot)))\n}\n\nfunction bindPreparedSegments(\n simulated: readonly SimulatedWorkspaceTextSegment[],\n sequence: PreparedDocumentTransactionSequence,\n): readonly PreparedWorkspaceTextSegment[] {\n const bound: PreparedWorkspaceTextSegment[] = []\n let sequenceSegmentIndex = 0\n let snapshot = sequence.snapshotBefore\n for (const segment of simulated) {\n if (segment.logicalRevisionCount === 0) {\n bound.push(bindSegment(segment, null, snapshot, snapshot))\n continue\n }\n\n const prepared = sequence.segments[sequenceSegmentIndex]!\n bound.push(\n bindSegment(segment, sequenceSegmentIndex, prepared.snapshotBefore, prepared.snapshotAfter),\n )\n snapshot = prepared.snapshotAfter\n sequenceSegmentIndex += 1\n }\n return Object.freeze(bound)\n}\n\nfunction bindSegment(\n segment: SimulatedWorkspaceTextSegment,\n sequenceSegmentIndex: number | null,\n snapshotBefore: PieceTableSnapshot,\n snapshotAfter: PieceTableSnapshot,\n): PreparedWorkspaceTextSegment {\n return Object.freeze({\n ...segment,\n sequenceSegmentIndex,\n snapshotAfter,\n snapshotBefore,\n steps: bindStepBoundaries(segment.steps, snapshotBefore, snapshotAfter),\n })\n}\n\nfunction bindStepBoundaries(\n steps: readonly PreparedWorkspaceTextStep[],\n snapshotBefore: PieceTableSnapshot,\n snapshotAfter: PieceTableSnapshot,\n): readonly PreparedWorkspaceTextStep[] {\n if (steps.length === 0) return steps\n const lastIndex = steps.length - 1\n return Object.freeze(\n steps.map((step, index) =>\n Object.freeze({\n ...step,\n snapshotAfter: index === lastIndex ? snapshotAfter : step.snapshotAfter,\n snapshotBefore: index === 0 ? snapshotBefore : step.snapshotBefore,\n }),\n ),\n )\n}\n\nfunction exactProvenance(\n provenance: readonly WorkspaceTextDocumentProvenance[],\n uri: string,\n point: ReplayState['sourcePoint'],\n): WorkspaceTextDocumentProvenance | null {\n if (!point) return null\n return (\n provenance.find(\n (entry) =>\n entry.uri === uri &&\n entry.sourceRevision === point.revision &&\n entry.sourceSegment === point.segment,\n ) ?? null\n )\n}\n\nfunction validProvenanceVersion(\n provenance: WorkspaceTextDocumentProvenance | null,\n): provenance is WorkspaceTextDocumentProvenance {\n return provenance !== null && Number.isSafeInteger(provenance.version)\n}\n\nfunction textEditWithoutAnnotation(edit: PreparedWorkspaceTextEdit): TextEdit {\n return Object.freeze({ from: edit.from, text: edit.text, to: edit.to })\n}\n\nfunction compareIndexedEdits(\n left: IndexedPreparedWorkspaceTextEdit,\n right: IndexedPreparedWorkspaceTextEdit,\n): number {\n return left.edit.from - right.edit.from || left.edit.to - right.edit.to\n}\n\nfunction normalizeInsertedText(text: string): string {\n return /[\\r\\u2028\\u2029]/.test(text) ? text.replace(/\\r\\n|[\\r\\u2028\\u2029]/g, '\\n') : text\n}\n\nfunction isHighSurrogate(code: number): boolean {\n return code >= 0xd800 && code <= 0xdbff\n}\n\nfunction isLowSurrogate(code: number): boolean {\n return code >= 0xdc00 && code <= 0xdfff\n}\n\nfunction invalidPosition(\n operationIndex: number,\n editIndex: number,\n reason: string,\n): { readonly error: WorkspaceEditFailure; readonly ok: false } {\n return replayFailed('invalid-position', reason, operationIndex, editIndex)\n}\n\nfunction replayFailed(\n code: WorkspaceEditFailureCode,\n reason: string,\n operationIndex?: number,\n editIndex?: number,\n): { readonly error: WorkspaceEditFailure; readonly ok: false } {\n return {\n error: failure(code, reason, { editIndex, operationIndex }),\n ok: false,\n }\n}\n\nfunction failure(\n code: WorkspaceEditFailureCode,\n reason: string,\n indices: { readonly editIndex?: number; readonly operationIndex?: number } = {},\n): WorkspaceEditFailure {\n return Object.freeze({\n code,\n reason,\n ...(indices.operationIndex === undefined ? {} : { operationIndex: indices.operationIndex }),\n ...(indices.editIndex === undefined ? {} : { editIndex: indices.editIndex }),\n })\n}\n"],"mappings":";;AA4IA,SAAgB,2BACd,OACkC;CAClC,MAAM,gBAAgB,mBAAmB,MAAM,MAAM;CACrD,IAAI,eAAe,OAAO;EAAE,OAAO;EAAe,IAAI;CAAM;CAE5D,MAAM,QAAQ,mBAAmB,KAAK;CACtC,MAAM,YAA6C,CAAC;CACpD,KAAK,MAAM,WAAW,MAAM,UAAU;EACpC,MAAM,SAAS,gBAAgB,OAAO,OAAO,OAAO;EACpD,IAAI,CAAC,OAAO,IAAI,OAAO;EACvB,UAAU,KAAK,OAAO,OAAO;CAC/B;CAEA,MAAM,YAAY,UAAU,QAAQ,YAAY,QAAQ,uBAAuB,CAAC;CAChF,IAAI,UAAU,WAAW,GACvB,OAAO;EACL,IAAI;EACJ,UAAU,iBAAiB,WAAW,MAAM,OAAO,gBAAgB,QAAQ;EAC3E,UAAU;CACZ;CAGF,MAAM,WAAW,mCACf,MAAM,OAAO,QACb,UAAU,KAAK,YAAY,cAAc,MAAM,sBAAsB,OAAO,CAAC,CAC/E;CACA,IAAI,CAAC,sBAAsB,UAAU,MAAM,MAAM,GAC/C,OAAO,aAAa,kBAAkB,+CAA+C;CAGvF,OAAO;EACL,IAAI;EACJ,UAAU,qBAAqB,WAAW,QAAQ;EAClD;CACF;AACF;AAEA,SAAS,mBAAmB,QAAgE;CAC1F,IAAI,OAAO,OAAO,YAAY,MAAM,OAAO,kBACzC,OAAO,QAAQ,kBAAkB,wDAAwD;CAE3F,IAAI,OAAO,OAAO,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