@mrclrchtr/supi-lsp 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +7 -1
  2. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +7 -1
  3. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
  5. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +4 -0
  6. package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +13 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +45 -0
  8. package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/context.ts +5 -1
  9. package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +14 -3
  10. package/node_modules/@mrclrchtr/supi-core/README.md +7 -1
  11. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  12. package/node_modules/ignore/LICENSE-MIT +21 -0
  13. package/node_modules/ignore/README.md +452 -0
  14. package/node_modules/ignore/index.d.ts +81 -0
  15. package/node_modules/ignore/index.js +784 -0
  16. package/node_modules/ignore/legacy.js +681 -0
  17. package/node_modules/ignore/package.json +87 -0
  18. package/node_modules/typescript/LICENSE.txt +55 -0
  19. package/node_modules/typescript/README.md +50 -0
  20. package/node_modules/typescript/SECURITY.md +39 -0
  21. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  22. package/node_modules/typescript/bin/tsc +2 -0
  23. package/node_modules/typescript/bin/tsserver +2 -0
  24. package/node_modules/typescript/lib/_tsc.js +134465 -0
  25. package/node_modules/typescript/lib/_tsserver.js +659 -0
  26. package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  27. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2129 -0
  28. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2125 -0
  29. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2129 -0
  30. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2129 -0
  31. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2125 -0
  32. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2129 -0
  33. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2129 -0
  34. package/node_modules/typescript/lib/lib.d.ts +20 -0
  35. package/node_modules/typescript/lib/lib.decorators.d.ts +382 -0
  36. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +20 -0
  37. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +18 -0
  38. package/node_modules/typescript/lib/lib.dom.d.ts +45125 -0
  39. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +18 -0
  40. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +150 -0
  41. package/node_modules/typescript/lib/lib.es2015.core.d.ts +595 -0
  42. package/node_modules/typescript/lib/lib.es2015.d.ts +26 -0
  43. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +75 -0
  44. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +603 -0
  45. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +79 -0
  46. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +126 -0
  47. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +142 -0
  48. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +44 -0
  49. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
  50. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +114 -0
  51. package/node_modules/typescript/lib/lib.es2016.d.ts +19 -0
  52. package/node_modules/typescript/lib/lib.es2016.full.d.ts +21 -0
  53. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +29 -0
  54. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +19 -0
  55. package/node_modules/typescript/lib/lib.es2017.d.ts +24 -0
  56. package/node_modules/typescript/lib/lib.es2017.date.d.ts +29 -0
  57. package/node_modules/typescript/lib/lib.es2017.full.d.ts +21 -0
  58. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +42 -0
  59. package/node_modules/typescript/lib/lib.es2017.object.d.ts +47 -0
  60. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +133 -0
  61. package/node_modules/typescript/lib/lib.es2017.string.d.ts +43 -0
  62. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +51 -0
  63. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +75 -0
  64. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +51 -0
  65. package/node_modules/typescript/lib/lib.es2018.d.ts +22 -0
  66. package/node_modules/typescript/lib/lib.es2018.full.d.ts +22 -0
  67. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +81 -0
  68. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +28 -0
  69. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +35 -0
  70. package/node_modules/typescript/lib/lib.es2019.array.d.ts +77 -0
  71. package/node_modules/typescript/lib/lib.es2019.d.ts +22 -0
  72. package/node_modules/typescript/lib/lib.es2019.full.d.ts +22 -0
  73. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +21 -0
  74. package/node_modules/typescript/lib/lib.es2019.object.d.ts +31 -0
  75. package/node_modules/typescript/lib/lib.es2019.string.d.ts +35 -0
  76. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +22 -0
  77. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +763 -0
  78. package/node_modules/typescript/lib/lib.es2020.d.ts +25 -0
  79. package/node_modules/typescript/lib/lib.es2020.date.d.ts +40 -0
  80. package/node_modules/typescript/lib/lib.es2020.full.d.ts +22 -0
  81. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +472 -0
  82. package/node_modules/typescript/lib/lib.es2020.number.d.ts +26 -0
  83. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +45 -0
  84. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +97 -0
  85. package/node_modules/typescript/lib/lib.es2020.string.d.ts +42 -0
  86. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
  87. package/node_modules/typescript/lib/lib.es2021.d.ts +21 -0
  88. package/node_modules/typescript/lib/lib.es2021.full.d.ts +22 -0
  89. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +164 -0
  90. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +46 -0
  91. package/node_modules/typescript/lib/lib.es2021.string.d.ts +31 -0
  92. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +76 -0
  93. package/node_modules/typescript/lib/lib.es2022.array.d.ts +119 -0
  94. package/node_modules/typescript/lib/lib.es2022.d.ts +23 -0
  95. package/node_modules/typescript/lib/lib.es2022.error.d.ts +73 -0
  96. package/node_modules/typescript/lib/lib.es2022.full.d.ts +22 -0
  97. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +143 -0
  98. package/node_modules/typescript/lib/lib.es2022.object.d.ts +24 -0
  99. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +37 -0
  100. package/node_modules/typescript/lib/lib.es2022.string.d.ts +23 -0
  101. package/node_modules/typescript/lib/lib.es2023.array.d.ts +922 -0
  102. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +19 -0
  103. package/node_modules/typescript/lib/lib.es2023.d.ts +20 -0
  104. package/node_modules/typescript/lib/lib.es2023.full.d.ts +22 -0
  105. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +62 -0
  106. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +63 -0
  107. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +27 -0
  108. package/node_modules/typescript/lib/lib.es2024.d.ts +24 -0
  109. package/node_modules/typescript/lib/lib.es2024.full.d.ts +22 -0
  110. package/node_modules/typescript/lib/lib.es2024.object.d.ts +27 -0
  111. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +33 -0
  112. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +23 -0
  113. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +66 -0
  114. package/node_modules/typescript/lib/lib.es2024.string.d.ts +27 -0
  115. package/node_modules/typescript/lib/lib.es2025.collection.d.ts +94 -0
  116. package/node_modules/typescript/lib/lib.es2025.d.ts +23 -0
  117. package/node_modules/typescript/lib/lib.es2025.float16.d.ts +443 -0
  118. package/node_modules/typescript/lib/lib.es2025.full.d.ts +22 -0
  119. package/node_modules/typescript/lib/lib.es2025.intl.d.ts +200 -0
  120. package/node_modules/typescript/lib/lib.es2025.iterator.d.ts +146 -0
  121. package/node_modules/typescript/lib/lib.es2025.promise.d.ts +32 -0
  122. package/node_modules/typescript/lib/lib.es2025.regexp.d.ts +30 -0
  123. package/node_modules/typescript/lib/lib.es5.d.ts +4599 -0
  124. package/node_modules/typescript/lib/lib.es6.d.ts +21 -0
  125. package/node_modules/typescript/lib/lib.esnext.array.d.ts +33 -0
  126. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +47 -0
  127. package/node_modules/typescript/lib/lib.esnext.d.ts +27 -0
  128. package/node_modules/typescript/lib/lib.esnext.date.d.ts +21 -0
  129. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +26 -0
  130. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +191 -0
  131. package/node_modules/typescript/lib/lib.esnext.error.d.ts +22 -0
  132. package/node_modules/typescript/lib/lib.esnext.full.d.ts +22 -0
  133. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +107 -0
  134. package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +23 -0
  135. package/node_modules/typescript/lib/lib.esnext.temporal.d.ts +485 -0
  136. package/node_modules/typescript/lib/lib.esnext.typedarrays.d.ts +90 -0
  137. package/node_modules/typescript/lib/lib.scripthost.d.ts +320 -0
  138. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +18 -0
  139. package/node_modules/typescript/lib/lib.webworker.d.ts +15606 -0
  140. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +21 -0
  141. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +18 -0
  142. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2129 -0
  143. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2129 -0
  144. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2125 -0
  145. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2129 -0
  146. package/node_modules/typescript/lib/tsc.js +8 -0
  147. package/node_modules/typescript/lib/tsserver.js +8 -0
  148. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  149. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  150. package/node_modules/typescript/lib/typesMap.json +497 -0
  151. package/node_modules/typescript/lib/typescript.d.ts +11448 -0
  152. package/node_modules/typescript/lib/typescript.js +201039 -0
  153. package/node_modules/typescript/lib/typingsInstaller.js +8 -0
  154. package/node_modules/typescript/lib/watchGuard.js +53 -0
  155. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2129 -0
  156. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2125 -0
  157. package/node_modules/typescript/package.json +118 -0
  158. package/package.json +5 -3
  159. package/src/provider/lsp-semantic-provider.ts +139 -1
