@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
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
// to suppress LSP errors on files that TypeScript itself would not include.
|
|
7
7
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
-
import ts from "typescript";
|
|
9
|
+
import type ts from "typescript";
|
|
10
10
|
import { collectExtendedProjectConfigs } from "./tsconfig-extends.ts";
|
|
11
11
|
import { normalizeTsconfigPath as normalizePath } from "./tsconfig-path.ts";
|
|
12
|
+
import { getTypeScript } from "./typescript-module.ts";
|
|
12
13
|
|
|
13
14
|
export { isProjectConfigFileName } from "./tsconfig-extends.ts";
|
|
14
15
|
|
|
@@ -74,7 +75,7 @@ export function isTsconfigApplicableFile(filePath: string): boolean {
|
|
|
74
75
|
const nearestConfigCache = new Map<string, string | null>();
|
|
75
76
|
const parsedConfigCache = new Map<string, ParsedProjectConfigCacheEntry>();
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
type TypeScriptInternal = typeof ts & {
|
|
78
79
|
getFileMatcherPatterns?: (
|
|
79
80
|
configDir: string,
|
|
80
81
|
excludes: readonly string[] | undefined,
|
|
@@ -91,6 +92,10 @@ const tsInternal = ts as typeof ts & {
|
|
|
91
92
|
) => ReadonlyArray<ReadonlyArray<string>>;
|
|
92
93
|
};
|
|
93
94
|
|
|
95
|
+
function getTypeScriptInternal(): TypeScriptInternal {
|
|
96
|
+
return getTypeScript() as TypeScriptInternal;
|
|
97
|
+
}
|
|
98
|
+
|
|
94
99
|
/**
|
|
95
100
|
* Check whether a file is excluded by its nearest tsconfig.json or jsconfig.json.
|
|
96
101
|
*
|
|
@@ -122,7 +127,7 @@ export function isFileExcludedByTsconfig(filePath: string, cwd: string): boolean
|
|
|
122
127
|
* project config without re-deriving the scope logic.
|
|
123
128
|
*/
|
|
124
129
|
export function getFileScopeDecision(filePath: string, cwd: string): FileScopeDecision {
|
|
125
|
-
const caseSensitiveFileNames =
|
|
130
|
+
const caseSensitiveFileNames = getTypeScript().sys.useCaseSensitiveFileNames;
|
|
126
131
|
const absolutePath = path.resolve(cwd, filePath);
|
|
127
132
|
if (isOutOfTree(cwd, absolutePath)) {
|
|
128
133
|
return {
|
|
@@ -212,6 +217,7 @@ function findNearestProjectConfig(startDir: string, rootDir: string): string | n
|
|
|
212
217
|
}
|
|
213
218
|
|
|
214
219
|
function getLocalProjectConfig(directory: string): string | null {
|
|
220
|
+
const ts = getTypeScript();
|
|
215
221
|
const tsconfigPath = path.join(directory, "tsconfig.json");
|
|
216
222
|
if (ts.sys.fileExists(tsconfigPath)) return tsconfigPath;
|
|
217
223
|
|
|
@@ -230,6 +236,7 @@ function parseProjectConfig(configPath: string): ParsedProjectConfig | null {
|
|
|
230
236
|
parsed: null,
|
|
231
237
|
dependencies: collectExtendedProjectConfigs(configPath),
|
|
232
238
|
};
|
|
239
|
+
const ts = getTypeScript();
|
|
233
240
|
const parsed = ts.getParsedCommandLineOfConfigFile(configPath, {}, createParseConfigHost());
|
|
234
241
|
if (!parsed) {
|
|
235
242
|
parsedConfigCache.set(normalizedConfigPath, cacheEntry);
|
|
@@ -343,6 +350,7 @@ function decideFileScope(
|
|
|
343
350
|
}
|
|
344
351
|
|
|
345
352
|
function getSupportedExtensions(options: ts.CompilerOptions): string[] {
|
|
353
|
+
const tsInternal = getTypeScriptInternal();
|
|
346
354
|
return tsInternal.getSupportedExtensions
|
|
347
355
|
? [...tsInternal.getSupportedExtensions(options, undefined).flat()]
|
|
348
356
|
: [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
@@ -353,12 +361,13 @@ function getFileMatcherPatterns(
|
|
|
353
361
|
excludeSpecs: readonly string[] | undefined,
|
|
354
362
|
includeSpecs: readonly string[] | undefined,
|
|
355
363
|
): { includeFilePattern?: string; excludePattern?: string } {
|
|
364
|
+
const tsInternal = getTypeScriptInternal();
|
|
356
365
|
return tsInternal.getFileMatcherPatterns
|
|
357
366
|
? tsInternal.getFileMatcherPatterns(
|
|
358
367
|
configDir,
|
|
359
368
|
excludeSpecs,
|
|
360
369
|
includeSpecs,
|
|
361
|
-
|
|
370
|
+
tsInternal.sys.useCaseSensitiveFileNames,
|
|
362
371
|
path.parse(configDir).root,
|
|
363
372
|
)
|
|
364
373
|
: {};
|
|
@@ -366,7 +375,7 @@ function getFileMatcherPatterns(
|
|
|
366
375
|
|
|
367
376
|
function createParseConfigHost(): ts.ParseConfigFileHost {
|
|
368
377
|
return {
|
|
369
|
-
...
|
|
378
|
+
...getTypeScript().sys,
|
|
370
379
|
onUnRecoverableConfigFileDiagnostic: () => {
|
|
371
380
|
// Treat invalid configs as unsupported rather than surfacing a secondary
|
|
372
381
|
// filter failure to the agent.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import type ts from "typescript";
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
let cached: typeof ts | undefined;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Load the bundled TypeScript compiler API on first use.
|
|
9
|
+
*
|
|
10
|
+
* Evaluating `typescript` costs roughly 100 ms, and most sessions and tests that import this
|
|
11
|
+
* package never ask a tsconfig question. Callers stay synchronous, so this uses `require`
|
|
12
|
+
* rather than a dynamic `import()`.
|
|
13
|
+
*/
|
|
14
|
+
export function getTypeScript(): typeof ts {
|
|
15
|
+
cached ??= require("typescript") as typeof ts;
|
|
16
|
+
return cached;
|
|
17
|
+
}
|
|
@@ -5,10 +5,20 @@ export const TENTATIVE_PUSH_UNAVAILABLE_REASON =
|
|
|
5
5
|
/** A final evidence state for one tracked document. */
|
|
6
6
|
export type DiagnosticEvidenceStatus = "confirmed" | "unconfirmed" | "failed" | "removed";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Why a document is not confirmed, when a specific cause is known.
|
|
10
|
+
*
|
|
11
|
+
* `disk-changed`: the file's disk metadata changed after its content was last
|
|
12
|
+
* read and diagnosed, for example through an edit outside Pi.
|
|
13
|
+
*/
|
|
14
|
+
export type DiagnosticEvidenceReason = "disk-changed";
|
|
15
|
+
|
|
8
16
|
/** Freshness evidence for one tracked document. */
|
|
9
17
|
export interface DiagnosticEvidenceDocument {
|
|
10
18
|
readonly file: string;
|
|
11
19
|
readonly status: DiagnosticEvidenceStatus;
|
|
20
|
+
/** Known cause for a non-confirmed status. */
|
|
21
|
+
readonly reason?: DiagnosticEvidenceReason;
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
/** Exact document coverage from a diagnostic snapshot or refresh attempt. */
|
|
@@ -35,3 +45,35 @@ export function summarizeDiagnosticEvidence(
|
|
|
35
45
|
for (const document of documents) counts[document.status]++;
|
|
36
46
|
return { ...counts, documents: [...documents] };
|
|
37
47
|
}
|
|
48
|
+
|
|
49
|
+
function evidenceStatusRank(status: DiagnosticEvidenceStatus): number {
|
|
50
|
+
switch (status) {
|
|
51
|
+
case "confirmed":
|
|
52
|
+
return 1;
|
|
53
|
+
case "unconfirmed":
|
|
54
|
+
return 2;
|
|
55
|
+
case "failed":
|
|
56
|
+
return 3;
|
|
57
|
+
case "removed":
|
|
58
|
+
return 4;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Choose the more conservative of two documents for the same file.
|
|
64
|
+
*
|
|
65
|
+
* The higher status rank wins. For equal rank, a known `reason` is kept so a
|
|
66
|
+
* reason-less duplicate from another route cannot drop it.
|
|
67
|
+
*/
|
|
68
|
+
export function preferEvidenceDocument(
|
|
69
|
+
existing: DiagnosticEvidenceDocument | undefined,
|
|
70
|
+
next: DiagnosticEvidenceDocument,
|
|
71
|
+
): DiagnosticEvidenceDocument {
|
|
72
|
+
if (!existing) return next;
|
|
73
|
+
const nextRank = evidenceStatusRank(next.status);
|
|
74
|
+
const existingRank = evidenceStatusRank(existing.status);
|
|
75
|
+
if (nextRank > existingRank) return next;
|
|
76
|
+
if (nextRank < existingRank) return existing;
|
|
77
|
+
if (existing.reason === undefined && next.reason !== undefined) return next;
|
|
78
|
+
return existing;
|
|
79
|
+
}
|
|
@@ -9,6 +9,7 @@ import { getDiagnosticFileState } from "../client/client-file-state.ts";
|
|
|
9
9
|
import {
|
|
10
10
|
type DiagnosticEvidenceDocument,
|
|
11
11
|
type DiagnosticEvidenceSummary,
|
|
12
|
+
preferEvidenceDocument,
|
|
12
13
|
summarizeDiagnosticEvidence,
|
|
13
14
|
} from "../diagnostics/evidence.ts";
|
|
14
15
|
|
|
@@ -82,23 +83,7 @@ function deduplicateEvidenceDocuments(
|
|
|
82
83
|
): DiagnosticEvidenceDocument[] {
|
|
83
84
|
const byFile = new Map<string, DiagnosticEvidenceDocument>();
|
|
84
85
|
for (const document of documents) {
|
|
85
|
-
|
|
86
|
-
if (!existing || evidenceStatusRank(document.status) > evidenceStatusRank(existing.status)) {
|
|
87
|
-
byFile.set(document.file, document);
|
|
88
|
-
}
|
|
86
|
+
byFile.set(document.file, preferEvidenceDocument(byFile.get(document.file), document));
|
|
89
87
|
}
|
|
90
88
|
return Array.from(byFile.values()).sort((a, b) => a.file.localeCompare(b.file));
|
|
91
89
|
}
|
|
92
|
-
|
|
93
|
-
function evidenceStatusRank(status: DiagnosticEvidenceDocument["status"]): number {
|
|
94
|
-
switch (status) {
|
|
95
|
-
case "confirmed":
|
|
96
|
-
return 1;
|
|
97
|
-
case "unconfirmed":
|
|
98
|
-
return 2;
|
|
99
|
-
case "failed":
|
|
100
|
-
return 3;
|
|
101
|
-
case "removed":
|
|
102
|
-
return 4;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
3
|
+
import { getDiagnosticFileState } from "../client/client-file-state.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Session-owned record of tracked files that disappeared from disk.
|
|
7
|
+
*
|
|
8
|
+
* Every path that clears tracked state for a missing file records the file here,
|
|
9
|
+
* including passive snapshot reads and background server-requested refreshes.
|
|
10
|
+
* The record survives until a caller acknowledges that a report showed the
|
|
11
|
+
* removal, so the removal does not depend on when the next refresh runs.
|
|
12
|
+
*
|
|
13
|
+
* Example: `rm src/a.ts`, then the TypeScript server sends
|
|
14
|
+
* `workspace/diagnostic/refresh`. The background refresh clears `src/a.ts`.
|
|
15
|
+
* A later `code_health({ refresh: true })` still reports it as removed.
|
|
16
|
+
*
|
|
17
|
+
* Entries come only from previously tracked files, so the record is bounded by
|
|
18
|
+
* the tracked-file state it replaces.
|
|
19
|
+
*/
|
|
20
|
+
export class RemovedTrackedFileLedger {
|
|
21
|
+
readonly #files = new Set<string>();
|
|
22
|
+
|
|
23
|
+
/** Record one removed tracked file. */
|
|
24
|
+
record(filePath: string): void {
|
|
25
|
+
this.#files.add(path.resolve(filePath));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Return retained removals within `scope`, sorted, without consuming them.
|
|
30
|
+
*
|
|
31
|
+
* Files that exist again are dropped: a recreated file is no longer removed.
|
|
32
|
+
*/
|
|
33
|
+
peek(scope: string | null = null): string[] {
|
|
34
|
+
for (const file of this.#files) {
|
|
35
|
+
if (getDiagnosticFileState(file) !== "removed") this.#files.delete(file);
|
|
36
|
+
}
|
|
37
|
+
const root = scope === null ? null : path.resolve(scope);
|
|
38
|
+
return Array.from(this.#files)
|
|
39
|
+
.filter((file) => root === null || isWithinOrEqual(root, file))
|
|
40
|
+
.sort((left, right) => left.localeCompare(right));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Forget removals that a delivered diagnostic report has shown. */
|
|
44
|
+
acknowledge(files: readonly string[]): void {
|
|
45
|
+
for (const file of files) this.#files.delete(path.resolve(file));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Forget every retained removal. */
|
|
49
|
+
clear(): void {
|
|
50
|
+
this.#files.clear();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
unavailableCodeQuery,
|
|
12
12
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
13
13
|
import * as projectRoots from "@mrclrchtr/supi-core/project";
|
|
14
|
-
import * as ts from "typescript";
|
|
15
14
|
import {
|
|
16
15
|
LspClient,
|
|
17
16
|
type LspClientLifecycleTransitionKind,
|
|
@@ -50,6 +49,7 @@ import type {
|
|
|
50
49
|
} from "../config/types.ts";
|
|
51
50
|
import { FileChangeType } from "../config/types.ts";
|
|
52
51
|
import { inspectTypeScriptLaunch } from "../config/typescript-launch.ts";
|
|
52
|
+
import { getTypeScript } from "../config/typescript-module.ts";
|
|
53
53
|
import { boundCwd } from "../debug-telemetry.ts";
|
|
54
54
|
import {
|
|
55
55
|
accumulateOutstandingDiagnostics,
|
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
import {
|
|
61
61
|
type DiagnosticEvidenceDocument,
|
|
62
62
|
type DiagnosticEvidenceSummary,
|
|
63
|
+
preferEvidenceDocument,
|
|
63
64
|
summarizeDiagnosticEvidence,
|
|
64
65
|
} from "../diagnostics/evidence.ts";
|
|
65
66
|
import {
|
|
@@ -120,6 +121,7 @@ import {
|
|
|
120
121
|
type StartupRetryRouteResult,
|
|
121
122
|
} from "./manager-process-crash-report.ts";
|
|
122
123
|
import { buildProjectServerInfo } from "./manager-project-info.ts";
|
|
124
|
+
import { RemovedTrackedFileLedger } from "./manager-removal-ledger.ts";
|
|
123
125
|
import type {
|
|
124
126
|
ActiveCoverageSummaryEntry,
|
|
125
127
|
CoverageSummaryEntry,
|
|
@@ -400,6 +402,8 @@ export class LspManager {
|
|
|
400
402
|
private retiredRoutes = new Set<string>();
|
|
401
403
|
/** Runtime-owned cleanup for clients removed by route retirement. */
|
|
402
404
|
private retiredClientShutdowns = new Set<Promise<void>>();
|
|
405
|
+
/** Tracked files removed from disk until a diagnostic report shows them. */
|
|
406
|
+
private readonly removedTrackedFiles = new RemovedTrackedFileLedger();
|
|
403
407
|
/** Shared diagnostic-recovery restart for each replaceable client route. */
|
|
404
408
|
private pendingRestarts = new Map<string, Promise<{ files: string[]; restarted: boolean }>>();
|
|
405
409
|
/** Monotonic ownership generation for each replaceable client route. */
|
|
@@ -582,6 +586,14 @@ export class LspManager {
|
|
|
582
586
|
);
|
|
583
587
|
}
|
|
584
588
|
|
|
589
|
+
/** Return the open document text last synchronized to the server, without starting one. */
|
|
590
|
+
getOpenDocumentContent(filePath: string): string | null {
|
|
591
|
+
const resolvedPath = resolveSessionPath(this.cwd, filePath);
|
|
592
|
+
return (
|
|
593
|
+
this.getExistingClientForFile(resolvedPath)?.getOpenDocumentContent(resolvedPath) ?? null
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
|
|
585
597
|
/**
|
|
586
598
|
* Coverage gap for a project-wide TypeScript request answered by `client`.
|
|
587
599
|
*
|
|
@@ -732,6 +744,7 @@ export class LspManager {
|
|
|
732
744
|
},
|
|
733
745
|
this.cwd,
|
|
734
746
|
this.fileAssociations,
|
|
747
|
+
(filePath) => this.removedTrackedFiles.record(filePath),
|
|
735
748
|
);
|
|
736
749
|
return client;
|
|
737
750
|
}
|
|
@@ -1107,7 +1120,9 @@ export class LspManager {
|
|
|
1107
1120
|
if (client.status !== "running" || !client.ready) return;
|
|
1108
1121
|
const key = clientKey(client.name, client.root);
|
|
1109
1122
|
const recovery = this.processCrashRecoveries.get(key);
|
|
1110
|
-
|
|
1123
|
+
// An in-flight recovery owns its record until it settles; removing it here
|
|
1124
|
+
// would make that recovery report cancellation for a live replacement.
|
|
1125
|
+
if (recovery && !recovery.pending) {
|
|
1111
1126
|
recovery.attemptConsumed = false;
|
|
1112
1127
|
recovery.statusReason = undefined;
|
|
1113
1128
|
recovery.failureMessage = undefined;
|
|
@@ -1524,7 +1539,7 @@ export class LspManager {
|
|
|
1524
1539
|
try {
|
|
1525
1540
|
recordDebugEvent({
|
|
1526
1541
|
source: "lsp",
|
|
1527
|
-
level: outcome === "failure" || outcome === "exhausted" ? "warning" : "
|
|
1542
|
+
level: outcome === "failure" || outcome === "exhausted" ? "warning" : "info",
|
|
1528
1543
|
category: "runtime.recovery",
|
|
1529
1544
|
message: `LSP process-crash recovery ${outcome}`,
|
|
1530
1545
|
cwd: boundCwd(this.cwd),
|
|
@@ -2306,6 +2321,24 @@ export class LspManager {
|
|
|
2306
2321
|
closeFile(filePath: string): void {
|
|
2307
2322
|
closeFileAcrossClients(this.clients.values(), resolveSessionPath(this.cwd, filePath));
|
|
2308
2323
|
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Return tracked files removed from disk since a report last showed them.
|
|
2326
|
+
*
|
|
2327
|
+
* The read does not consume the removals; call
|
|
2328
|
+
* {@link acknowledgeRemovedTrackedFiles} after a report delivered them.
|
|
2329
|
+
*/
|
|
2330
|
+
peekRemovedTrackedFiles(scope: string | null = null): string[] {
|
|
2331
|
+
this.pruneMissingFiles();
|
|
2332
|
+
return this.removedTrackedFiles.peek(
|
|
2333
|
+
scope === null ? null : resolveSessionPath(this.cwd, scope),
|
|
2334
|
+
);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
/** Forget removals that a delivered diagnostic report has shown. */
|
|
2338
|
+
acknowledgeRemovedTrackedFiles(files: readonly string[]): void {
|
|
2339
|
+
this.removedTrackedFiles.acknowledge(files.map((file) => resolveSessionPath(this.cwd, file)));
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2309
2342
|
/** Remove any missing files from open-document and diagnostic state. */
|
|
2310
2343
|
pruneMissingFiles(): string[] {
|
|
2311
2344
|
const removed = pruneMissingFilesFromClients(this.clients.values());
|
|
@@ -2625,6 +2658,7 @@ export class LspManager {
|
|
|
2625
2658
|
const shutdowns = clients.map((client) => client.shutdown().catch(() => {}));
|
|
2626
2659
|
await Promise.all([...shutdowns, ...this.retiredClientShutdowns]);
|
|
2627
2660
|
this.retiredClientShutdowns.clear();
|
|
2661
|
+
this.removedTrackedFiles.clear();
|
|
2628
2662
|
// Dispose every client so pending or active progress tokens and
|
|
2629
2663
|
// readiness promises cannot outlive the manager.
|
|
2630
2664
|
for (const client of clients) client.dispose();
|
|
@@ -2765,6 +2799,7 @@ export class LspManager {
|
|
|
2765
2799
|
snapshot.documents.map((document) => ({
|
|
2766
2800
|
file: relativeFilePathFromUri(document.uri, this.cwd),
|
|
2767
2801
|
status: document.status,
|
|
2802
|
+
...(document.reason ? { reason: document.reason } : {}),
|
|
2768
2803
|
})),
|
|
2769
2804
|
),
|
|
2770
2805
|
);
|
|
@@ -2819,6 +2854,7 @@ export class LspManager {
|
|
|
2819
2854
|
evidenceDocuments.push({
|
|
2820
2855
|
file: relativeFilePathFromUri(document.uri, this.cwd),
|
|
2821
2856
|
status: document.status,
|
|
2857
|
+
...(document.reason ? { reason: document.reason } : {}),
|
|
2822
2858
|
});
|
|
2823
2859
|
}
|
|
2824
2860
|
for (const entry of snapshot.entries) {
|
|
@@ -2896,6 +2932,7 @@ export class LspManager {
|
|
|
2896
2932
|
snapshot.documents.map((document) => ({
|
|
2897
2933
|
file: relativeFilePathFromUri(document.uri, this.cwd),
|
|
2898
2934
|
status: document.status,
|
|
2935
|
+
...(document.reason ? { reason: document.reason } : {}),
|
|
2899
2936
|
})),
|
|
2900
2937
|
);
|
|
2901
2938
|
const evidence = this.toWorkspaceDiagnosticEvidence(evidenceDocuments);
|
|
@@ -2940,7 +2977,7 @@ export class LspManager {
|
|
|
2940
2977
|
}
|
|
2941
2978
|
|
|
2942
2979
|
return {
|
|
2943
|
-
caseSensitiveFileNames:
|
|
2980
|
+
caseSensitiveFileNames: getTypeScript().sys.useCaseSensitiveFileNames,
|
|
2944
2981
|
counts: accumulator.counts,
|
|
2945
2982
|
basisCounts: accumulator.basisCounts,
|
|
2946
2983
|
entries: accumulator.entries,
|
|
@@ -2954,10 +2991,7 @@ export class LspManager {
|
|
|
2954
2991
|
for (const document of documents) {
|
|
2955
2992
|
const file = path.relative(this.cwd, path.resolve(this.cwd, document.file));
|
|
2956
2993
|
if (!this.isAutomaticScopePath(file)) continue;
|
|
2957
|
-
|
|
2958
|
-
if (!existing || evidenceStatusRank(document.status) > evidenceStatusRank(existing.status)) {
|
|
2959
|
-
byFile.set(file, { file, status: document.status });
|
|
2960
|
-
}
|
|
2994
|
+
byFile.set(file, preferEvidenceDocument(byFile.get(file), { ...document, file }));
|
|
2961
2995
|
}
|
|
2962
2996
|
return summarizeDiagnosticEvidence(
|
|
2963
2997
|
Array.from(byFile.values()).sort((a, b) => a.file.localeCompare(b.file)),
|
|
@@ -3518,6 +3552,7 @@ function collectClientDiagnosticEvidenceDocuments(
|
|
|
3518
3552
|
snapshot.documents.map((document) => ({
|
|
3519
3553
|
file: relativeFilePathFromUri(document.uri, cwd),
|
|
3520
3554
|
status: document.status,
|
|
3555
|
+
...(document.reason ? { reason: document.reason } : {}),
|
|
3521
3556
|
})),
|
|
3522
3557
|
);
|
|
3523
3558
|
}
|
|
@@ -3547,16 +3582,3 @@ function collectOutstandingDiagnosticSummaryEntries(
|
|
|
3547
3582
|
a.file.localeCompare(b.file),
|
|
3548
3583
|
);
|
|
3549
3584
|
}
|
|
3550
|
-
|
|
3551
|
-
function evidenceStatusRank(status: DiagnosticEvidenceDocument["status"]): number {
|
|
3552
|
-
switch (status) {
|
|
3553
|
-
case "confirmed":
|
|
3554
|
-
return 1;
|
|
3555
|
-
case "unconfirmed":
|
|
3556
|
-
return 2;
|
|
3557
|
-
case "failed":
|
|
3558
|
-
return 3;
|
|
3559
|
-
case "removed":
|
|
3560
|
-
return 4;
|
|
3561
|
-
}
|
|
3562
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
-
import ts from "typescript";
|
|
2
|
+
import type ts from "typescript";
|
|
3
|
+
import { getTypeScript } from "../config/typescript-module.ts";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Whether the identifier at `position` names a top-level declaration that only
|
|
@@ -22,6 +23,7 @@ export function isFileLocalTopLevelDeclaration(
|
|
|
22
23
|
} catch {
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
26
|
+
const ts = getTypeScript();
|
|
25
27
|
const sourceFile = ts.createSourceFile(filePath, text, ts.ScriptTarget.Latest, true);
|
|
26
28
|
if (!ts.isExternalModule(sourceFile)) return false;
|
|
27
29
|
let offset: number;
|
|
@@ -44,6 +46,7 @@ function topLevelDeclarationNameAt(
|
|
|
44
46
|
offset: number,
|
|
45
47
|
sourceFile: ts.SourceFile,
|
|
46
48
|
): string | null {
|
|
49
|
+
const ts = getTypeScript();
|
|
47
50
|
const names: ts.Identifier[] = [];
|
|
48
51
|
if (
|
|
49
52
|
ts.isFunctionDeclaration(statement) ||
|
|
@@ -63,6 +66,7 @@ function topLevelDeclarationNameAt(
|
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
function hasExportModifier(statement: ts.Statement): boolean {
|
|
69
|
+
const ts = getTypeScript();
|
|
66
70
|
return (
|
|
67
71
|
ts.canHaveModifiers(statement) &&
|
|
68
72
|
(ts.getModifiers(statement) ?? []).some(
|
|
@@ -75,6 +79,7 @@ function hasExportModifier(statement: ts.Statement): boolean {
|
|
|
75
79
|
|
|
76
80
|
/** `export { name }`, `export default name`, or `export = name` in this file. */
|
|
77
81
|
function exportedByName(sourceFile: ts.SourceFile, name: string): boolean {
|
|
82
|
+
const ts = getTypeScript();
|
|
78
83
|
return sourceFile.statements.some((statement) => {
|
|
79
84
|
if (ts.isExportAssignment(statement)) {
|
|
80
85
|
return ts.isIdentifier(statement.expression) && statement.expression.text === name;
|
|
@@ -7,10 +7,10 @@ import type {
|
|
|
7
7
|
import type { WorkspaceLspRuntime } from "../session/runtime-registry.ts";
|
|
8
8
|
import {
|
|
9
9
|
collectCodeActionResults,
|
|
10
|
-
|
|
11
|
-
isUpdateImportsCodeAction,
|
|
12
|
-
runFilteredCodeActionRefactor,
|
|
10
|
+
runCodeActionRefactor,
|
|
13
11
|
runRenameRefactor,
|
|
12
|
+
runSourceActionRefactor,
|
|
13
|
+
wholeDocumentRange,
|
|
14
14
|
} from "./refactor-planning.ts";
|
|
15
15
|
|
|
16
16
|
/** Build optional refactor methods for the semantic provider adapter. */
|
|
@@ -45,12 +45,6 @@ async function planRefactor(
|
|
|
45
45
|
): Promise<RefactorResult> {
|
|
46
46
|
switch (request.operation) {
|
|
47
47
|
case "rename_symbol":
|
|
48
|
-
if (!request.newName) {
|
|
49
|
-
return {
|
|
50
|
-
kind: "unavailable",
|
|
51
|
-
reason: 'Refactor operation "rename_symbol" requires `newName`.',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
48
|
return runRenameRefactor({
|
|
55
49
|
lsp,
|
|
56
50
|
file: request.file,
|
|
@@ -58,39 +52,31 @@ async function planRefactor(
|
|
|
58
52
|
newName: request.newName,
|
|
59
53
|
control,
|
|
60
54
|
});
|
|
61
|
-
case "
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
kind: "unavailable",
|
|
65
|
-
reason: `Refactor operation "${request.operation}" is unavailable: standard LSP code actions do not provide a safe exact extraction-name contract.`,
|
|
66
|
-
};
|
|
67
|
-
case "update_imports":
|
|
68
|
-
return runFilteredCodeActionRefactor({
|
|
55
|
+
case "code_action":
|
|
56
|
+
return runCodeActionRefactor({
|
|
69
57
|
lsp,
|
|
70
58
|
file: request.file,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
range: request.range,
|
|
60
|
+
kind: request.kind,
|
|
61
|
+
title: request.title,
|
|
62
|
+
label: "Code action",
|
|
74
63
|
control,
|
|
75
64
|
});
|
|
76
|
-
case "
|
|
77
|
-
|
|
65
|
+
case "source_action": {
|
|
66
|
+
// LSP source actions apply to the entire file, so request the whole document.
|
|
67
|
+
const range = wholeDocumentRange(request.file);
|
|
68
|
+
if (!range) {
|
|
69
|
+
return { kind: "unavailable", reason: `File ${request.file} could not be read.` };
|
|
70
|
+
}
|
|
71
|
+
return runSourceActionRefactor({
|
|
78
72
|
lsp,
|
|
79
73
|
file: request.file,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
range,
|
|
75
|
+
kind: request.kind,
|
|
76
|
+
title: request.title,
|
|
77
|
+
label: "Source action",
|
|
83
78
|
control,
|
|
84
79
|
});
|
|
85
|
-
|
|
86
|
-
case "move_file":
|
|
87
|
-
return {
|
|
88
|
-
kind: "unavailable",
|
|
89
|
-
reason: `Refactor operation "${request.operation}" is not supported yet. File/resource operations are deferred.`,
|
|
90
|
-
};
|
|
80
|
+
}
|
|
91
81
|
}
|
|
92
|
-
return {
|
|
93
|
-
kind: "unavailable",
|
|
94
|
-
reason: `Refactor operation "${request.operation}" is not supported by the active semantic provider.`,
|
|
95
|
-
};
|
|
96
82
|
}
|
|
@@ -83,7 +83,12 @@ export function createLspSemanticProvider(lsp: WorkspaceLspRuntime): SemanticPro
|
|
|
83
83
|
? await lsp.documentSymbols(filePath, control)
|
|
84
84
|
: await lsp.documentSymbols(filePath);
|
|
85
85
|
if (result.kind === "unavailable") return unavailableCodeQuery(result.reason);
|
|
86
|
-
|
|
86
|
+
// Anchor names against the text the server analyzed, not possibly newer disk content.
|
|
87
|
+
const symbols = await mapDocumentSymbols(
|
|
88
|
+
result.data,
|
|
89
|
+
filePath,
|
|
90
|
+
lsp.getOpenDocumentContent(filePath),
|
|
91
|
+
);
|
|
87
92
|
return result.kind === "partial"
|
|
88
93
|
? partialCodeQuery(symbols, result.reason)
|
|
89
94
|
: completedCodeQuery(symbols);
|