@mrclrchtr/supi-code-intelligence 11.4.0 → 13.0.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.
- package/CHANGELOG.md +39 -0
- package/README.md +17 -9
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
- package/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +21 -16
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -8
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +102 -47
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +13 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +15 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +71 -13
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-disk-stamp.ts +60 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +28 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-edit-capture.ts +258 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +17 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +53 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +75 -14
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +48 -79
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +14 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-module.ts +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +2 -17
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-removal-ledger.ts +52 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +43 -21
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +21 -35
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-command-capture.ts +139 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +202 -47
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +13 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/session/route-boundary.ts +26 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +74 -14
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +11 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +24 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +6 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +7 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +7 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +5 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/latex/tree-sitter-latex.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +16 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +4 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-range.ts +94 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +26 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +6 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +13 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +1 -9
- package/node_modules/fast-xml-parser/CHANGELOG.md +886 -0
- package/node_modules/fast-xml-parser/LICENSE +21 -0
- package/node_modules/fast-xml-parser/README.md +204 -0
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.d.cts +774 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/README.md +92 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/package.json +57 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityDecoder.js +644 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityEncoder.js +239 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/all-entities.js +53 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entities.js +1139 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entityTries.js +60 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.d.ts +358 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.js +29 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/CHANGELOG.md +52 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/README.md +77 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/package.json +77 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.js +609 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/orderedJs2Xml.js +360 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/util.js +23 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/README.md +632 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/package.json +56 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/html.js +102 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/log.js +98 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/nosql.js +114 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/redos.js +60 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/shell.js +105 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql-strict.js +47 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql.js +95 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/svg.js +81 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/xml.js +79 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.cjs +27 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.d.ts +103 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.js +292 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/util/decode-entities.js +48 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/README.md +947 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.d.cts +725 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/package.json +79 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Expression.js +232 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/ExpressionSet.js +225 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Matcher.js +663 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.d.ts +589 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.js +30 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/CHANGELOG.md +63 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/README.md +113 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/README.md +142 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/anynum.js +135 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/digitTable.js +116 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/package.json +42 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/package.json +36 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/strnum.js +176 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/README.md +287 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/package.json +56 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.d.ts +108 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.js +382 -0
- package/node_modules/fast-xml-parser/package.json +93 -0
- package/node_modules/fast-xml-parser/src/cli/cli.js +97 -0
- package/node_modules/fast-xml-parser/src/cli/man.js +17 -0
- package/node_modules/fast-xml-parser/src/cli/read.js +43 -0
- package/node_modules/fast-xml-parser/src/fxp.d.ts +754 -0
- package/node_modules/fast-xml-parser/src/fxp.js +14 -0
- package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-parser/src/util.js +61 -0
- package/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +16 -0
- package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +106 -0
- package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +61 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +69 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +103 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +100 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +154 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +94 -0
- package/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
- package/node_modules/fast-xml-parser/src/v6/TagPath.js +81 -0
- package/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +13 -0
- package/node_modules/fast-xml-parser/src/v6/XMLParser.js +83 -0
- package/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +235 -0
- package/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +210 -0
- package/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +111 -0
- package/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +116 -0
- package/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +121 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +105 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +22 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +19 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +38 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +13 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +14 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +6 -0
- package/node_modules/fast-xml-parser/src/validator.js +518 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +6 -0
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +426 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +164 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +907 -0
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +77 -0
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +177 -0
- package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +54 -0
- package/package.json +10 -8
- package/src/analysis/evidence.ts +331 -73
- package/src/analysis/health/diagnostics.ts +66 -18
- package/src/analysis/health/evidence-reason.ts +44 -0
- package/src/analysis/health/server-status.ts +41 -12
- package/src/analysis/search/pattern.ts +3 -3
- package/src/analysis/target/anchored-structural.ts +4 -1
- package/src/analysis/target/anchored.ts +3 -6
- package/src/analysis/target/symbol.ts +42 -48
- package/src/analysis/target/types.ts +4 -9
- package/src/analysis/workspace/cmake-parser.ts +207 -0
- package/src/analysis/workspace/cmake.ts +141 -0
- package/src/analysis/workspace/maven.ts +310 -0
- package/src/analysis/workspace/membership.ts +100 -26
- package/src/analysis/workspace/metadata.ts +6 -1
- package/src/analysis/workspace/observe.ts +6 -0
- package/src/analysis/workspace/types.ts +11 -3
- package/src/diagnostics/coverage.ts +49 -0
- package/src/diagnostics/evidence.ts +10 -2
- package/src/session/find-types.ts +8 -4
- package/src/session/find-workflow.ts +11 -16
- package/src/session/health-workflow.ts +6 -0
- package/src/session/input/common.ts +1 -1
- package/src/session/input/health-refactor.ts +48 -34
- package/src/session/input/workflows.ts +45 -46
- package/src/session/inspect/file-point.ts +2 -2
- package/src/session/inspect-types.ts +1 -1
- package/src/session/inspect-workflow.ts +3 -3
- package/src/session/orientation/collect.ts +42 -7
- package/src/session/orientation/context-facts.ts +3 -3
- package/src/session/orientation/context-sections.ts +13 -15
- package/src/session/orientation/facts.ts +5 -8
- package/src/session/orientation-workflow.ts +4 -19
- package/src/session/refactor-file-actions.ts +122 -0
- package/src/session/refactor-plan-pipeline.ts +152 -0
- package/src/session/refactor-plans.ts +18 -15
- package/src/session/refactor-types.ts +24 -12
- package/src/session/refactor-workflow.ts +68 -243
- package/src/session/target-workflow.ts +25 -18
- package/src/tool/code_find/execute.ts +6 -7
- package/src/tool/code_find/result.ts +5 -7
- package/src/tool/code_find/spec.ts +9 -16
- package/src/tool/code_find/tui.ts +12 -6
- package/src/tool/code_graph/display.ts +5 -6
- package/src/tool/code_graph/format.ts +8 -24
- package/src/tool/code_graph/result.ts +16 -75
- package/src/tool/code_graph/section.ts +21 -33
- package/src/tool/code_graph/spec.ts +6 -0
- package/src/tool/code_graph/tui.ts +10 -5
- package/src/tool/code_health/diagnostic-tui.ts +49 -0
- package/src/tool/code_health/guidance.ts +27 -0
- package/src/tool/code_health/markdown.ts +60 -8
- package/src/tool/code_health/result.ts +20 -9
- package/src/tool/code_health/spec.ts +6 -0
- package/src/tool/code_health/structured-schema.ts +18 -4
- package/src/tool/code_health/structured.ts +22 -18
- package/src/tool/code_health/tui.ts +33 -40
- package/src/tool/code_inspect/execute.ts +1 -1
- package/src/tool/code_inspect/markdown.ts +33 -6
- package/src/tool/code_inspect/result.ts +24 -19
- package/src/tool/code_inspect/spec.ts +14 -6
- package/src/tool/code_inspect/structured.ts +4 -21
- package/src/tool/code_inspect/tui.ts +2 -2
- package/src/tool/code_orientation/result.ts +53 -100
- package/src/tool/code_orientation/spec.ts +8 -0
- package/src/tool/code_orientation/structured-schema.ts +16 -12
- package/src/tool/code_orientation/structured-workspace.ts +13 -7
- package/src/tool/code_orientation/structured.ts +31 -39
- package/src/tool/code_orientation/workspace-format.ts +4 -10
- package/src/tool/code_orientation/workspace-instructions.ts +4 -5
- package/src/tool/code_orientation/workspace-observations.ts +2 -2
- package/src/tool/code_orientation/workspace-output.ts +16 -7
- package/src/tool/code_orientation/workspace-projects.ts +7 -10
- package/src/tool/code_orientation/workspace-sections.ts +13 -19
- package/src/tool/code_refactor_apply/result.ts +2 -1
- package/src/tool/code_refactor_apply/spec.ts +7 -0
- package/src/tool/code_refactor_plan/execute.ts +0 -2
- package/src/tool/code_refactor_plan/result.ts +23 -13
- package/src/tool/code_refactor_plan/spec.ts +8 -2
- package/src/tool/code_refactor_plan/structured.ts +59 -12
- package/src/tool/code_refactor_plan/tui.ts +14 -17
- package/src/tool/code_resolve/markdown.ts +5 -47
- package/src/tool/code_resolve/result.ts +43 -72
- package/src/tool/code_resolve/spec.ts +6 -0
- package/src/tool/infra/truncate.ts +2 -16
- package/src/tool/namespace.ts +14 -0
- package/src/tool/refactor-markdown.ts +55 -15
- package/src/tool/register.ts +3 -0
- package/src/tool/result/candidate-selection.ts +141 -0
- package/src/tool/result/display.ts +41 -45
- package/src/tool/result/errors.ts +1 -0
- package/src/tool/result/model-budget.ts +26 -1
- package/src/tool/result/refactor-preview.ts +118 -0
- package/src/tool/result/refactor-unavailable.ts +16 -0
- package/src/tool/result/refactor.ts +19 -10
- package/src/tool/result/structured.ts +2 -1
- package/src/tool/result/types.ts +9 -8
- package/src/tool/schemas.ts +76 -38
- package/src/tool/specs.ts +3 -0
- package/src/ui/footer.ts +2 -4
- package/src/ui/status-overlay.ts +1 -1
- package/src/ui/status-presentation.ts +4 -7
- package/src/ui/tui/candidate-selection.ts +40 -95
- package/src/ui/tui/common.ts +16 -70
- package/src/ui/tui/display.ts +6 -24
- package/src/tool/result/candidate-row.ts +0 -49
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan command-only code actions by capturing the edit their command pushes.
|
|
3
|
+
*
|
|
4
|
+
* Only `refactor*`, `source.organizeImports*`, and `source.fixAll*` commands
|
|
5
|
+
* may run, and only when the server lists the command (if it lists any). Other
|
|
6
|
+
* source commands can have side effects outside the editor, so they never run.
|
|
7
|
+
* Several eligible actions stay ambiguous without running any command.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
CodeRequestControl,
|
|
12
|
+
DisambiguationCandidate,
|
|
13
|
+
DocumentEditPrecondition,
|
|
14
|
+
RefactorResult,
|
|
15
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
16
|
+
import { isCodeActionKindWithin } from "../config/operation-support.ts";
|
|
17
|
+
import type { CodeAction, Command } from "../config/types.ts";
|
|
18
|
+
import type { WorkspaceLspRuntime } from "../session/workspace-lsp-runtime.ts";
|
|
19
|
+
import { normalizeSemanticEdit } from "./semantic-edit-normalizer.ts";
|
|
20
|
+
|
|
21
|
+
const CAPTURE_ELIGIBLE_KINDS = ["refactor", "source.organizeImports", "source.fixAll"] as const;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Stable reason for command-only actions SuPi will not run: an ineligible kind
|
|
25
|
+
* or a command the server does not list.
|
|
26
|
+
*/
|
|
27
|
+
export const COMMAND_ONLY_ACTION_REASON =
|
|
28
|
+
"Matching code actions only run a server command that SuPi does not run for preview.";
|
|
29
|
+
|
|
30
|
+
/** A code action whose only effect is a server command. */
|
|
31
|
+
export type CommandOnlyAction = CodeAction & { command: Command; kind: string };
|
|
32
|
+
|
|
33
|
+
/** Whether a code action has a command and no edit. */
|
|
34
|
+
export function isCommandOnlyAction(action: CodeAction): boolean {
|
|
35
|
+
return Object.hasOwn(action, "command") && !action.edit;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Select the command-only actions SuPi may run to capture an edit: an eligible
|
|
40
|
+
* kind, and a command the server lists when it lists any.
|
|
41
|
+
*/
|
|
42
|
+
export function captureEligibleActions(
|
|
43
|
+
actions: readonly CodeAction[],
|
|
44
|
+
advertisedCommands: readonly string[] | undefined,
|
|
45
|
+
): CommandOnlyAction[] {
|
|
46
|
+
return actions.filter((action): action is CommandOnlyAction => {
|
|
47
|
+
const command = action.command;
|
|
48
|
+
return (
|
|
49
|
+
isCommandOnlyAction(action) &&
|
|
50
|
+
typeof action.kind === "string" &&
|
|
51
|
+
typeof command?.command === "string" &&
|
|
52
|
+
CAPTURE_ELIGIBLE_KINDS.some((kind) => isCodeActionKindWithin(action.kind, kind)) &&
|
|
53
|
+
(advertisedCommands === undefined || advertisedCommands.includes(command.command))
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Candidates for several eligible command-only actions; no command has run. */
|
|
59
|
+
export function commandCandidates(actions: readonly CommandOnlyAction[]): RefactorResult {
|
|
60
|
+
return {
|
|
61
|
+
kind: "ambiguous",
|
|
62
|
+
candidates: actions.map(
|
|
63
|
+
(action): DisambiguationCandidate => ({
|
|
64
|
+
description: action.title,
|
|
65
|
+
kind: action.kind,
|
|
66
|
+
title: action.title,
|
|
67
|
+
}),
|
|
68
|
+
),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Run one action's command, capture its single pushed edit, and normalize it
|
|
74
|
+
* like a direct edit. Versioned preconditions move to the resynced versions,
|
|
75
|
+
* which hold the same content.
|
|
76
|
+
*/
|
|
77
|
+
export async function captureCommandAction(options: {
|
|
78
|
+
lsp: WorkspaceLspRuntime;
|
|
79
|
+
file: string;
|
|
80
|
+
action: CommandOnlyAction;
|
|
81
|
+
control?: CodeRequestControl;
|
|
82
|
+
}): Promise<RefactorResult> {
|
|
83
|
+
const { lsp, file, action, control } = options;
|
|
84
|
+
const response = await lsp.captureCodeActionEdit(file, action, control);
|
|
85
|
+
if (!response) {
|
|
86
|
+
return { kind: "unavailable", reason: "No routed LSP client could run the command." };
|
|
87
|
+
}
|
|
88
|
+
const roots = [...response.authorizedMutationRoots];
|
|
89
|
+
const capture = response.value;
|
|
90
|
+
if (!capture || capture.kind === "unavailable") {
|
|
91
|
+
return {
|
|
92
|
+
kind: "unavailable",
|
|
93
|
+
reason: `Command for "${action.title}" is unavailable: ${capture?.reason ?? response.reason ?? "no result."}`,
|
|
94
|
+
authorizedMutationRoots: roots,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const before = new Map(capture.resynced.map((entry) => [entry.file, entry]));
|
|
99
|
+
const result = normalizeSemanticEdit(
|
|
100
|
+
{ kind: "workspace-edit", edit: capture.edit },
|
|
101
|
+
{
|
|
102
|
+
// Captured edits target the versions from before the resync.
|
|
103
|
+
getOpenDocumentVersion: (candidate) => {
|
|
104
|
+
const current = lsp.getOpenDocumentVersion(candidate);
|
|
105
|
+
const versions = before.get(candidate);
|
|
106
|
+
return versions && current === versions.to ? versions.from : current;
|
|
107
|
+
},
|
|
108
|
+
authorizedMutationRoots: response.authorizedMutationRoots,
|
|
109
|
+
},
|
|
110
|
+
);
|
|
111
|
+
if (result.kind !== "precise") {
|
|
112
|
+
return result.kind === "unavailable"
|
|
113
|
+
? {
|
|
114
|
+
kind: "unavailable",
|
|
115
|
+
reason: `Captured edit for "${action.title}" could not produce precise edits: ${result.reason}`,
|
|
116
|
+
authorizedMutationRoots: roots,
|
|
117
|
+
}
|
|
118
|
+
: result;
|
|
119
|
+
}
|
|
120
|
+
const preconditions = result.edits.documentPreconditions?.map((precondition) =>
|
|
121
|
+
rebase(precondition, before),
|
|
122
|
+
);
|
|
123
|
+
return {
|
|
124
|
+
...result,
|
|
125
|
+
edits: { ...result.edits, ...(preconditions ? { documentPreconditions: preconditions } : {}) },
|
|
126
|
+
action: { kind: action.kind, title: action.title, provenance: "captured-command" },
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function rebase(
|
|
131
|
+
precondition: DocumentEditPrecondition,
|
|
132
|
+
resynced: ReadonlyMap<string, { from: number; to: number }>,
|
|
133
|
+
): DocumentEditPrecondition {
|
|
134
|
+
if (precondition.kind === "disk-content") return precondition;
|
|
135
|
+
const versions = resynced.get(precondition.file);
|
|
136
|
+
return versions && precondition.version === versions.from
|
|
137
|
+
? { ...precondition, version: versions.to }
|
|
138
|
+
: precondition;
|
|
139
|
+
}
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import * as path from "node:path";
|
|
2
3
|
import type {
|
|
3
4
|
CodePosition,
|
|
4
5
|
CodeRequestControl,
|
|
6
|
+
DisambiguationCandidate,
|
|
7
|
+
RefactorActionIdentity,
|
|
5
8
|
RefactorResult,
|
|
6
9
|
SourceRange,
|
|
7
10
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
8
11
|
import { CodeActionTriggerKind } from "vscode-languageserver-types";
|
|
9
|
-
import {
|
|
12
|
+
import { isCodeActionKindInRange, isCodeActionKindWithin } from "../config/operation-support.ts";
|
|
10
13
|
import type { CodeAction } from "../config/types.ts";
|
|
11
|
-
import
|
|
14
|
+
import { raceRequestControl } from "../session/readiness.ts";
|
|
15
|
+
import type { RoutedCodeActionResponse, WorkspaceLspRuntime } from "../session/runtime-registry.ts";
|
|
16
|
+
import {
|
|
17
|
+
COMMAND_ONLY_ACTION_REASON,
|
|
18
|
+
captureCommandAction,
|
|
19
|
+
captureEligibleActions,
|
|
20
|
+
commandCandidates,
|
|
21
|
+
isCommandOnlyAction,
|
|
22
|
+
} from "./refactor-command-capture.ts";
|
|
23
|
+
|
|
24
|
+
export { COMMAND_ONLY_ACTION_REASON };
|
|
25
|
+
|
|
12
26
|
import {
|
|
13
27
|
normalizeSemanticEdit,
|
|
14
28
|
type SemanticEditNormalizationContext,
|
|
@@ -70,48 +84,135 @@ export function collectCodeActionResults(
|
|
|
70
84
|
return results;
|
|
71
85
|
}
|
|
72
86
|
|
|
73
|
-
|
|
87
|
+
/** Options for one code- or source-action planning request. */
|
|
88
|
+
export interface CodeActionRefactorOptions {
|
|
74
89
|
lsp: WorkspaceLspRuntime;
|
|
75
90
|
file: string;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
range: SourceRange;
|
|
92
|
+
kind: string;
|
|
93
|
+
title?: string;
|
|
94
|
+
/** Operation label used in unavailable reasons. */
|
|
95
|
+
label: "Code action" | "Source action";
|
|
80
96
|
control?: CodeRequestControl;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Plan one code action of the requested kind over a file range.
|
|
101
|
+
*
|
|
102
|
+
* `kind` matches itself and its dotted sub-kinds, per the LSP CodeActionKind
|
|
103
|
+
* hierarchy. Disabled actions never match. `title` narrows matches to one exact
|
|
104
|
+
* title. Distinct precise plans stay ambiguous. One eligible command-only
|
|
105
|
+
* action runs once so its pushed edit can be captured; see
|
|
106
|
+
* `refactor-command-capture.ts`.
|
|
107
|
+
*/
|
|
108
|
+
export async function runCodeActionRefactor(
|
|
109
|
+
options: CodeActionRefactorOptions,
|
|
110
|
+
): Promise<RefactorResult> {
|
|
111
|
+
return (await attemptCodeActionRefactor(options)).result;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Delays before re-requesting a source action that returned no action of the kind. */
|
|
115
|
+
const SOURCE_ACTION_RETRY_DELAYS_MS = [500, 1000] as const;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Plan a whole-file source action, retrying briefly when a server that
|
|
119
|
+
* advertises the requested kind returns no action of it.
|
|
120
|
+
*
|
|
121
|
+
* typescript-language-server returns no fix-all or unused-code source actions
|
|
122
|
+
* while diagnostics for a just-opened or just-changed file are pending, and
|
|
123
|
+
* waits itself about 500 ms in the equivalent quick-fix path.
|
|
124
|
+
*/
|
|
125
|
+
export async function runSourceActionRefactor(
|
|
126
|
+
options: CodeActionRefactorOptions,
|
|
127
|
+
): Promise<RefactorResult> {
|
|
128
|
+
let attempt = await attemptCodeActionRefactor(options);
|
|
129
|
+
for (const delayMs of SOURCE_ACTION_RETRY_DELAYS_MS) {
|
|
130
|
+
if (!attempt.retryable) break;
|
|
131
|
+
await raceRequestControl(
|
|
132
|
+
new Promise((resolve) => setTimeout(resolve, delayMs)),
|
|
133
|
+
options.control,
|
|
134
|
+
);
|
|
135
|
+
attempt = await attemptCodeActionRefactor(options);
|
|
136
|
+
}
|
|
137
|
+
return attempt.result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* One planning attempt. `retryable` marks a zero-match response from a server
|
|
142
|
+
* that advertises the requested kind, so a later request may still return it.
|
|
143
|
+
*/
|
|
144
|
+
async function attemptCodeActionRefactor(
|
|
145
|
+
options: CodeActionRefactorOptions,
|
|
146
|
+
): Promise<{ result: RefactorResult; retryable: boolean }> {
|
|
147
|
+
const { lsp, file, range, kind, title, label } = options;
|
|
148
|
+
const response = await lsp.codeActions(file, range, options.control, {
|
|
149
|
+
only: [kind],
|
|
85
150
|
triggerKind: CodeActionTriggerKind.Invoked,
|
|
86
151
|
});
|
|
87
|
-
if (!response
|
|
152
|
+
if (!response) {
|
|
88
153
|
return {
|
|
89
|
-
|
|
90
|
-
|
|
154
|
+
result: {
|
|
155
|
+
kind: "unavailable",
|
|
156
|
+
reason: `${label} "${kind}" is unavailable: no routed LSP client.`,
|
|
157
|
+
},
|
|
158
|
+
retryable: false,
|
|
91
159
|
};
|
|
92
160
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
161
|
+
const roots = [...response.authorizedMutationRoots];
|
|
162
|
+
const unavailable = (reason: string, retryable = false) => ({
|
|
163
|
+
result: { kind: "unavailable" as const, reason, authorizedMutationRoots: roots },
|
|
164
|
+
retryable,
|
|
165
|
+
});
|
|
166
|
+
if (response.reason || !response.value) {
|
|
167
|
+
return unavailable(
|
|
168
|
+
`${label} "${kind}" is unavailable: ${response.reason ?? "no code actions were returned."}`,
|
|
169
|
+
);
|
|
99
170
|
}
|
|
100
171
|
|
|
101
|
-
const
|
|
172
|
+
const ofKind = response.value
|
|
173
|
+
.filter(isTitledCodeAction)
|
|
174
|
+
.filter(
|
|
175
|
+
(action) => isCodeActionKindWithin(action.kind, kind) && !Object.hasOwn(action, "disabled"),
|
|
176
|
+
);
|
|
177
|
+
if (ofKind.length === 0) {
|
|
178
|
+
const advertised = advertisedFamilyKinds(response.advertisedKinds, kind);
|
|
179
|
+
return unavailable(
|
|
180
|
+
noKindMatchReason(kind, advertised),
|
|
181
|
+
advertised.kinds.some((candidate) => isCodeActionKindInRange(candidate, kind)),
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
const matching = title === undefined ? ofKind : ofKind.filter((action) => action.title === title);
|
|
102
185
|
if (matching.length === 0) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
186
|
+
const titles = [...new Set(ofKind.map((action) => `"${action.title}"`))].join(", ");
|
|
187
|
+
return unavailable(
|
|
188
|
+
`No "${kind}" code action has the title "${title}". Available titles: ${titles}.`,
|
|
189
|
+
);
|
|
107
190
|
}
|
|
108
191
|
|
|
109
|
-
|
|
192
|
+
return { result: await planMatchingActions(options, matching, response), retryable: false };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Turn the matching actions into one plan, candidates, or an unavailable reason. */
|
|
196
|
+
async function planMatchingActions(
|
|
197
|
+
options: CodeActionRefactorOptions,
|
|
198
|
+
matching: CodeAction[],
|
|
199
|
+
response: RoutedCodeActionResponse,
|
|
200
|
+
): Promise<RefactorResult> {
|
|
201
|
+
const { lsp, file, kind } = options;
|
|
202
|
+
const roots = [...response.authorizedMutationRoots];
|
|
203
|
+
const unavailable = (reason: string): RefactorResult => ({
|
|
204
|
+
kind: "unavailable",
|
|
205
|
+
reason,
|
|
206
|
+
authorizedMutationRoots: roots,
|
|
207
|
+
});
|
|
208
|
+
const plans = collectPrecisePlans(matching, {
|
|
110
209
|
getOpenDocumentVersion: (candidate) => lsp.getOpenDocumentVersion(candidate),
|
|
111
210
|
authorizedMutationRoots: response.authorizedMutationRoots,
|
|
112
|
-
};
|
|
113
|
-
const
|
|
114
|
-
if (plans.precise.length === 1)
|
|
211
|
+
});
|
|
212
|
+
const [single] = plans.precise;
|
|
213
|
+
if (plans.precise.length === 1 && single) {
|
|
214
|
+
return { ...single.result, action: { ...actionIdentity(single.action), provenance: "edit" } };
|
|
215
|
+
}
|
|
115
216
|
if (plans.precise.length > 1) {
|
|
116
217
|
return {
|
|
117
218
|
kind: "ambiguous",
|
|
@@ -120,26 +221,84 @@ export async function runFilteredCodeActionRefactor(options: {
|
|
|
120
221
|
),
|
|
121
222
|
};
|
|
122
223
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
224
|
+
if (matching.every(isCommandOnlyAction)) {
|
|
225
|
+
const eligible = captureEligibleActions(matching, response.advertisedCommands);
|
|
226
|
+
const [only] = eligible;
|
|
227
|
+
if (eligible.length === 1 && only) {
|
|
228
|
+
return captureCommandAction({ lsp, file, action: only, control: options.control });
|
|
229
|
+
}
|
|
230
|
+
return eligible.length > 1
|
|
231
|
+
? commandCandidates(eligible)
|
|
232
|
+
: unavailable(COMMAND_ONLY_ACTION_REASON);
|
|
233
|
+
}
|
|
234
|
+
return unavailable(
|
|
235
|
+
plans.unavailableReason
|
|
126
236
|
? `Matching code action is unavailable: ${plans.unavailableReason}`
|
|
127
|
-
: `Matching
|
|
128
|
-
|
|
237
|
+
: `Matching "${kind}" code actions did not produce precise edits.`,
|
|
238
|
+
);
|
|
129
239
|
}
|
|
130
240
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
241
|
+
/** Compute the zero-based UTF-16 range that covers a file's full current disk text. */
|
|
242
|
+
export function wholeDocumentRange(file: string): SourceRange | null {
|
|
243
|
+
let text: string;
|
|
244
|
+
try {
|
|
245
|
+
text = readFileSync(file, "utf-8");
|
|
246
|
+
} catch {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
const lines = text.split(/\r\n|\r|\n/);
|
|
250
|
+
return {
|
|
251
|
+
start: { line: 0, character: 0 },
|
|
252
|
+
end: { line: lines.length - 1, character: lines.at(-1)?.length ?? 0 },
|
|
253
|
+
};
|
|
134
254
|
}
|
|
135
255
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
256
|
+
function isTitledCodeAction(value: unknown): value is CodeAction {
|
|
257
|
+
return (
|
|
258
|
+
typeof value === "object" &&
|
|
259
|
+
value !== null &&
|
|
260
|
+
typeof (value as { title?: unknown }).title === "string"
|
|
140
261
|
);
|
|
141
262
|
}
|
|
142
263
|
|
|
264
|
+
/** Advertised kinds in one CodeActionKind family, such as `source*`. */
|
|
265
|
+
interface AdvertisedFamilyKinds {
|
|
266
|
+
/** Listed non-empty kinds in the requested kind's top-level family. */
|
|
267
|
+
readonly kinds: readonly string[];
|
|
268
|
+
/** The server lists CodeActionKind.Empty or no kinds, so it may return any kind. */
|
|
269
|
+
readonly anyKind: boolean;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function advertisedFamilyKinds(
|
|
273
|
+
advertised: readonly string[] | undefined,
|
|
274
|
+
kind: string,
|
|
275
|
+
): AdvertisedFamilyKinds {
|
|
276
|
+
const family = kind.split(".")[0] ?? kind;
|
|
277
|
+
return {
|
|
278
|
+
kinds: (advertised ?? []).filter(
|
|
279
|
+
(candidate) => candidate !== "" && isCodeActionKindWithin(candidate, family),
|
|
280
|
+
),
|
|
281
|
+
anyKind: !advertised || advertised.includes(""),
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function noKindMatchReason(kind: string, advertised: AdvertisedFamilyKinds): string {
|
|
286
|
+
const parts = [`No code action matches kind "${kind}" here.`];
|
|
287
|
+
if (advertised.kinds.length > 0) {
|
|
288
|
+
parts.push(`Server-advertised kinds: ${advertised.kinds.join(", ")}.`);
|
|
289
|
+
}
|
|
290
|
+
if (advertised.anyKind) {
|
|
291
|
+
parts.push("The server may return any code-action kind but returned none of this kind.");
|
|
292
|
+
} else if (advertised.kinds.length === 0) {
|
|
293
|
+
parts.push("The server advertises no kinds in this family.");
|
|
294
|
+
}
|
|
295
|
+
return parts.join(" ");
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function actionIdentity(action: CodeAction): RefactorActionIdentity {
|
|
299
|
+
return { kind: typeof action.kind === "string" ? action.kind : "", title: action.title };
|
|
300
|
+
}
|
|
301
|
+
|
|
143
302
|
interface PreciseCodeActionPlan {
|
|
144
303
|
action: CodeAction;
|
|
145
304
|
result: Extract<RefactorResult, { kind: "precise" }>;
|
|
@@ -187,18 +346,14 @@ function refactorCandidate(
|
|
|
187
346
|
result: Extract<RefactorResult, { kind: "precise" }>,
|
|
188
347
|
index: number,
|
|
189
348
|
plans: readonly { action: CodeAction }[],
|
|
190
|
-
): {
|
|
191
|
-
description: string;
|
|
192
|
-
file?: string;
|
|
193
|
-
line?: number;
|
|
194
|
-
character?: number;
|
|
195
|
-
} {
|
|
349
|
+
): DisambiguationCandidate {
|
|
196
350
|
const firstEdit = result.edits.edits[0];
|
|
197
351
|
const sameTitleCount = plans.filter((plan) => plan.action.title === action.title).length;
|
|
198
352
|
const description =
|
|
199
353
|
sameTitleCount > 1 ? `${action.title} (alternative ${index + 1})` : action.title;
|
|
200
354
|
return {
|
|
201
355
|
description,
|
|
356
|
+
...actionIdentity(action),
|
|
202
357
|
...(firstEdit
|
|
203
358
|
? {
|
|
204
359
|
file: firstEdit.file,
|
|
@@ -94,13 +94,19 @@ function symbolKindName(kind: number): string {
|
|
|
94
94
|
return SYMBOL_KIND_NAMES[kind] ?? "Unknown";
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Flatten provider symbols while preserving declaration and name anchors.
|
|
99
|
+
* Name anchors are recovered from `sourceText` (the synchronized open-document
|
|
100
|
+
* text) when given; otherwise from disk, or the server `selectionRange` start.
|
|
101
|
+
*/
|
|
98
102
|
export async function mapDocumentSymbols(
|
|
99
103
|
symbols: DocumentSymbol[] | SymbolInformation[],
|
|
100
104
|
filePath: string,
|
|
105
|
+
sourceText?: string | null,
|
|
101
106
|
): Promise<DocumentCodeSymbol[]> {
|
|
102
107
|
return flattenDocumentSymbols(symbols, filePath, null, {
|
|
103
|
-
sourceLines:
|
|
108
|
+
sourceLines:
|
|
109
|
+
typeof sourceText === "string" ? splitLines(sourceText) : await readSourceLines(filePath),
|
|
104
110
|
parent: null,
|
|
105
111
|
});
|
|
106
112
|
}
|
|
@@ -169,12 +175,16 @@ function isSymbolInformation(
|
|
|
169
175
|
|
|
170
176
|
async function readSourceLines(filePath: string): Promise<readonly string[] | null> {
|
|
171
177
|
try {
|
|
172
|
-
return (await readFile(filePath, "utf-8"))
|
|
178
|
+
return splitLines(await readFile(filePath, "utf-8"));
|
|
173
179
|
} catch {
|
|
174
180
|
return null;
|
|
175
181
|
}
|
|
176
182
|
}
|
|
177
183
|
|
|
184
|
+
function splitLines(text: string): readonly string[] {
|
|
185
|
+
return text.split(/\r?\n/);
|
|
186
|
+
}
|
|
187
|
+
|
|
178
188
|
function resolveDocumentSymbolNameStart(
|
|
179
189
|
symbol: DocumentSymbol,
|
|
180
190
|
sourceLines: readonly string[] | null,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Project-root boundary for mutation requests on one routed client. */
|
|
2
|
+
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Return why a file cannot be refactored by the client routed to it, or null.
|
|
8
|
+
*
|
|
9
|
+
* A file without its own project markers routes to a server rooted at the
|
|
10
|
+
* session directory. Its edits would fail the apply-time root check, so refuse
|
|
11
|
+
* before the request. Real paths are compared, so a link inside the root
|
|
12
|
+
* cannot reach an outside file.
|
|
13
|
+
*/
|
|
14
|
+
export function outsideRouteRootReason(file: string, root: string): string | null {
|
|
15
|
+
return isWithinOrEqual(canonical(root), canonical(file))
|
|
16
|
+
? null
|
|
17
|
+
: `File ${file} is outside the language server's project root ${root}.`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function canonical(file: string): string {
|
|
21
|
+
try {
|
|
22
|
+
return realpathSync(file);
|
|
23
|
+
} catch {
|
|
24
|
+
return file;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -40,6 +40,17 @@ export interface WorkspaceLspDiagnosticSurface {
|
|
|
40
40
|
getOutstandingDiagnosticSummary(
|
|
41
41
|
maxSeverity?: number,
|
|
42
42
|
): WorkspaceDiagnosticSnapshot<OutstandingDiagnosticSummaryEntry>;
|
|
43
|
+
/**
|
|
44
|
+
* Return absolute paths of tracked files removed from disk within `scope`
|
|
45
|
+
* since a report last showed them.
|
|
46
|
+
*
|
|
47
|
+
* The read does not consume removals. Passive snapshots and background
|
|
48
|
+
* refreshes leave them in place, so a later report can still show them
|
|
49
|
+
* regardless of timing. Recreated files are dropped.
|
|
50
|
+
*/
|
|
51
|
+
peekRemovedTrackedFiles(scope?: string | null): readonly string[];
|
|
52
|
+
/** Forget removals after a delivered diagnostic report has shown them. */
|
|
53
|
+
acknowledgeRemovedTrackedFiles(files: readonly string[]): void;
|
|
43
54
|
/** Run best-effort recovery and retain final diagnostic evidence, including failures. */
|
|
44
55
|
recoverDiagnostics(options?: {
|
|
45
56
|
restartIfStillStale?: boolean;
|