@@ -0,0 +1,118 @@
1
+ {
2
+ "name": "typescript",
3
+ "author": "Microsoft Corp.",
4
+ "homepage": "https://www.typescriptlang.org/",
5
+ "version": "6.0.3",
6
+ "license": "Apache-2.0",
7
+ "description": "TypeScript is a language for application scale JavaScript development",
8
+ "keywords": [
9
+ "TypeScript",
10
+ "Microsoft",
11
+ "compiler",
12
+ "language",
13
+ "javascript"
14
+ ],
15
+ "bugs": {
16
+ "url": "https://github.com/microsoft/TypeScript/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/microsoft/TypeScript.git"
21
+ },
22
+ "main": "./lib/typescript.js",
23
+ "typings": "./lib/typescript.d.ts",
24
+ "bin": {
25
+ "tsc": "./bin/tsc",
26
+ "tsserver": "./bin/tsserver"
27
+ },
28
+ "engines": {
29
+ "node": ">=14.17"
30
+ },
31
+ "files": [
32
+ "bin",
33
+ "lib",
34
+ "!lib/enu",
35
+ "LICENSE.txt",
36
+ "README.md",
37
+ "SECURITY.md",
38
+ "ThirdPartyNoticeText.txt",
39
+ "!**/.gitattributes"
40
+ ],
41
+ "devDependencies": {
42
+ "@dprint/formatter": "^0.4.1",
43
+ "@dprint/typescript": "0.93.4",
44
+ "@esfx/canceltoken": "^1.0.0",
45
+ "@eslint/js": "^10.0.1",
46
+ "@octokit/rest": "^22.0.1",
47
+ "@types/chai": "^4.3.20",
48
+ "@types/minimist": "^1.2.5",
49
+ "@types/mocha": "^10.0.10",
50
+ "@types/ms": "^2.1.0",
51
+ "@types/node": "latest",
52
+ "@types/source-map-support": "^0.5.10",
53
+ "@types/which": "^3.0.4",
54
+ "@typescript-eslint/rule-tester": "^8.56.1",
55
+ "@typescript-eslint/type-utils": "^8.56.1",
56
+ "@typescript-eslint/utils": "^8.56.1",
57
+ "azure-devops-node-api": "^15.1.3",
58
+ "c8": "^10.1.3",
59
+ "chai": "^4.5.0",
60
+ "chokidar": "^4.0.3",
61
+ "diff": "^8.0.3",
62
+ "dprint": "^0.49.1",
63
+ "esbuild": "^0.27.3",
64
+ "eslint": "^10.0.2",
65
+ "eslint-plugin-regexp": "^3.0.0",
66
+ "fast-xml-parser": "^5.4.1",
67
+ "glob": "^10.5.0",
68
+ "globals": "^17.4.0",
69
+ "hereby": "^1.12.0",
70
+ "jsonc-parser": "^3.3.1",
71
+ "knip": "^5.85.0",
72
+ "minimist": "^1.2.8",
73
+ "mocha": "^10.8.2",
74
+ "mocha-fivemat-progress-reporter": "^0.1.0",
75
+ "monocart-coverage-reports": "^2.12.9",
76
+ "ms": "^2.1.3",
77
+ "picocolors": "^1.1.1",
78
+ "playwright": "^1.58.2",
79
+ "source-map-support": "^0.5.21",
80
+ "tslib": "^2.8.1",
81
+ "typescript": "^5.9.3",
82
+ "typescript-eslint": "^8.56.1",
83
+ "which": "^3.0.1"
84
+ },
85
+ "overrides": {
86
+ "typescript@*": "$typescript"
87
+ },
88
+ "scripts": {
89
+ "test": "hereby runtests-parallel --light=false",
90
+ "test:eslint-rules": "hereby run-eslint-rules-tests",
91
+ "build": "npm run build:compiler && npm run build:tests",
92
+ "build:compiler": "hereby local",
93
+ "build:tests": "hereby tests",
94
+ "build:tests:notypecheck": "hereby tests --no-typecheck",
95
+ "clean": "hereby clean",
96
+ "gulp": "hereby",
97
+ "lint": "hereby lint",
98
+ "knip": "hereby knip",
99
+ "format": "dprint fmt",
100
+ "setup-hooks": "node scripts/link-hooks.mjs"
101
+ },
102
+ "browser": {
103
+ "fs": false,
104
+ "os": false,
105
+ "path": false,
106
+ "crypto": false,
107
+ "buffer": false,
108
+ "source-map-support": false,
109
+ "inspector": false,
110
+ "perf_hooks": false
111
+ },
112
+ "packageManager": "npm@8.19.4",
113
+ "volta": {
114
+ "node": "22.22.0",
115
+ "npm": "8.19.4"
116
+ },
117
+ "gitHead": "050880ce59e30b356b686bd3144efe24f875ebc8"
118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-lsp",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "SuPi LSP extension — Language Server Protocol integration for pi",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,12 +26,14 @@
26
26
  "vscode-jsonrpc": "^8.2.1",
27
27
  "vscode-languageserver-protocol": "^3.17.5",
28
28
  "vscode-languageserver-types": "^3.17.5",
29
- "@mrclrchtr/supi-code-runtime": "1.9.0",
30
- "@mrclrchtr/supi-core": "1.9.0"
29
+ "@mrclrchtr/supi-core": "1.10.0",
30
+ "@mrclrchtr/supi-code-runtime": "1.10.0"
31
31
  },
32
32
  "bundledDependencies": [
33
33
  "@mrclrchtr/supi-code-runtime",
34
34
  "@mrclrchtr/supi-core",
35
+ "ignore",
36
+ "typescript",
35
37
  "vscode-jsonrpc",
36
38
  "vscode-languageserver-protocol",
37
39
  "vscode-languageserver-types"
@@ -5,9 +5,18 @@ import type {
5
5
  CodeLocation,
6
6
  CodePosition,
7
7
  CodeSymbol,
8
+ RefactorResult,
8
9
  SemanticProvider,
9
10
  } from "@mrclrchtr/supi-code-runtime/api";
10
- import type { DocumentSymbol, Location, LocationLink, SymbolInformation } from "../config/types.ts";
11
+ import type {
12
+ DocumentSymbol,
13
+ Location,
14
+ LocationLink,
15
+ SymbolInformation,
16
+ TextDocumentEdit,
17
+ TextEdit,
18
+ WorkspaceEdit,
19
+ } from "../config/types.ts";
11
20
  import type { SessionLspService } from "../session/service-registry.ts";
12
21
 
13
22
  /**
@@ -50,9 +59,138 @@ export function createLspSemanticProvider(lsp: SessionLspService): SemanticProvi
50
59
  if (!results) return null;
51
60
  return results.map((sym) => toCodeSymbol(sym as SymbolInformation));
52
61
  },
62
+
63
+ async rename(file: string, position: CodePosition, newName: string): Promise<RefactorResult> {
64
+ const edit = await lsp.rename(file, position, newName);
65
+ return convertLspWorkspaceEdit(edit);
66
+ },
67
+
68
+ async codeActions(file: string, position: CodePosition): Promise<RefactorResult[]> {
69
+ const actions = await lsp.codeActions(file, position);
70
+ if (!actions) return [];
71
+
72
+ const results: RefactorResult[] = [];
73
+ for (const action of actions) {
74
+ const edit = action.edit;
75
+ if (!edit) {
76
+ results.push({
77
+ kind: "unavailable",
78
+ reason: `Code action "${action.title}" has no edit`,
79
+ });
80
+ continue;
81
+ }
82
+ const converted = convertLspWorkspaceEdit(edit);
83
+ if (converted.kind === "precise") {
84
+ results.push(converted);
85
+ } else {
86
+ results.push({
87
+ kind: "unavailable",
88
+ reason: `Code action "${action.title}" could not produce precise edits`,
89
+ });
90
+ }
91
+ }
92
+ return results;
93
+ },
53
94
  };
54
95
  }
55
96
 
97
+ // ── LSP WorkspaceEdit converter ─────────────────────────────────────
98
+
99
+ /**
100
+ * Convert an LSP WorkspaceEdit to the shared RefactorResult type.
101
+ *
102
+ * LSP WorkspaceEdit can use:
103
+ * - `documentChanges` (preferred, with TextDocumentEdit)
104
+ * - `changes` (legacy, URI → TextEdit[] map)
105
+ *
106
+ * Returns `unavailable` when both are missing or both produce zero edits.
107
+ */
108
+ function resolveFileFromUri(uri: string): string {
109
+ if (!uri.startsWith("file://")) return uri;
110
+ try {
111
+ return decodeURIComponent(uri.slice(7));
112
+ } catch {
113
+ return uri;
114
+ }
115
+ }
116
+
117
+ function collectDocumentChangeEdits(
118
+ docChanges: NonNullable<WorkspaceEdit["documentChanges"]>,
119
+ ): Array<{
120
+ file: string;
121
+ range: { start: { line: number; character: number }; end: { line: number; character: number } };
122
+ newText: string;
123
+ }> {
124
+ const out: Array<{
125
+ file: string;
126
+ range: { start: { line: number; character: number }; end: { line: number; character: number } };
127
+ newText: string;
128
+ }> = [];
129
+ for (const change of docChanges) {
130
+ const tdEdit = change as TextDocumentEdit;
131
+ if (!tdEdit.textDocument || !tdEdit.edits) continue;
132
+ const file = resolveFileFromUri(tdEdit.textDocument.uri);
133
+ for (const singleEdit of tdEdit.edits) {
134
+ const te = singleEdit as TextEdit;
135
+ out.push({
136
+ file,
137
+ range: {
138
+ start: { line: te.range.start.line, character: te.range.start.character },
139
+ end: { line: te.range.end.line, character: te.range.end.character },
140
+ },
141
+ newText: te.newText,
142
+ });
143
+ }
144
+ }
145
+ return out;
146
+ }
147
+
148
+ function collectChangesEdits(changes: NonNullable<WorkspaceEdit["changes"]>): Array<{
149
+ file: string;
150
+ range: { start: { line: number; character: number }; end: { line: number; character: number } };
151
+ newText: string;
152
+ }> {
153
+ const out: Array<{
154
+ file: string;
155
+ range: { start: { line: number; character: number }; end: { line: number; character: number } };
156
+ newText: string;
157
+ }> = [];
158
+ for (const [uri, textEdits] of Object.entries(changes)) {
159
+ if (!textEdits || textEdits.length === 0) continue;
160
+ const file = resolveFileFromUri(uri);
161
+ for (const te of textEdits) {
162
+ out.push({
163
+ file,
164
+ range: {
165
+ start: { line: te.range.start.line, character: te.range.start.character },
166
+ end: { line: te.range.end.line, character: te.range.end.character },
167
+ },
168
+ newText: te.newText,
169
+ });
170
+ }
171
+ }
172
+ return out;
173
+ }
174
+
175
+ function convertLspWorkspaceEdit(edit: WorkspaceEdit | null): RefactorResult {
176
+ if (!edit) {
177
+ return { kind: "unavailable", reason: "LSP server returned no edit" };
178
+ }
179
+
180
+ let fileEdits = edit.documentChanges?.length
181
+ ? collectDocumentChangeEdits(edit.documentChanges)
182
+ : [];
183
+ if (fileEdits.length === 0 && edit.changes) {
184
+ fileEdits = collectChangesEdits(edit.changes);
185
+ }
186
+
187
+ if (fileEdits.length === 0) {
188
+ return { kind: "unavailable", reason: "Workspace edit contains no file edits" };
189
+ }
190
+
191
+ return { kind: "precise", edits: { edits: fileEdits } };
192
+ }
193
+
56
194
  // ── Type conversion helpers ───────────────────────────────────────────
57
195
 
58
196
  function toCodeLocation(item: Location | LocationLink): CodeLocation | null {