@duckmind/dm-linux-x64 0.65.8 → 0.66.2
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/dm +2 -2
- package/extensions/.dm-extensions.json +14 -548
- package/extensions/dm-lens/clients/dispatch/runners/utils/runner-helpers.js +1 -1
- package/extensions/dm-mcp-adapter/mcp-keyring-helper.cjs +1 -1
- package/extensions/dm-ponytail/hooks/ponytail-activate.js +1 -1
- package/extensions/dm-ponytail/hooks/ponytail-instructions.js +1 -1
- package/extensions/dm-subagents/src/extension/tool-activation.js +7 -2
- package/extensions/dm-subagents/src/runs/background/runner-aliases.js +2 -2
- package/extensions/dm-subagents/src/runs/foreground/prompt-audit.js +4 -1
- package/extensions/dm-subagents/src/runs/shared/child-session.js +8 -6
- package/extensions/dm-subagents/src/runs/shared/dm-spawn.js +5 -1
- package/extensions/dm-subagents/src/watchdog/permission-arbiter.js +9 -1
- package/extensions/dm-subagents/src/watchdog/review.js +4 -1
- package/extensions/dm-web-access/tool-activation.js +0 -1
- package/package.json +1 -1
- package/extensions/dm-lens/dist/clients/actionable-warnings-logger.js +0 -24
- package/extensions/dm-lens/dist/clients/actionable-warnings.js +0 -1014
- package/extensions/dm-lens/dist/clients/advisory-provenance.js +0 -385
- package/extensions/dm-lens/dist/clients/agent-behavior-client.js +0 -94
- package/extensions/dm-lens/dist/clients/agent-nudge.js +0 -151
- package/extensions/dm-lens/dist/clients/analysed-root.js +0 -1
- package/extensions/dm-lens/dist/clients/ast-grep-client.js +0 -576
- package/extensions/dm-lens/dist/clients/ast-grep-rule-manager.js +0 -114
- package/extensions/dm-lens/dist/clients/ast-grep-tool-logger.js +0 -85
- package/extensions/dm-lens/dist/clients/ast-grep-types.js +0 -1
- package/extensions/dm-lens/dist/clients/ast-grep-yaml-synth.js +0 -109
- package/extensions/dm-lens/dist/clients/atomic-write-staging.js +0 -66
- package/extensions/dm-lens/dist/clients/atomic-write.js +0 -37
- package/extensions/dm-lens/dist/clients/availability-probe-flight.js +0 -11
- package/extensions/dm-lens/dist/clients/bash-file-access.js +0 -830
- package/extensions/dm-lens/dist/clients/biome-client.js +0 -221
- package/extensions/dm-lens/dist/clients/blocker-freshness.js +0 -385
- package/extensions/dm-lens/dist/clients/blocker-past-eof.js +0 -49
- package/extensions/dm-lens/dist/clients/bootstrap.js +0 -246
- package/extensions/dm-lens/dist/clients/bounded-cache.js +0 -105
- package/extensions/dm-lens/dist/clients/bounded-pid-file-lock.js +0 -173
- package/extensions/dm-lens/dist/clients/bounded-telemetry.js +0 -104
- package/extensions/dm-lens/dist/clients/build-identity.js +0 -45
- package/extensions/dm-lens/dist/clients/bundled-resource-health.js +0 -41
- package/extensions/dm-lens/dist/clients/bus-events-logger.js +0 -48
- package/extensions/dm-lens/dist/clients/bus-publish.js +0 -117
- package/extensions/dm-lens/dist/clients/cache/rule-cache.js +0 -103
- package/extensions/dm-lens/dist/clients/cache-manager.js +0 -340
- package/extensions/dm-lens/dist/clients/cache-observability.js +0 -847
- package/extensions/dm-lens/dist/clients/call-graph.js +0 -628
- package/extensions/dm-lens/dist/clients/cargo-manifest.js +0 -151
- package/extensions/dm-lens/dist/clients/cascade-budget.js +0 -52
- package/extensions/dm-lens/dist/clients/cascade-format.js +0 -160
- package/extensions/dm-lens/dist/clients/cascade-logger.js +0 -22
- package/extensions/dm-lens/dist/clients/cascade-types.js +0 -1
- package/extensions/dm-lens/dist/clients/child-unref.js +0 -59
- package/extensions/dm-lens/dist/clients/code-quality-warnings.js +0 -192
- package/extensions/dm-lens/dist/clients/codebase-model.js +0 -110
- package/extensions/dm-lens/dist/clients/collateral-test-role.js +0 -8
- package/extensions/dm-lens/dist/clients/complexity-client.js +0 -398
- package/extensions/dm-lens/dist/clients/config-core/deny.js +0 -117
- package/extensions/dm-lens/dist/clients/config-core/index.js +0 -2
- package/extensions/dm-lens/dist/clients/config-core/merge.js +0 -228
- package/extensions/dm-lens/dist/clients/config-core/normalize.js +0 -217
- package/extensions/dm-lens/dist/clients/config-core/process-spec.js +0 -147
- package/extensions/dm-lens/dist/clients/config-core/provenance.js +0 -54
- package/extensions/dm-lens/dist/clients/config-core/records.js +0 -79
- package/extensions/dm-lens/dist/clients/config-core/resolve.js +0 -48
- package/extensions/dm-lens/dist/clients/config-core/safe-object.js +0 -22
- package/extensions/dm-lens/dist/clients/config-core/schema.js +0 -90
- package/extensions/dm-lens/dist/clients/config-diagnostic-codes.js +0 -90
- package/extensions/dm-lens/dist/clients/config-locations.js +0 -175
- package/extensions/dm-lens/dist/clients/config-resolve.js +0 -359
- package/extensions/dm-lens/dist/clients/config-schema.js +0 -128
- package/extensions/dm-lens/dist/clients/config-warn.js +0 -146
- package/extensions/dm-lens/dist/clients/console-guard-install.js +0 -4
- package/extensions/dm-lens/dist/clients/cooperative-budget.js +0 -36
- package/extensions/dm-lens/dist/clients/dead-code-client.js +0 -342
- package/extensions/dm-lens/dist/clients/dead-code-logger.js +0 -18
- package/extensions/dm-lens/dist/clients/deadline-utils.js +0 -117
- package/extensions/dm-lens/dist/clients/debug-handles.js +0 -121
- package/extensions/dm-lens/dist/clients/debug-heap.js +0 -80
- package/extensions/dm-lens/dist/clients/deferred-lsp-work.js +0 -33
- package/extensions/dm-lens/dist/clients/degradation-ledger.js +0 -272
- package/extensions/dm-lens/dist/clients/demoted-finding-render.js +0 -61
- package/extensions/dm-lens/dist/clients/dependency-checker.js +0 -525
- package/extensions/dm-lens/dist/clients/deps/ast-grep-napi.js +0 -17
- package/extensions/dm-lens/dist/clients/deps/dm-host-deps.js +0 -10
- package/extensions/dm-lens/dist/clients/deps/dm-tui-compat.js +0 -58
- package/extensions/dm-lens/dist/clients/deps/js-yaml.js +0 -7
- package/extensions/dm-lens/dist/clients/deps/minimatch.js +0 -6
- package/extensions/dm-lens/dist/clients/deps/pidusage.js +0 -5
- package/extensions/dm-lens/dist/clients/deps/typebox.js +0 -5
- package/extensions/dm-lens/dist/clients/deps/vscode-jsonrpc.js +0 -8
- package/extensions/dm-lens/dist/clients/deps/web-tree-sitter.js +0 -11
- package/extensions/dm-lens/dist/clients/diagnostic-dispositions.js +0 -318
- package/extensions/dm-lens/dist/clients/diagnostic-line-freshness.js +0 -144
- package/extensions/dm-lens/dist/clients/diagnostic-logger.js +0 -60
- package/extensions/dm-lens/dist/clients/diagnostic-tracker.js +0 -89
- package/extensions/dm-lens/dist/clients/diagnostics-publish.js +0 -134
- package/extensions/dm-lens/dist/clients/dispatch/ast-grep-catalog.js +0 -16
- package/extensions/dm-lens/dist/clients/dispatch/auxiliary-lsp.js +0 -158
- package/extensions/dm-lens/dist/clients/dispatch/collect-later-tier.js +0 -25
- package/extensions/dm-lens/dist/clients/dispatch/diagnostic-taxonomy.js +0 -58
- package/extensions/dm-lens/dist/clients/dispatch/dispatcher.js +0 -953
- package/extensions/dm-lens/dist/clients/dispatch/fact-provider-types.js +0 -1
- package/extensions/dm-lens/dist/clients/dispatch/fact-rule-runner.js +0 -17
- package/extensions/dm-lens/dist/clients/dispatch/fact-runner.js +0 -18
- package/extensions/dm-lens/dist/clients/dispatch/fact-scheduler.js +0 -52
- package/extensions/dm-lens/dist/clients/dispatch/fact-store.js +0 -199
- package/extensions/dm-lens/dist/clients/dispatch/facts/comment-facts.js +0 -20
- package/extensions/dm-lens/dist/clients/dispatch/facts/file-content.js +0 -18
- package/extensions/dm-lens/dist/clients/dispatch/facts/function-facts.js +0 -281
- package/extensions/dm-lens/dist/clients/dispatch/facts/import-facts.js +0 -169
- package/extensions/dm-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +0 -19
- package/extensions/dm-lens/dist/clients/dispatch/facts/try-catch-facts.js +0 -95
- package/extensions/dm-lens/dist/clients/dispatch/finding-policy.js +0 -159
- package/extensions/dm-lens/dist/clients/dispatch/indent-detect.js +0 -227
- package/extensions/dm-lens/dist/clients/dispatch/inline-suppressions.js +0 -52
- package/extensions/dm-lens/dist/clients/dispatch/integration.js +0 -1463
- package/extensions/dm-lens/dist/clients/dispatch/lazy.js +0 -8
- package/extensions/dm-lens/dist/clients/dispatch/pending-runner-findings.js +0 -75
- package/extensions/dm-lens/dist/clients/dispatch/plan.js +0 -278
- package/extensions/dm-lens/dist/clients/dispatch/priorities.js +0 -14
- package/extensions/dm-lens/dist/clients/dispatch/rule-id-normalize.js +0 -42
- package/extensions/dm-lens/dist/clients/dispatch/rule-ignores.js +0 -21
- package/extensions/dm-lens/dist/clients/dispatch/rule-policy.js +0 -73
- package/extensions/dm-lens/dist/clients/dispatch/rules/async-noise.js +0 -31
- package/extensions/dm-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +0 -27
- package/extensions/dm-lens/dist/clients/dispatch/rules/cors-wildcard.js +0 -35
- package/extensions/dm-lens/dist/clients/dispatch/rules/error-obscuring.js +0 -29
- package/extensions/dm-lens/dist/clients/dispatch/rules/error-swallowing.js +0 -29
- package/extensions/dm-lens/dist/clients/dispatch/rules/framework-call-noise.js +0 -31
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-complexity.js +0 -56
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-fan-out.js +0 -45
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-import-coupling.js +0 -31
- package/extensions/dm-lens/dist/clients/dispatch/rules/missing-error-propagation.js +0 -45
- package/extensions/dm-lens/dist/clients/dispatch/rules/no-commented-credentials.js +0 -46
- package/extensions/dm-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +0 -38
- package/extensions/dm-lens/dist/clients/dispatch/rules/placeholder-comments.js +0 -40
- package/extensions/dm-lens/dist/clients/dispatch/rules/unsafe-boundary.js +0 -101
- package/extensions/dm-lens/dist/clients/dispatch/runner-context.js +0 -46
- package/extensions/dm-lens/dist/clients/dispatch/runners/actionlint.js +0 -98
- package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-napi.js +0 -690
- package/extensions/dm-lens/dist/clients/dispatch/runners/biome-check.js +0 -202
- package/extensions/dm-lens/dist/clients/dispatch/runners/cpp-check.js +0 -190
- package/extensions/dm-lens/dist/clients/dispatch/runners/credo.js +0 -66
- package/extensions/dm-lens/dist/clients/dispatch/runners/cue-vet.js +0 -167
- package/extensions/dm-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -151
- package/extensions/dm-lens/dist/clients/dispatch/runners/detekt.js +0 -157
- package/extensions/dm-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -157
- package/extensions/dm-lens/dist/clients/dispatch/runners/elixir-check.js +0 -153
- package/extensions/dm-lens/dist/clients/dispatch/runners/eslint.js +0 -99
- package/extensions/dm-lens/dist/clients/dispatch/runners/fact-rules.js +0 -20
- package/extensions/dm-lens/dist/clients/dispatch/runners/fish-indent.js +0 -65
- package/extensions/dm-lens/dist/clients/dispatch/runners/gleam-check.js +0 -107
- package/extensions/dm-lens/dist/clients/dispatch/runners/go-vet.js +0 -51
- package/extensions/dm-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -89
- package/extensions/dm-lens/dist/clients/dispatch/runners/hadolint.js +0 -83
- package/extensions/dm-lens/dist/clients/dispatch/runners/helm-lint.js +0 -144
- package/extensions/dm-lens/dist/clients/dispatch/runners/helm-render.js +0 -593
- package/extensions/dm-lens/dist/clients/dispatch/runners/htmlhint.js +0 -103
- package/extensions/dm-lens/dist/clients/dispatch/runners/index.js +0 -100
- package/extensions/dm-lens/dist/clients/dispatch/runners/javac.js +0 -82
- package/extensions/dm-lens/dist/clients/dispatch/runners/ktlint.js +0 -93
- package/extensions/dm-lens/dist/clients/dispatch/runners/lsp.js +0 -206
- package/extensions/dm-lens/dist/clients/dispatch/runners/markdownlint.js +0 -129
- package/extensions/dm-lens/dist/clients/dispatch/runners/mypy.js +0 -70
- package/extensions/dm-lens/dist/clients/dispatch/runners/oxlint.js +0 -305
- package/extensions/dm-lens/dist/clients/dispatch/runners/php-lint.js +0 -70
- package/extensions/dm-lens/dist/clients/dispatch/runners/phpstan.js +0 -90
- package/extensions/dm-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -56
- package/extensions/dm-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -307
- package/extensions/dm-lens/dist/clients/dispatch/runners/pyright.js +0 -118
- package/extensions/dm-lens/dist/clients/dispatch/runners/rubocop.js +0 -79
- package/extensions/dm-lens/dist/clients/dispatch/runners/ruff.js +0 -69
- package/extensions/dm-lens/dist/clients/dispatch/runners/rust-clippy.js +0 -147
- package/extensions/dm-lens/dist/clients/dispatch/runners/shellcheck.js +0 -111
- package/extensions/dm-lens/dist/clients/dispatch/runners/shfmt.js +0 -81
- package/extensions/dm-lens/dist/clients/dispatch/runners/spellcheck.js +0 -74
- package/extensions/dm-lens/dist/clients/dispatch/runners/spotbugs.js +0 -208
- package/extensions/dm-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -136
- package/extensions/dm-lens/dist/clients/dispatch/runners/stylelint.js +0 -118
- package/extensions/dm-lens/dist/clients/dispatch/runners/swiftlint.js +0 -143
- package/extensions/dm-lens/dist/clients/dispatch/runners/taplo.js +0 -97
- package/extensions/dm-lens/dist/clients/dispatch/runners/terragrunt.js +0 -110
- package/extensions/dm-lens/dist/clients/dispatch/runners/tflint.js +0 -104
- package/extensions/dm-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -516
- package/extensions/dm-lens/dist/clients/dispatch/runners/trivy-config.js +0 -155
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/availability-policy.js +0 -285
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +0 -61
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -61
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +0 -130
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +0 -1067
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +0 -40
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/tool-failure.js +0 -117
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +0 -88
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils.js +0 -8
- package/extensions/dm-lens/dist/clients/dispatch/runners/vale.js +0 -106
- package/extensions/dm-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +0 -163
- package/extensions/dm-lens/dist/clients/dispatch/runners/yamllint.js +0 -83
- package/extensions/dm-lens/dist/clients/dispatch/runners/zig-check.js +0 -72
- package/extensions/dm-lens/dist/clients/dispatch/suppress-writer.js +0 -57
- package/extensions/dm-lens/dist/clients/dispatch/tool-profile.js +0 -30
- package/extensions/dm-lens/dist/clients/dispatch/types.js +0 -7
- package/extensions/dm-lens/dist/clients/dispatch/utils/format-utils.js +0 -45
- package/extensions/dm-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +0 -31
- package/extensions/dm-lens/dist/clients/disposition-logger.js +0 -19
- package/extensions/dm-lens/dist/clients/disposition-publish.js +0 -88
- package/extensions/dm-lens/dist/clients/durable-store.js +0 -77
- package/extensions/dm-lens/dist/clients/effective-config.js +0 -160
- package/extensions/dm-lens/dist/clients/env-utils.js +0 -26
- package/extensions/dm-lens/dist/clients/error-class.js +0 -3
- package/extensions/dm-lens/dist/clients/eval-timestamp.js +0 -2
- package/extensions/dm-lens/dist/clients/event-loop-hold.js +0 -119
- package/extensions/dm-lens/dist/clients/event-loop-monitor.js +0 -84
- package/extensions/dm-lens/dist/clients/extension-log.js +0 -230
- package/extensions/dm-lens/dist/clients/extension-mode.js +0 -20
- package/extensions/dm-lens/dist/clients/feature-hints.js +0 -88
- package/extensions/dm-lens/dist/clients/file-kinds.js +0 -304
- package/extensions/dm-lens/dist/clients/file-role.js +0 -50
- package/extensions/dm-lens/dist/clients/file-time.js +0 -112
- package/extensions/dm-lens/dist/clients/file-utils.js +0 -630
- package/extensions/dm-lens/dist/clients/finding-delivery-gate.js +0 -129
- package/extensions/dm-lens/dist/clients/finding-identity.js +0 -23
- package/extensions/dm-lens/dist/clients/fix-worklog.js +0 -75
- package/extensions/dm-lens/dist/clients/format-events-publish.js +0 -230
- package/extensions/dm-lens/dist/clients/format-service.js +0 -154
- package/extensions/dm-lens/dist/clients/formatters-lazy.js +0 -8
- package/extensions/dm-lens/dist/clients/formatters.js +0 -1351
- package/extensions/dm-lens/dist/clients/freshness-cadence.js +0 -1
- package/extensions/dm-lens/dist/clients/freshness.js +0 -8
- package/extensions/dm-lens/dist/clients/generated-artifacts.js +0 -209
- package/extensions/dm-lens/dist/clients/generation-guard.js +0 -105
- package/extensions/dm-lens/dist/clients/git-guard.js +0 -770
- package/extensions/dm-lens/dist/clients/git-tracked-ignore.js +0 -120
- package/extensions/dm-lens/dist/clients/gitleaks-client.js +0 -282
- package/extensions/dm-lens/dist/clients/go-client.js +0 -47
- package/extensions/dm-lens/dist/clients/govulncheck-client.js +0 -411
- package/extensions/dm-lens/dist/clients/gradle-ktfmt-style.js +0 -177
- package/extensions/dm-lens/dist/clients/grammar-source.js +0 -224
- package/extensions/dm-lens/dist/clients/gzip-stage-write.js +0 -85
- package/extensions/dm-lens/dist/clients/hashline-anchor.js +0 -222
- package/extensions/dm-lens/dist/clients/hook-budgets.js +0 -16
- package/extensions/dm-lens/dist/clients/host-edit-normalize.js +0 -87
- package/extensions/dm-lens/dist/clients/host-ports.js +0 -35
- package/extensions/dm-lens/dist/clients/indent-retarget.js +0 -102
- package/extensions/dm-lens/dist/clients/inline-blocker-dispositions.js +0 -103
- package/extensions/dm-lens/dist/clients/install-diagnostics.js +0 -123
- package/extensions/dm-lens/dist/clients/installer/index.js +0 -3770
- package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh-session.js +0 -17
- package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh.js +0 -522
- package/extensions/dm-lens/dist/clients/instance-reaper-state.js +0 -3
- package/extensions/dm-lens/dist/clients/instance-reaper.js +0 -577
- package/extensions/dm-lens/dist/clients/instance-registry-lock.js +0 -131
- package/extensions/dm-lens/dist/clients/instance-registry.js +0 -452
- package/extensions/dm-lens/dist/clients/jscpd-client.js +0 -252
- package/extensions/dm-lens/dist/clients/json-cache-read.js +0 -25
- package/extensions/dm-lens/dist/clients/knip-client.js +0 -472
- package/extensions/dm-lens/dist/clients/language-policy.js +0 -242
- package/extensions/dm-lens/dist/clients/language-profile.js +0 -261
- package/extensions/dm-lens/dist/clients/language-registry.js +0 -424
- package/extensions/dm-lens/dist/clients/latency-logger.js +0 -192
- package/extensions/dm-lens/dist/clients/lazy-import.js +0 -14
- package/extensions/dm-lens/dist/clients/ledger-bounds.js +0 -21
- package/extensions/dm-lens/dist/clients/lens-config.js +0 -237
- package/extensions/dm-lens/dist/clients/lens-engine.js +0 -181
- package/extensions/dm-lens/dist/clients/lens-events.js +0 -105
- package/extensions/dm-lens/dist/clients/lens-flag-registry.js +0 -302
- package/extensions/dm-lens/dist/clients/lens-map.js +0 -980
- package/extensions/dm-lens/dist/clients/live-bus-emitter.js +0 -53
- package/extensions/dm-lens/dist/clients/log-cleanup.js +0 -138
- package/extensions/dm-lens/dist/clients/lsp/aggregation.js +0 -88
- package/extensions/dm-lens/dist/clients/lsp/cascade-tier.js +0 -203
- package/extensions/dm-lens/dist/clients/lsp/client.js +0 -2709
- package/extensions/dm-lens/dist/clients/lsp/config.js +0 -252
- package/extensions/dm-lens/dist/clients/lsp/content-limits.js +0 -21
- package/extensions/dm-lens/dist/clients/lsp/diagnostic-binding.js +0 -79
- package/extensions/dm-lens/dist/clients/lsp/document-drift.js +0 -312
- package/extensions/dm-lens/dist/clients/lsp/edits.js +0 -930
- package/extensions/dm-lens/dist/clients/lsp/index.js +0 -4448
- package/extensions/dm-lens/dist/clients/lsp/inferred-project.js +0 -121
- package/extensions/dm-lens/dist/clients/lsp/jvm-runtime.js +0 -194
- package/extensions/dm-lens/dist/clients/lsp/language.js +0 -23
- package/extensions/dm-lens/dist/clients/lsp/launch.js +0 -468
- package/extensions/dm-lens/dist/clients/lsp/lombok.js +0 -146
- package/extensions/dm-lens/dist/clients/lsp/path-utils.js +0 -1
- package/extensions/dm-lens/dist/clients/lsp/pending-aux-coverage.js +0 -90
- package/extensions/dm-lens/dist/clients/lsp/position-encoding.js +0 -28
- package/extensions/dm-lens/dist/clients/lsp/ruby-drive-dirs.js +0 -42
- package/extensions/dm-lens/dist/clients/lsp/server.js +0 -2422
- package/extensions/dm-lens/dist/clients/lsp/session-roots.js +0 -52
- package/extensions/dm-lens/dist/clients/lsp/spawn-history.js +0 -15
- package/extensions/dm-lens/dist/clients/lsp/sync-kind.js +0 -30
- package/extensions/dm-lens/dist/clients/lsp/tsserver-sync.js +0 -156
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +0 -1
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/classification.js +0 -36
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/index.js +0 -3
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/strategies.js +0 -175
- package/extensions/dm-lens/dist/clients/lsp/watch-queue.js +0 -40
- package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-cache.js +0 -267
- package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-session.js +0 -7
- package/extensions/dm-lens/dist/clients/lsp/workspace-sweep-hold.js +0 -93
- package/extensions/dm-lens/dist/clients/lsp-budget.js +0 -83
- package/extensions/dm-lens/dist/clients/lsp-document-symbols.js +0 -93
- package/extensions/dm-lens/dist/clients/lsp-lazy.js +0 -8
- package/extensions/dm-lens/dist/clients/lsp-mutation.js +0 -273
- package/extensions/dm-lens/dist/clients/lsp-status.js +0 -37
- package/extensions/dm-lens/dist/clients/map-with-concurrency.js +0 -20
- package/extensions/dm-lens/dist/clients/mcp/analyze.js +0 -251
- package/extensions/dm-lens/dist/clients/mcp/host-shim.js +0 -14
- package/extensions/dm-lens/dist/clients/mcp/ipc.js +0 -302
- package/extensions/dm-lens/dist/clients/mcp/review.js +0 -137
- package/extensions/dm-lens/dist/clients/mcp/session.js +0 -305
- package/extensions/dm-lens/dist/clients/memory-sampler.js +0 -107
- package/extensions/dm-lens/dist/clients/message-end-attribution.js +0 -18
- package/extensions/dm-lens/dist/clients/metrics-client.js +0 -80
- package/extensions/dm-lens/dist/clients/metrics-history.js +0 -255
- package/extensions/dm-lens/dist/clients/middle-man-analysis.js +0 -161
- package/extensions/dm-lens/dist/clients/model-provider.js +0 -31
- package/extensions/dm-lens/dist/clients/module-report-lsp.js +0 -140
- package/extensions/dm-lens/dist/clients/module-report.js +0 -1642
- package/extensions/dm-lens/dist/clients/mutating-tool.js +0 -377
- package/extensions/dm-lens/dist/clients/mutation-attribution.js +0 -168
- package/extensions/dm-lens/dist/clients/mutation-bridge.js +0 -102
- package/extensions/dm-lens/dist/clients/ndjson-logger.js +0 -471
- package/extensions/dm-lens/dist/clients/observed-mutation-sources.js +0 -43
- package/extensions/dm-lens/dist/clients/observed-mutation.js +0 -709
- package/extensions/dm-lens/dist/clients/oldtext-autopatch.js +0 -100
- package/extensions/dm-lens/dist/clients/opaque-mutation-scan.js +0 -313
- package/extensions/dm-lens/dist/clients/opengrep-client.js +0 -216
- package/extensions/dm-lens/dist/clients/opengrep-config.js +0 -52
- package/extensions/dm-lens/dist/clients/package-manager.js +0 -303
- package/extensions/dm-lens/dist/clients/package-root.js +0 -25
- package/extensions/dm-lens/dist/clients/partial-edit-apply.js +0 -337
- package/extensions/dm-lens/dist/clients/path-attribution-telemetry.js +0 -31
- package/extensions/dm-lens/dist/clients/path-keyed-map.js +0 -57
- package/extensions/dm-lens/dist/clients/path-utils.js +0 -476
- package/extensions/dm-lens/dist/clients/performance-report.js +0 -291
- package/extensions/dm-lens/dist/clients/persist-debounce.js +0 -37
- package/extensions/dm-lens/dist/clients/persistent-reverify.js +0 -165
- package/extensions/dm-lens/dist/clients/php-cs-fixer-config.js +0 -15
- package/extensions/dm-lens/dist/clients/pipeline.js +0 -1091
- package/extensions/dm-lens/dist/clients/post-autofix-notice.js +0 -19
- package/extensions/dm-lens/dist/clients/print-mode.js +0 -3
- package/extensions/dm-lens/dist/clients/probe-home-state.js +0 -62
- package/extensions/dm-lens/dist/clients/process-bridge.js +0 -20
- package/extensions/dm-lens/dist/clients/process-singletons.js +0 -69
- package/extensions/dm-lens/dist/clients/process-snapshot.js +0 -22
- package/extensions/dm-lens/dist/clients/project-changes.js +0 -112
- package/extensions/dm-lens/dist/clients/project-conventions.js +0 -152
- package/extensions/dm-lens/dist/clients/project-diagnostics/cache.js +0 -91
- package/extensions/dm-lens/dist/clients/project-diagnostics/extractors.js +0 -53
- package/extensions/dm-lens/dist/clients/project-diagnostics/fresh-fetch.js +0 -408
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +0 -64
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +0 -38
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +0 -21
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +0 -23
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +0 -28
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +0 -45
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +0 -34
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +0 -32
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +0 -79
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +0 -41
- package/extensions/dm-lens/dist/clients/project-diagnostics/scanner.js +0 -349
- package/extensions/dm-lens/dist/clients/project-diagnostics/types.js +0 -1
- package/extensions/dm-lens/dist/clients/project-lens-config.js +0 -437
- package/extensions/dm-lens/dist/clients/project-report.js +0 -527
- package/extensions/dm-lens/dist/clients/project-scale.js +0 -60
- package/extensions/dm-lens/dist/clients/project-scan-policy.js +0 -4
- package/extensions/dm-lens/dist/clients/project-snapshot-fingerprint.js +0 -39
- package/extensions/dm-lens/dist/clients/project-snapshot-persist-worker.js +0 -14
- package/extensions/dm-lens/dist/clients/project-snapshot.js +0 -1178
- package/extensions/dm-lens/dist/clients/project-trust.js +0 -104
- package/extensions/dm-lens/dist/clients/python-environment.js +0 -120
- package/extensions/dm-lens/dist/clients/python-provenance.js +0 -551
- package/extensions/dm-lens/dist/clients/quiet-window-config.js +0 -16
- package/extensions/dm-lens/dist/clients/quiet-window.js +0 -126
- package/extensions/dm-lens/dist/clients/read-bridge.js +0 -46
- package/extensions/dm-lens/dist/clients/read-expansion.js +0 -218
- package/extensions/dm-lens/dist/clients/read-guard-logger.js +0 -178
- package/extensions/dm-lens/dist/clients/read-guard-tool-lines.js +0 -1042
- package/extensions/dm-lens/dist/clients/read-guard.js +0 -1096
- package/extensions/dm-lens/dist/clients/recent-touches.js +0 -126
- package/extensions/dm-lens/dist/clients/redact/secrets.js +0 -386
- package/extensions/dm-lens/dist/clients/resource-sampler.js +0 -344
- package/extensions/dm-lens/dist/clients/reverse-deps.js +0 -227
- package/extensions/dm-lens/dist/clients/review-graph/builder.js +0 -3635
- package/extensions/dm-lens/dist/clients/review-graph/format.js +0 -30
- package/extensions/dm-lens/dist/clients/review-graph/git-identity.js +0 -115
- package/extensions/dm-lens/dist/clients/review-graph/import-resolvers.js +0 -325
- package/extensions/dm-lens/dist/clients/review-graph/persist-worker.js +0 -8
- package/extensions/dm-lens/dist/clients/review-graph/query.js +0 -195
- package/extensions/dm-lens/dist/clients/review-graph/revision-drift.js +0 -3
- package/extensions/dm-lens/dist/clients/review-graph/service.js +0 -60
- package/extensions/dm-lens/dist/clients/review-graph/shared-extraction-ir.js +0 -54
- package/extensions/dm-lens/dist/clients/review-graph/symbol-id.js +0 -29
- package/extensions/dm-lens/dist/clients/review-graph/tsconfig-paths.js +0 -253
- package/extensions/dm-lens/dist/clients/review-graph/types.js +0 -1
- package/extensions/dm-lens/dist/clients/review-graph/workspace-modules.js +0 -374
- package/extensions/dm-lens/dist/clients/review-graph-logger.js +0 -51
- package/extensions/dm-lens/dist/clients/ruff-client.js +0 -109
- package/extensions/dm-lens/dist/clients/rules-scanner.js +0 -113
- package/extensions/dm-lens/dist/clients/run-duration.js +0 -9
- package/extensions/dm-lens/dist/clients/runtime-agent-end.js +0 -608
- package/extensions/dm-lens/dist/clients/runtime-config.js +0 -39
- package/extensions/dm-lens/dist/clients/runtime-context.js +0 -155
- package/extensions/dm-lens/dist/clients/runtime-coordinator.js +0 -817
- package/extensions/dm-lens/dist/clients/runtime-session.js +0 -1625
- package/extensions/dm-lens/dist/clients/runtime-tool-call.js +0 -868
- package/extensions/dm-lens/dist/clients/runtime-tool-result.js +0 -1317
- package/extensions/dm-lens/dist/clients/runtime-turn.js +0 -2333
- package/extensions/dm-lens/dist/clients/rust-client.js +0 -48
- package/extensions/dm-lens/dist/clients/safe-spawn.js +0 -1267
- package/extensions/dm-lens/dist/clients/sanitize.js +0 -174
- package/extensions/dm-lens/dist/clients/scan-utils.js +0 -7
- package/extensions/dm-lens/dist/clients/scratch-tree-policy.js +0 -57
- package/extensions/dm-lens/dist/clients/search-read-registration.js +0 -59
- package/extensions/dm-lens/dist/clients/secret-findings.js +0 -69
- package/extensions/dm-lens/dist/clients/security-scan-client.js +0 -208
- package/extensions/dm-lens/dist/clients/session-event-guard.js +0 -111
- package/extensions/dm-lens/dist/clients/session-lifecycle.js +0 -173
- package/extensions/dm-lens/dist/clients/session-start-observability.js +0 -47
- package/extensions/dm-lens/dist/clients/session-state-store.js +0 -63
- package/extensions/dm-lens/dist/clients/session-summary.js +0 -8
- package/extensions/dm-lens/dist/clients/sessionstart-logger.js +0 -22
- package/extensions/dm-lens/dist/clients/sg-runner.js +0 -627
- package/extensions/dm-lens/dist/clients/sgconfig.js +0 -280
- package/extensions/dm-lens/dist/clients/shared-checkout-guard.js +0 -177
- package/extensions/dm-lens/dist/clients/single-flight.js +0 -52
- package/extensions/dm-lens/dist/clients/situational-tool-telemetry.js +0 -85
- package/extensions/dm-lens/dist/clients/skills-resolver.js +0 -38
- package/extensions/dm-lens/dist/clients/slow-fs.js +0 -77
- package/extensions/dm-lens/dist/clients/smells-rollup.js +0 -118
- package/extensions/dm-lens/dist/clients/source-filter.js +0 -320
- package/extensions/dm-lens/dist/clients/source-walker.js +0 -96
- package/extensions/dm-lens/dist/clients/spawn-output-cap.js +0 -35
- package/extensions/dm-lens/dist/clients/spawn-timeout-cooldown.js +0 -51
- package/extensions/dm-lens/dist/clients/stale-marker.js +0 -1
- package/extensions/dm-lens/dist/clients/startup-scan.js +0 -222
- package/extensions/dm-lens/dist/clients/startup-timing.js +0 -67
- package/extensions/dm-lens/dist/clients/string-utils.js +0 -6
- package/extensions/dm-lens/dist/clients/subagent-mode.js +0 -40
- package/extensions/dm-lens/dist/clients/symbol-containment.js +0 -16
- package/extensions/dm-lens/dist/clients/symbol-types.js +0 -1
- package/extensions/dm-lens/dist/clients/test-runner-client.js +0 -1504
- package/extensions/dm-lens/dist/clients/test-runner-delivery.js +0 -260
- package/extensions/dm-lens/dist/clients/todo-scanner.js +0 -164
- package/extensions/dm-lens/dist/clients/tool-agreement.js +0 -377
- package/extensions/dm-lens/dist/clients/tool-config.js +0 -218
- package/extensions/dm-lens/dist/clients/tool-cwd.js +0 -235
- package/extensions/dm-lens/dist/clients/tool-definition.js +0 -22
- package/extensions/dm-lens/dist/clients/tool-event.js +0 -18
- package/extensions/dm-lens/dist/clients/tool-policy.js +0 -2393
- package/extensions/dm-lens/dist/clients/tool-probe.js +0 -5
- package/extensions/dm-lens/dist/clients/tool-render.js +0 -79
- package/extensions/dm-lens/dist/clients/tool-set-policy.js +0 -70
- package/extensions/dm-lens/dist/clients/tree-sitter-cache.js +0 -206
- package/extensions/dm-lens/dist/clients/tree-sitter-client.js +0 -2787
- package/extensions/dm-lens/dist/clients/tree-sitter-logger.js +0 -77
- package/extensions/dm-lens/dist/clients/tree-sitter-navigator.js +0 -198
- package/extensions/dm-lens/dist/clients/tree-sitter-query-loader.js +0 -318
- package/extensions/dm-lens/dist/clients/tree-sitter-shared.js +0 -87
- package/extensions/dm-lens/dist/clients/tree-sitter-symbol-extractor.js +0 -957
- package/extensions/dm-lens/dist/clients/trivy-client.js +0 -305
- package/extensions/dm-lens/dist/clients/tui-fit.js +0 -26
- package/extensions/dm-lens/dist/clients/turn-context.js +0 -48
- package/extensions/dm-lens/dist/clients/turn-end/lane.js +0 -1
- package/extensions/dm-lens/dist/clients/turn-end/lanes/govulncheck.js +0 -54
- package/extensions/dm-lens/dist/clients/turn-end/lanes/secrets.js +0 -131
- package/extensions/dm-lens/dist/clients/turn-summary-render.js +0 -56
- package/extensions/dm-lens/dist/clients/turn-summary.js +0 -84
- package/extensions/dm-lens/dist/clients/typos-config.js +0 -9
- package/extensions/dm-lens/dist/clients/user-notify.js +0 -15
- package/extensions/dm-lens/dist/clients/vanished-instance-marker.js +0 -18
- package/extensions/dm-lens/dist/clients/warm-attach.js +0 -210
- package/extensions/dm-lens/dist/clients/widget-state.js +0 -963
- package/extensions/dm-lens/dist/clients/word-index-logger.js +0 -21
- package/extensions/dm-lens/dist/clients/word-index-store.js +0 -222
- package/extensions/dm-lens/dist/clients/word-index.js +0 -1426
- package/extensions/dm-lens/dist/clients/workspace-topology.js +0 -261
- package/extensions/dm-lens/dist/clients/write-ordering-guard.js +0 -24
- package/extensions/dm-lens/dist/clients/zizmor-config.js +0 -160
- package/extensions/dm-lens/dist/i18n.js +0 -67
- package/extensions/dm-lens/dist/index.js +0 -1782
- package/extensions/dm-lens/dist/mcp/analyze-cli.js +0 -178
- package/extensions/dm-lens/dist/mcp/build-staleness.js +0 -55
- package/extensions/dm-lens/dist/mcp/cli.js +0 -78
- package/extensions/dm-lens/dist/mcp/server.js +0 -1208
- package/extensions/dm-lens/dist/mcp/worker.js +0 -33
- package/extensions/dm-lens/dist/scripts/lib/process-scan.mjs +0 -256
- package/extensions/dm-lens/dist/scripts/lib/skills-predicate.mjs +0 -53
- package/extensions/dm-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +0 -45
- package/extensions/dm-lens/dist/tools/activate-tools.js +0 -61
- package/extensions/dm-lens/dist/tools/ast-grep-outline.js +0 -127
- package/extensions/dm-lens/dist/tools/ast-grep-replace.js +0 -226
- package/extensions/dm-lens/dist/tools/ast-grep-search.js +0 -687
- package/extensions/dm-lens/dist/tools/effective-config.js +0 -59
- package/extensions/dm-lens/dist/tools/lens-diagnostic-mark.js +0 -240
- package/extensions/dm-lens/dist/tools/lens-diagnostics.js +0 -1484
- package/extensions/dm-lens/dist/tools/lsp-diagnostics.js +0 -1088
- package/extensions/dm-lens/dist/tools/lsp-navigation.js +0 -1194
- package/extensions/dm-lens/dist/tools/lsp-structured-output.js +0 -277
- package/extensions/dm-lens/dist/tools/module-report.js +0 -332
- package/extensions/dm-lens/dist/tools/project-report.js +0 -72
- package/extensions/dm-lens/dist/tools/render-compact.js +0 -272
- package/extensions/dm-lens/dist/tools/scan-progress.js +0 -31
- package/extensions/dm-lens/dist/tools/shared.js +0 -26
- package/extensions/dm-lens/dist/tools/symbol-search.js +0 -133
- package/extensions/dm-mcp-adapter/dist/abort.js +0 -35
- package/extensions/dm-mcp-adapter/dist/agent-dir.js +0 -45
- package/extensions/dm-mcp-adapter/dist/agent-plugin-loader.js +0 -392
- package/extensions/dm-mcp-adapter/dist/agent-plugin-provenance.js +0 -26
- package/extensions/dm-mcp-adapter/dist/bearer-command-resolver.js +0 -182
- package/extensions/dm-mcp-adapter/dist/claude-plugin-loader.js +0 -350
- package/extensions/dm-mcp-adapter/dist/config.js +0 -1310
- package/extensions/dm-mcp-adapter/dist/consent-manager.js +0 -84
- package/extensions/dm-mcp-adapter/dist/elicitation-handler.js +0 -308
- package/extensions/dm-mcp-adapter/dist/errors.js +0 -225
- package/extensions/dm-mcp-adapter/dist/http-ca.js +0 -71
- package/extensions/dm-mcp-adapter/dist/jev-client.js +0 -359
- package/extensions/dm-mcp-adapter/dist/jev-contracts.js +0 -1
- package/extensions/dm-mcp-adapter/dist/jev-key-store.js +0 -176
- package/extensions/dm-mcp-adapter/dist/json-schema-validator.js +0 -70
- package/extensions/dm-mcp-adapter/dist/lifecycle.js +0 -387
- package/extensions/dm-mcp-adapter/dist/logger.js +0 -115
- package/extensions/dm-mcp-adapter/dist/mcp-auth-fetch.js +0 -86
- package/extensions/dm-mcp-adapter/dist/mcp-auth-flow.js +0 -949
- package/extensions/dm-mcp-adapter/dist/mcp-auth.js +0 -997
- package/extensions/dm-mcp-adapter/dist/mcp-bearer-store.js +0 -182
- package/extensions/dm-mcp-adapter/dist/mcp-callback-server.js +0 -381
- package/extensions/dm-mcp-adapter/dist/mcp-oauth-provider.js +0 -524
- package/extensions/dm-mcp-adapter/dist/mcp-probe.js +0 -151
- package/extensions/dm-mcp-adapter/dist/mcp-tasks.js +0 -300
- package/extensions/dm-mcp-adapter/dist/mcp-trace.js +0 -215
- package/extensions/dm-mcp-adapter/dist/metadata-cache.js +0 -267
- package/extensions/dm-mcp-adapter/dist/npx-resolver.js +0 -465
- package/extensions/dm-mcp-adapter/dist/package-mcp-loader.js +0 -135
- package/extensions/dm-mcp-adapter/dist/request-headers-command.js +0 -294
- package/extensions/dm-mcp-adapter/dist/resource-tools.js +0 -7
- package/extensions/dm-mcp-adapter/dist/runtime-owner.js +0 -94
- package/extensions/dm-mcp-adapter/dist/sampling-handler.js +0 -213
- package/extensions/dm-mcp-adapter/dist/secure-keyring.js +0 -191
- package/extensions/dm-mcp-adapter/dist/server-manager.js +0 -1514
- package/extensions/dm-mcp-adapter/dist/session-approvals.js +0 -127
- package/extensions/dm-mcp-adapter/dist/session-recovery.js +0 -82
- package/extensions/dm-mcp-adapter/dist/state.js +0 -1
- package/extensions/dm-mcp-adapter/dist/types.js +0 -286
- package/extensions/dm-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -36
- package/extensions/dm-mcp-adapter/dist/ui-resource-handler.js +0 -204
- package/extensions/dm-mcp-adapter/dist/ui-stream-types.js +0 -58
- package/extensions/dm-mcp-adapter/dist/ui-tool-visibility.js +0 -26
- package/extensions/dm-mcp-adapter/dist/unix-socket-transport.js +0 -83
- package/extensions/dm-mcp-adapter/dist/utils.js +0 -382
|
@@ -1,1194 +0,0 @@
|
|
|
1
|
-
import * as nodeFs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
-
import { Type } from "../clients/deps/typebox.js";
|
|
5
|
-
import { logLatency } from "../clients/latency-logger.js";
|
|
6
|
-
import { newLspMutationCorrelationId, recordLspMutationOutcome } from "../clients/lsp-mutation.js";
|
|
7
|
-
import { uriToPath } from "../clients/path-utils.js";
|
|
8
|
-
import { escapeRegExp } from "../clients/string-utils.js";
|
|
9
|
-
import { isRecordableProjectPath } from "../clients/file-utils.js";
|
|
10
|
-
import { compactRenderResult } from "./render-compact.js";
|
|
11
|
-
import { applyWorkspaceEdit, summarizeWorkspaceEdit } from "../clients/lsp/edits.js";
|
|
12
|
-
import { getLSPService } from "../clients/lsp/index.js";
|
|
13
|
-
import { buildLspNavigationEnvelope } from "./lsp-structured-output.js";
|
|
14
|
-
import { SYMBOL_KIND_NAMES } from "../clients/lsp-document-symbols.js";
|
|
15
|
-
const VALID_OPERATIONS = [
|
|
16
|
-
"definition",
|
|
17
|
-
"typeDefinition",
|
|
18
|
-
"declaration",
|
|
19
|
-
"references",
|
|
20
|
-
"hover",
|
|
21
|
-
"signatureHelp",
|
|
22
|
-
"documentSymbol",
|
|
23
|
-
"findSymbol",
|
|
24
|
-
"workspaceSymbol",
|
|
25
|
-
"codeAction",
|
|
26
|
-
"rename",
|
|
27
|
-
"rename_file",
|
|
28
|
-
"implementation",
|
|
29
|
-
"prepareCallHierarchy",
|
|
30
|
-
"incomingCalls",
|
|
31
|
-
"outgoingCalls",
|
|
32
|
-
"executeCommand",
|
|
33
|
-
"workspaceDiagnostics",
|
|
34
|
-
"capabilities"
|
|
35
|
-
];
|
|
36
|
-
const NAVIGABLE_SYMBOL_KINDS = new Set([
|
|
37
|
-
5,
|
|
38
|
-
6,
|
|
39
|
-
8,
|
|
40
|
-
11,
|
|
41
|
-
12,
|
|
42
|
-
13,
|
|
43
|
-
22,
|
|
44
|
-
23
|
|
45
|
-
]);
|
|
46
|
-
function normalizeOperation(value) {
|
|
47
|
-
if (typeof value !== "string")
|
|
48
|
-
return "";
|
|
49
|
-
return value.trim().replace(/^["']+|["']+$/g, "");
|
|
50
|
-
}
|
|
51
|
-
function isValidOperation(value) {
|
|
52
|
-
return VALID_OPERATIONS.includes(value);
|
|
53
|
-
}
|
|
54
|
-
function operationSupportStatus(operation, support) {
|
|
55
|
-
if (!support)
|
|
56
|
-
return null;
|
|
57
|
-
if (operation === "definition")
|
|
58
|
-
return support.definition;
|
|
59
|
-
if (operation === "typeDefinition")
|
|
60
|
-
return support.typeDefinition;
|
|
61
|
-
if (operation === "declaration")
|
|
62
|
-
return support.declaration;
|
|
63
|
-
if (operation === "references")
|
|
64
|
-
return support.references;
|
|
65
|
-
if (operation === "hover")
|
|
66
|
-
return support.hover;
|
|
67
|
-
if (operation === "signatureHelp")
|
|
68
|
-
return support.signatureHelp;
|
|
69
|
-
if (operation === "documentSymbol" || operation === "findSymbol")
|
|
70
|
-
return support.documentSymbol;
|
|
71
|
-
if (operation === "workspaceSymbol")
|
|
72
|
-
return support.workspaceSymbol;
|
|
73
|
-
if (operation === "codeAction")
|
|
74
|
-
return support.codeAction;
|
|
75
|
-
if (operation === "rename")
|
|
76
|
-
return support.rename;
|
|
77
|
-
if (operation === "implementation")
|
|
78
|
-
return support.implementation;
|
|
79
|
-
if (operation === "prepareCallHierarchy" || operation === "incomingCalls" || operation === "outgoingCalls")
|
|
80
|
-
return support.callHierarchy;
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
function emptyReasonForOperation(operation) {
|
|
84
|
-
if (operation === "signatureHelp")
|
|
85
|
-
return "position-sensitive-or-no-signature";
|
|
86
|
-
if (operation === "codeAction")
|
|
87
|
-
return "no-applicable-actions";
|
|
88
|
-
if (operation === "rename")
|
|
89
|
-
return "no-rename-edits-or-symbol-not-renamable";
|
|
90
|
-
if (operation === "rename_file")
|
|
91
|
-
return "no-file-rename-result";
|
|
92
|
-
if (operation === "findSymbol")
|
|
93
|
-
return "no-matching-symbols";
|
|
94
|
-
if (operation === "workspaceSymbol")
|
|
95
|
-
return "no-matching-symbols-or-server-index-unavailable";
|
|
96
|
-
if (operation === "capabilities")
|
|
97
|
-
return "no-active-lsp-servers";
|
|
98
|
-
if (operation === "executeCommand")
|
|
99
|
-
return "command-returned-no-result";
|
|
100
|
-
if (operation === "incomingCalls" || operation === "outgoingCalls")
|
|
101
|
-
return "no-call-hierarchy-results";
|
|
102
|
-
return "no-results";
|
|
103
|
-
}
|
|
104
|
-
function parseSymbolSelector(symbol) {
|
|
105
|
-
const trimmed = symbol.trim();
|
|
106
|
-
const match = /^([^#]*)(?:#(-?\d+))?$/.exec(trimmed);
|
|
107
|
-
const baseSymbol = (match?.[1] ?? trimmed).trim();
|
|
108
|
-
const rawOccurrence = match?.[2];
|
|
109
|
-
if (!rawOccurrence)
|
|
110
|
-
return { baseSymbol, occurrence: 1 };
|
|
111
|
-
const occurrence = Number.parseInt(rawOccurrence, 10);
|
|
112
|
-
if (!Number.isFinite(occurrence) || occurrence < 1) {
|
|
113
|
-
return {
|
|
114
|
-
baseSymbol,
|
|
115
|
-
occurrence: 1,
|
|
116
|
-
debug: `invalid occurrence selector #${rawOccurrence}; using #1`
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return { baseSymbol, occurrence };
|
|
120
|
-
}
|
|
121
|
-
function findNthMatch(lineText, regex, occurrence) {
|
|
122
|
-
let seen = 0;
|
|
123
|
-
regex.lastIndex = 0;
|
|
124
|
-
let match;
|
|
125
|
-
while ((match = regex.exec(lineText)) !== null) {
|
|
126
|
-
seen += 1;
|
|
127
|
-
if (seen === occurrence)
|
|
128
|
-
return match;
|
|
129
|
-
if (match[0].length === 0)
|
|
130
|
-
regex.lastIndex += 1;
|
|
131
|
-
}
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
function firstNonWhitespaceCharacter(lineText) {
|
|
135
|
-
const match = /\S/.exec(lineText);
|
|
136
|
-
return (match?.index ?? 0) + 1;
|
|
137
|
-
}
|
|
138
|
-
function resolveSymbolColumn(content, line1, character, symbol) {
|
|
139
|
-
if (typeof character === "number" && character > 0) {
|
|
140
|
-
return { character, strategy: "explicit" };
|
|
141
|
-
}
|
|
142
|
-
const lineText = content.split(/\r?\n/)[line1 - 1] ?? "";
|
|
143
|
-
if (!symbol || symbol.trim().length === 0) {
|
|
144
|
-
return {
|
|
145
|
-
character: 1,
|
|
146
|
-
strategy: "fallback",
|
|
147
|
-
debug: "character omitted and no symbol supplied; using column 1"
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
const { baseSymbol, occurrence, debug } = parseSymbolSelector(symbol);
|
|
151
|
-
if (!baseSymbol) {
|
|
152
|
-
return {
|
|
153
|
-
character: firstNonWhitespaceCharacter(lineText),
|
|
154
|
-
requestedSymbol: symbol,
|
|
155
|
-
baseSymbol,
|
|
156
|
-
requestedOccurrence: occurrence,
|
|
157
|
-
usedOccurrence: 1,
|
|
158
|
-
strategy: "fallback",
|
|
159
|
-
debug: debug ?? "empty symbol selector; using first non-whitespace column"
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
const pattern = `\\b${escapeRegExp(baseSymbol)}\\b`;
|
|
163
|
-
const exactRegex = new RegExp(pattern, "g");
|
|
164
|
-
const exact = findNthMatch(lineText, exactRegex, occurrence);
|
|
165
|
-
if (exact) {
|
|
166
|
-
return {
|
|
167
|
-
character: exact.index + 1,
|
|
168
|
-
requestedSymbol: symbol,
|
|
169
|
-
baseSymbol,
|
|
170
|
-
requestedOccurrence: occurrence,
|
|
171
|
-
usedOccurrence: occurrence,
|
|
172
|
-
strategy: "word-boundary",
|
|
173
|
-
debug
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
const firstExact = findNthMatch(lineText, exactRegex, 1);
|
|
177
|
-
if (firstExact && occurrence !== 1) {
|
|
178
|
-
return {
|
|
179
|
-
character: firstExact.index + 1,
|
|
180
|
-
requestedSymbol: symbol,
|
|
181
|
-
baseSymbol,
|
|
182
|
-
requestedOccurrence: occurrence,
|
|
183
|
-
usedOccurrence: 1,
|
|
184
|
-
strategy: "word-boundary",
|
|
185
|
-
debug: `${debug ? `${debug}; ` : ""}occurrence #${occurrence} not found; using #1`
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
const insensitiveRegex = new RegExp(pattern, "gi");
|
|
189
|
-
const insensitive = findNthMatch(lineText, insensitiveRegex, occurrence);
|
|
190
|
-
if (insensitive) {
|
|
191
|
-
return {
|
|
192
|
-
character: insensitive.index + 1,
|
|
193
|
-
requestedSymbol: symbol,
|
|
194
|
-
baseSymbol,
|
|
195
|
-
requestedOccurrence: occurrence,
|
|
196
|
-
usedOccurrence: occurrence,
|
|
197
|
-
strategy: "case-insensitive",
|
|
198
|
-
debug: debug ?? "exact-case symbol not found; used case-insensitive match"
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
const firstInsensitive = findNthMatch(lineText, insensitiveRegex, 1);
|
|
202
|
-
if (firstInsensitive && occurrence !== 1) {
|
|
203
|
-
return {
|
|
204
|
-
character: firstInsensitive.index + 1,
|
|
205
|
-
requestedSymbol: symbol,
|
|
206
|
-
baseSymbol,
|
|
207
|
-
requestedOccurrence: occurrence,
|
|
208
|
-
usedOccurrence: 1,
|
|
209
|
-
strategy: "case-insensitive",
|
|
210
|
-
debug: `${debug ? `${debug}; ` : ""}occurrence #${occurrence} not found case-insensitively; using #1`
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
character: firstNonWhitespaceCharacter(lineText),
|
|
215
|
-
requestedSymbol: symbol,
|
|
216
|
-
baseSymbol,
|
|
217
|
-
requestedOccurrence: occurrence,
|
|
218
|
-
usedOccurrence: 1,
|
|
219
|
-
strategy: "fallback",
|
|
220
|
-
debug: `${debug ? `${debug}; ` : ""}symbol not found on line; using first non-whitespace column`
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function tokenAtPosition(content, line1, char1) {
|
|
224
|
-
const lines = content.split(/\r?\n/);
|
|
225
|
-
const line = lines[line1 - 1];
|
|
226
|
-
if (!line)
|
|
227
|
-
return;
|
|
228
|
-
const chars = [...line];
|
|
229
|
-
const idx = Math.max(0, Math.min(chars.length - 1, char1 - 1));
|
|
230
|
-
const isWord = (ch) => !!ch && /[A-Za-z0-9_?!]/.test(ch);
|
|
231
|
-
let left = idx;
|
|
232
|
-
let right = idx;
|
|
233
|
-
if (!isWord(chars[idx]) && isWord(chars[idx + 1])) {
|
|
234
|
-
left = idx + 1;
|
|
235
|
-
right = idx + 1;
|
|
236
|
-
}
|
|
237
|
-
while (left > 0 && isWord(chars[left - 1]))
|
|
238
|
-
left -= 1;
|
|
239
|
-
while (right < chars.length - 1 && isWord(chars[right + 1]))
|
|
240
|
-
right += 1;
|
|
241
|
-
const token = chars.slice(left, right + 1).join("").trim();
|
|
242
|
-
return token.length > 0 ? token : undefined;
|
|
243
|
-
}
|
|
244
|
-
function symbolKindLabel(kind) {
|
|
245
|
-
return kind == null ? "symbol" : SYMBOL_KIND_NAMES[kind] ?? "symbol";
|
|
246
|
-
}
|
|
247
|
-
function rangeStart(range) {
|
|
248
|
-
const start = range?.start;
|
|
249
|
-
return {
|
|
250
|
-
line: typeof start?.line === "number" ? start.line + 1 : undefined,
|
|
251
|
-
character: typeof start?.character === "number" ? start.character + 1 : undefined
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function findSymbolMatches(symbols, query, options) {
|
|
255
|
-
const normalizedQuery = query.trim().toLowerCase();
|
|
256
|
-
if (!normalizedQuery)
|
|
257
|
-
return [];
|
|
258
|
-
const matches = [];
|
|
259
|
-
const matchesText = (symbol) => {
|
|
260
|
-
const values = [symbol.name, symbol.detail].filter((value) => Boolean(value)).map((value) => value.trim().toLowerCase());
|
|
261
|
-
return options.exactMatch ? values.some((value) => value === normalizedQuery) : values.some((value) => value.includes(normalizedQuery));
|
|
262
|
-
};
|
|
263
|
-
const matchesKind = (symbol) => {
|
|
264
|
-
if (options.kinds.size === 0)
|
|
265
|
-
return true;
|
|
266
|
-
return options.kinds.has(symbolKindLabel(symbol.kind).toLowerCase());
|
|
267
|
-
};
|
|
268
|
-
const visit = (entries, depth) => {
|
|
269
|
-
for (const symbol of entries) {
|
|
270
|
-
if (symbol.name && matchesText(symbol) && matchesKind(symbol)) {
|
|
271
|
-
const preferredRange = symbol.selectionRange ?? symbol.range;
|
|
272
|
-
const start = rangeStart(preferredRange);
|
|
273
|
-
matches.push({
|
|
274
|
-
name: symbol.name,
|
|
275
|
-
kind: symbolKindLabel(symbol.kind),
|
|
276
|
-
kindCode: symbol.kind,
|
|
277
|
-
detail: symbol.detail,
|
|
278
|
-
line: start.line,
|
|
279
|
-
character: start.character,
|
|
280
|
-
depth,
|
|
281
|
-
location: symbol.location,
|
|
282
|
-
range: preferredRange
|
|
283
|
-
});
|
|
284
|
-
if (matches.length >= options.maxResults)
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
if (!options.topLevelOnly && symbol.children?.length) {
|
|
288
|
-
visit(symbol.children, depth + 1);
|
|
289
|
-
if (matches.length >= options.maxResults)
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
visit(symbols, 1);
|
|
295
|
-
return matches;
|
|
296
|
-
}
|
|
297
|
-
function flattenSymbols(symbols) {
|
|
298
|
-
const all = [];
|
|
299
|
-
for (const symbol of symbols) {
|
|
300
|
-
all.push(symbol);
|
|
301
|
-
if (symbol.children && symbol.children.length > 0) {
|
|
302
|
-
all.push(...flattenSymbols(symbol.children));
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return all;
|
|
306
|
-
}
|
|
307
|
-
function pickLocalSymbolLocation(symbols, token, filePath) {
|
|
308
|
-
const flat = flattenSymbols(symbols).filter((symbol) => symbol.name === token);
|
|
309
|
-
if (flat.length === 0)
|
|
310
|
-
return [];
|
|
311
|
-
const uri = pathToFileURL(filePath).href;
|
|
312
|
-
return flat.map((symbol) => {
|
|
313
|
-
if (symbol.location?.uri && symbol.location.range) {
|
|
314
|
-
return { uri: symbol.location.uri, range: symbol.location.range };
|
|
315
|
-
}
|
|
316
|
-
if (symbol.range) {
|
|
317
|
-
return { uri, range: symbol.range };
|
|
318
|
-
}
|
|
319
|
-
return;
|
|
320
|
-
}).filter((entry) => Boolean(entry));
|
|
321
|
-
}
|
|
322
|
-
function workspaceSymbolDedupeKey(symbol) {
|
|
323
|
-
const location = symbol.location;
|
|
324
|
-
const start = rangeStart(location?.range ?? symbol.range ?? symbol.selectionRange);
|
|
325
|
-
return [
|
|
326
|
-
symbol.name ?? "",
|
|
327
|
-
symbol.detail ?? "",
|
|
328
|
-
symbol.kind ?? "",
|
|
329
|
-
location?.uri ?? "",
|
|
330
|
-
start.line ?? "",
|
|
331
|
-
start.character ?? ""
|
|
332
|
-
].join(":");
|
|
333
|
-
}
|
|
334
|
-
function dedupeWorkspaceSymbols(symbols) {
|
|
335
|
-
const out = [];
|
|
336
|
-
const seen = new Set;
|
|
337
|
-
for (const symbol of symbols) {
|
|
338
|
-
const key = workspaceSymbolDedupeKey(symbol);
|
|
339
|
-
if (seen.has(key))
|
|
340
|
-
continue;
|
|
341
|
-
seen.add(key);
|
|
342
|
-
out.push(symbol);
|
|
343
|
-
}
|
|
344
|
-
return out;
|
|
345
|
-
}
|
|
346
|
-
function asRecord(value) {
|
|
347
|
-
return typeof value === "object" && value !== null ? value : undefined;
|
|
348
|
-
}
|
|
349
|
-
function searchReadFromUriRange(uri, range) {
|
|
350
|
-
if (typeof uri !== "string" || !uri.startsWith("file:"))
|
|
351
|
-
return;
|
|
352
|
-
const rangeLike = asRecord(range);
|
|
353
|
-
const startLine = rangeLike?.start?.line;
|
|
354
|
-
if (typeof startLine !== "number" || !Number.isFinite(startLine)) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
const endLine = rangeLike?.end?.line;
|
|
358
|
-
try {
|
|
359
|
-
return {
|
|
360
|
-
file: fileURLToPath(uri),
|
|
361
|
-
startLine: Math.max(1, Math.floor(startLine) + 1),
|
|
362
|
-
endLine: typeof endLine === "number" && Number.isFinite(endLine) ? Math.max(1, Math.floor(endLine) + 1) : undefined
|
|
363
|
-
};
|
|
364
|
-
} catch {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
function pushSearchRead(out, uri, range) {
|
|
369
|
-
const loc = searchReadFromUriRange(uri, range);
|
|
370
|
-
if (loc)
|
|
371
|
-
out.push(loc);
|
|
372
|
-
}
|
|
373
|
-
function collectLocationSearchReads(result) {
|
|
374
|
-
const out = [];
|
|
375
|
-
for (const entry of Array.isArray(result) ? result : [result]) {
|
|
376
|
-
const record = asRecord(entry);
|
|
377
|
-
if (!record)
|
|
378
|
-
continue;
|
|
379
|
-
pushSearchRead(out, record.uri, record.range);
|
|
380
|
-
pushSearchRead(out, record.targetUri, record.targetSelectionRange ?? record.targetRange);
|
|
381
|
-
}
|
|
382
|
-
return out;
|
|
383
|
-
}
|
|
384
|
-
function collectWorkspaceSymbolSearchReads(result) {
|
|
385
|
-
const out = [];
|
|
386
|
-
for (const entry of Array.isArray(result) ? result : [result]) {
|
|
387
|
-
const symbol = asRecord(entry);
|
|
388
|
-
const location = asRecord(symbol?.location);
|
|
389
|
-
if (!location)
|
|
390
|
-
continue;
|
|
391
|
-
pushSearchRead(out, location.uri, location.range);
|
|
392
|
-
pushSearchRead(out, location.targetUri, location.targetSelectionRange ?? location.targetRange);
|
|
393
|
-
}
|
|
394
|
-
return out;
|
|
395
|
-
}
|
|
396
|
-
function collectCallHierarchySearchReads(result, operation, callHierarchyItem) {
|
|
397
|
-
const out = [];
|
|
398
|
-
for (const entry of Array.isArray(result) ? result : [result]) {
|
|
399
|
-
const record = asRecord(entry);
|
|
400
|
-
if (!record)
|
|
401
|
-
continue;
|
|
402
|
-
const item = asRecord(operation === "incomingCalls" ? record.from : record.to);
|
|
403
|
-
pushSearchRead(out, item?.uri, item?.selectionRange ?? item?.range);
|
|
404
|
-
const rangeUri = operation === "incomingCalls" ? item?.uri : callHierarchyItem?.uri;
|
|
405
|
-
const fromRanges = record.fromRanges;
|
|
406
|
-
if (Array.isArray(fromRanges)) {
|
|
407
|
-
for (const range of fromRanges)
|
|
408
|
-
pushSearchRead(out, rangeUri, range);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return out;
|
|
412
|
-
}
|
|
413
|
-
function collectSearchReadsForOperation(operation, result, callHierarchyItem) {
|
|
414
|
-
if ([
|
|
415
|
-
"definition",
|
|
416
|
-
"typeDefinition",
|
|
417
|
-
"declaration",
|
|
418
|
-
"references",
|
|
419
|
-
"implementation"
|
|
420
|
-
].includes(operation)) {
|
|
421
|
-
return collectLocationSearchReads(result);
|
|
422
|
-
}
|
|
423
|
-
if (operation === "workspaceSymbol") {
|
|
424
|
-
return collectWorkspaceSymbolSearchReads(result);
|
|
425
|
-
}
|
|
426
|
-
if (operation === "incomingCalls" || operation === "outgoingCalls") {
|
|
427
|
-
return collectCallHierarchySearchReads(result, operation, callHierarchyItem);
|
|
428
|
-
}
|
|
429
|
-
return [];
|
|
430
|
-
}
|
|
431
|
-
function formatCapabilities(snapshots, filePath) {
|
|
432
|
-
if (snapshots.length === 0) {
|
|
433
|
-
return filePath ? `No active LSP server for ${path.basename(filePath)}. Open/touch the file first or run another LSP operation to start the server.` : "No active LSP servers in this session.";
|
|
434
|
-
}
|
|
435
|
-
const rows = [
|
|
436
|
-
["definition", (s) => !!s.operationSupport.definition],
|
|
437
|
-
["typeDefinition", (s) => !!s.operationSupport.typeDefinition],
|
|
438
|
-
["declaration", (s) => !!s.operationSupport.declaration],
|
|
439
|
-
["references", (s) => !!s.operationSupport.references],
|
|
440
|
-
["hover", (s) => !!s.operationSupport.hover],
|
|
441
|
-
["rename", (s) => !!s.operationSupport.rename],
|
|
442
|
-
["codeAction", (s) => !!s.operationSupport.codeAction],
|
|
443
|
-
["codeAction/resolve", (s) => !!s.operationSupport.codeActionResolve],
|
|
444
|
-
["workspace/willRenameFiles", (s) => !!s.operationSupport.willRenameFiles],
|
|
445
|
-
["workspaceSymbol", (s) => !!s.operationSupport.workspaceSymbol],
|
|
446
|
-
["implementation", (s) => !!s.operationSupport.implementation],
|
|
447
|
-
["signatureHelp", (s) => !!s.operationSupport.signatureHelp],
|
|
448
|
-
["incomingCalls", (s) => !!s.operationSupport.callHierarchy],
|
|
449
|
-
["outgoingCalls", (s) => !!s.operationSupport.callHierarchy],
|
|
450
|
-
[
|
|
451
|
-
"workspaceDiagnostics",
|
|
452
|
-
(s) => s.workspaceDiagnosticsSupport.mode === "pull",
|
|
453
|
-
"pull diagnostics"
|
|
454
|
-
],
|
|
455
|
-
[
|
|
456
|
-
"rename_file",
|
|
457
|
-
() => true,
|
|
458
|
-
"filesystem rename; preflight support shown above"
|
|
459
|
-
]
|
|
460
|
-
];
|
|
461
|
-
const lines = [];
|
|
462
|
-
for (const snapshot of snapshots) {
|
|
463
|
-
const label = filePath ? `${snapshot.serverId} (${path.basename(filePath)})` : `${snapshot.serverId} (${snapshot.root})`;
|
|
464
|
-
lines.push(label);
|
|
465
|
-
for (const [name, supported, note] of rows) {
|
|
466
|
-
const suffix = note ? ` (${note})` : "";
|
|
467
|
-
lines.push(` ${name} ${supported(snapshot) ? "✓" : "✗"}${suffix}`);
|
|
468
|
-
}
|
|
469
|
-
const commands = snapshot.advertisedCommands ?? [];
|
|
470
|
-
lines.push(` executeCommand ${commands.length > 0 ? "✓" : "✗"} (${commands.length} advertised command(s)` + (commands.length > 0 ? `: ${commands.slice(0, 20).join(", ")}` : "") + ")");
|
|
471
|
-
}
|
|
472
|
-
return lines.join(`
|
|
473
|
-
`);
|
|
474
|
-
}
|
|
475
|
-
function classifyCodeActions(actions) {
|
|
476
|
-
if (!actions || actions.length === 0)
|
|
477
|
-
return { quickfix: 0, refactor: 0, other: 0 };
|
|
478
|
-
let quickfix = 0;
|
|
479
|
-
let refactor = 0;
|
|
480
|
-
let other = 0;
|
|
481
|
-
for (const action of actions) {
|
|
482
|
-
const kind = action.kind ?? "";
|
|
483
|
-
if (kind.startsWith("quickfix"))
|
|
484
|
-
quickfix += 1;
|
|
485
|
-
else if (kind.startsWith("refactor"))
|
|
486
|
-
refactor += 1;
|
|
487
|
-
else
|
|
488
|
-
other += 1;
|
|
489
|
-
}
|
|
490
|
-
return { quickfix, refactor, other };
|
|
491
|
-
}
|
|
492
|
-
async function openFileBestEffort(lspService, filePath, waitForDiagnostics = false) {
|
|
493
|
-
let fileContent;
|
|
494
|
-
try {
|
|
495
|
-
fileContent = nodeFs.readFileSync(filePath, "utf-8");
|
|
496
|
-
} catch {
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
if (!fileContent)
|
|
500
|
-
return;
|
|
501
|
-
try {
|
|
502
|
-
await lspService.touchFile(filePath, fileContent, {
|
|
503
|
-
diagnostics: waitForDiagnostics ? "document" : "none",
|
|
504
|
-
source: "lsp_navigation",
|
|
505
|
-
clientScope: waitForDiagnostics ? "all" : "primary"
|
|
506
|
-
});
|
|
507
|
-
} catch {}
|
|
508
|
-
}
|
|
509
|
-
export function createLspNavigationTool(getFlag, mutationDeps) {
|
|
510
|
-
return {
|
|
511
|
-
name: "lsp_navigation",
|
|
512
|
-
label: "LSP Navigate",
|
|
513
|
-
description: 'Navigate source with language-server operations such as definition, references, hover, and rename. Example: use `{operation: "references", path: "src/app.ts", line: 12}`.',
|
|
514
|
-
promptSnippet: "Navigate definitions and references with LSP",
|
|
515
|
-
renderResult: compactRenderResult(({ details, args, isError, text }) => {
|
|
516
|
-
const op = details?.operation ?? (typeof args.operation === "string" ? args.operation : "lsp");
|
|
517
|
-
if (isError || details?.supported === false) {
|
|
518
|
-
return `lsp_navigation ${op} — ${details?.emptyReason ?? text.split(`
|
|
519
|
-
`)[0] ?? "unavailable"}`;
|
|
520
|
-
}
|
|
521
|
-
const n = details?.resultCount ?? 0;
|
|
522
|
-
if (n === 0) {
|
|
523
|
-
return `lsp_navigation ${op} — ${details?.emptyReason ?? "no results"}`;
|
|
524
|
-
}
|
|
525
|
-
return `lsp_navigation ${op} — ${n} result${n === 1 ? "" : "s"}`;
|
|
526
|
-
}),
|
|
527
|
-
parameters: Type.Object({
|
|
528
|
-
operation: Type.String({
|
|
529
|
-
description: "LSP operation to perform. Valid values: definition, typeDefinition, declaration, references, hover, signatureHelp, documentSymbol, findSymbol, workspaceSymbol, codeAction, rename, rename_file, implementation, prepareCallHierarchy, incomingCalls, outgoingCalls, executeCommand, workspaceDiagnostics, capabilities."
|
|
530
|
-
}),
|
|
531
|
-
path: Type.Optional(Type.String({
|
|
532
|
-
description: "Target file path."
|
|
533
|
-
})),
|
|
534
|
-
line: Type.Optional(Type.Number({
|
|
535
|
-
description: "1-based line number."
|
|
536
|
-
})),
|
|
537
|
-
character: Type.Optional(Type.Number({
|
|
538
|
-
description: "1-based character offset."
|
|
539
|
-
})),
|
|
540
|
-
symbol: Type.Optional(Type.String({
|
|
541
|
-
description: "Symbol for automatic character resolution."
|
|
542
|
-
})),
|
|
543
|
-
endLine: Type.Optional(Type.Number({
|
|
544
|
-
description: "1-based range end line."
|
|
545
|
-
})),
|
|
546
|
-
endCharacter: Type.Optional(Type.Number({
|
|
547
|
-
description: "1-based range end character."
|
|
548
|
-
})),
|
|
549
|
-
newName: Type.Optional(Type.String({
|
|
550
|
-
description: "New symbol name."
|
|
551
|
-
})),
|
|
552
|
-
newFilePath: Type.Optional(Type.String({
|
|
553
|
-
description: "New file path."
|
|
554
|
-
})),
|
|
555
|
-
apply: Type.Optional(Type.Boolean({
|
|
556
|
-
description: "Apply a mutation instead of previewing it."
|
|
557
|
-
})),
|
|
558
|
-
command: Type.Optional(Type.String({
|
|
559
|
-
description: "Server command identifier."
|
|
560
|
-
})),
|
|
561
|
-
commandArguments: Type.Optional(Type.Array(Type.Unknown(), {
|
|
562
|
-
description: "Arguments for the server command."
|
|
563
|
-
})),
|
|
564
|
-
query: Type.Optional(Type.String({
|
|
565
|
-
description: "Symbol search query."
|
|
566
|
-
})),
|
|
567
|
-
kinds: Type.Optional(Type.Array(Type.String(), {
|
|
568
|
-
description: "Symbol-kind filters."
|
|
569
|
-
})),
|
|
570
|
-
exactMatch: Type.Optional(Type.Boolean({
|
|
571
|
-
description: "Require an exact symbol match."
|
|
572
|
-
})),
|
|
573
|
-
topLevelOnly: Type.Optional(Type.Boolean({
|
|
574
|
-
description: "Exclude nested symbols."
|
|
575
|
-
})),
|
|
576
|
-
maxResults: Type.Optional(Type.Number({
|
|
577
|
-
description: "Maximum symbol matches."
|
|
578
|
-
})),
|
|
579
|
-
callHierarchyItem: Type.Optional(Type.Object({
|
|
580
|
-
name: Type.String(),
|
|
581
|
-
kind: Type.Number(),
|
|
582
|
-
uri: Type.String(),
|
|
583
|
-
range: Type.Object({
|
|
584
|
-
start: Type.Object({
|
|
585
|
-
line: Type.Number(),
|
|
586
|
-
character: Type.Number()
|
|
587
|
-
}),
|
|
588
|
-
end: Type.Object({
|
|
589
|
-
line: Type.Number(),
|
|
590
|
-
character: Type.Number()
|
|
591
|
-
})
|
|
592
|
-
}),
|
|
593
|
-
selectionRange: Type.Object({
|
|
594
|
-
start: Type.Object({
|
|
595
|
-
line: Type.Number(),
|
|
596
|
-
character: Type.Number()
|
|
597
|
-
}),
|
|
598
|
-
end: Type.Object({
|
|
599
|
-
line: Type.Number(),
|
|
600
|
-
character: Type.Number()
|
|
601
|
-
})
|
|
602
|
-
})
|
|
603
|
-
}, {}))
|
|
604
|
-
}),
|
|
605
|
-
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
606
|
-
const startedAt = Date.now();
|
|
607
|
-
let supported = null;
|
|
608
|
-
let diagnosticsMode = "unknown";
|
|
609
|
-
let columnResolution;
|
|
610
|
-
let mutationContext;
|
|
611
|
-
let requestedApply = false;
|
|
612
|
-
const workspaceScopeAttribution = {};
|
|
613
|
-
const finalize = (payload, meta) => {
|
|
614
|
-
if (payload.isError && requestedApply && mutationContext && ["rename", "rename_file", "executeCommand"].includes(meta.operation)) {
|
|
615
|
-
recordLspMutationOutcome(mutationContext, "failed");
|
|
616
|
-
}
|
|
617
|
-
const normalizedFilePath = meta.filePath.replace(/\\/g, "/");
|
|
618
|
-
logLatency({
|
|
619
|
-
type: "phase",
|
|
620
|
-
phase: "lsp_navigation_result",
|
|
621
|
-
filePath: normalizedFilePath,
|
|
622
|
-
durationMs: Date.now() - startedAt,
|
|
623
|
-
metadata: {
|
|
624
|
-
operation: meta.operation,
|
|
625
|
-
failureKind: meta.failureKind,
|
|
626
|
-
resultCount: meta.resultCount,
|
|
627
|
-
supported,
|
|
628
|
-
diagnosticsMode,
|
|
629
|
-
columnResolution,
|
|
630
|
-
...Object.keys(workspaceScopeAttribution).length > 0 ? { workspaceScopeAttribution } : {}
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
const text = payload.content[0]?.text ?? "";
|
|
634
|
-
const envelope = buildLspNavigationEnvelope({
|
|
635
|
-
operation: meta.operation,
|
|
636
|
-
filePath: meta.filePath,
|
|
637
|
-
failureKind: meta.failureKind,
|
|
638
|
-
resultCount: meta.resultCount,
|
|
639
|
-
text,
|
|
640
|
-
isError: payload.isError,
|
|
641
|
-
details: payload.details
|
|
642
|
-
});
|
|
643
|
-
return {
|
|
644
|
-
...payload,
|
|
645
|
-
content: [
|
|
646
|
-
{
|
|
647
|
-
type: "text",
|
|
648
|
-
text: JSON.stringify(envelope)
|
|
649
|
-
}
|
|
650
|
-
],
|
|
651
|
-
details: {
|
|
652
|
-
...payload.details,
|
|
653
|
-
failureKind: meta.failureKind
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
};
|
|
657
|
-
if (getFlag("no-lsp", ctx.cwd)) {
|
|
658
|
-
return finalize({
|
|
659
|
-
content: [
|
|
660
|
-
{
|
|
661
|
-
type: "text",
|
|
662
|
-
text: "lsp_navigation requires LSP to be enabled. Remove --no-lsp to use LSP navigation."
|
|
663
|
-
}
|
|
664
|
-
],
|
|
665
|
-
isError: true
|
|
666
|
-
}, {
|
|
667
|
-
operation: "precheck",
|
|
668
|
-
filePath: "(workspace)",
|
|
669
|
-
failureKind: "lsp_disabled",
|
|
670
|
-
resultCount: 0
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
const { operation: rawOperation, path: rawPath, line, character, symbol, endLine, endCharacter, newName, newFilePath, apply, command, commandArguments, query, kinds, exactMatch, topLevelOnly, maxResults, callHierarchyItem } = params;
|
|
674
|
-
const normalizedOperation = normalizeOperation(rawOperation);
|
|
675
|
-
if (!isValidOperation(normalizedOperation)) {
|
|
676
|
-
return finalize({
|
|
677
|
-
content: [
|
|
678
|
-
{
|
|
679
|
-
type: "text",
|
|
680
|
-
text: `Unknown lsp_navigation operation "${normalizedOperation || String(rawOperation ?? "") || ""}". ` + `Valid operations: ${VALID_OPERATIONS.join(", ")}`
|
|
681
|
-
}
|
|
682
|
-
],
|
|
683
|
-
isError: true,
|
|
684
|
-
details: {
|
|
685
|
-
rawOperation,
|
|
686
|
-
normalizedOperation,
|
|
687
|
-
validOperations: VALID_OPERATIONS
|
|
688
|
-
}
|
|
689
|
-
}, {
|
|
690
|
-
operation: normalizedOperation || "invalid",
|
|
691
|
-
filePath: "(workspace)",
|
|
692
|
-
failureKind: "invalid_operation",
|
|
693
|
-
resultCount: 0
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
const operation = normalizedOperation;
|
|
697
|
-
requestedApply = apply === true;
|
|
698
|
-
if (requestedApply && ["rename", "rename_file", "executeCommand"].includes(operation)) {
|
|
699
|
-
const cwd = ctx.cwd || ".";
|
|
700
|
-
const mutationSource = operation === "executeCommand" ? "lsp-execute-command" : "lsp-rename";
|
|
701
|
-
mutationContext = {
|
|
702
|
-
cwd,
|
|
703
|
-
correlationId: newLspMutationCorrelationId(_toolCallId),
|
|
704
|
-
tool: `lsp_navigation:${operation}`,
|
|
705
|
-
source: mutationSource,
|
|
706
|
-
...mutationDeps,
|
|
707
|
-
readGuard: getFlag("no-read-guard", cwd) ? undefined : mutationDeps?.readGuard,
|
|
708
|
-
isRecordable: (filePath) => {
|
|
709
|
-
return isRecordableProjectPath(filePath, mutationDeps?.runtime?.projectRoot ?? cwd);
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
}
|
|
713
|
-
const isCallHierarchyTraversal = operation === "incomingCalls" || operation === "outgoingCalls";
|
|
714
|
-
const needsFilePath = operation !== "workspaceDiagnostics" && operation !== "workspaceSymbol" && operation !== "executeCommand" && operation !== "capabilities" && !isCallHierarchyTraversal;
|
|
715
|
-
if (needsFilePath && (!rawPath || rawPath.trim().length === 0)) {
|
|
716
|
-
return finalize({
|
|
717
|
-
content: [
|
|
718
|
-
{
|
|
719
|
-
type: "text",
|
|
720
|
-
text: `path is required for ${operation}`
|
|
721
|
-
}
|
|
722
|
-
],
|
|
723
|
-
isError: true
|
|
724
|
-
}, {
|
|
725
|
-
operation,
|
|
726
|
-
filePath: "(workspace)",
|
|
727
|
-
failureKind: "missing_file_path",
|
|
728
|
-
resultCount: 0
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
const filePath = rawPath ? path.isAbsolute(rawPath) ? rawPath : path.resolve(ctx.cwd || ".", rawPath) : "";
|
|
732
|
-
let filePathIsDirectory = false;
|
|
733
|
-
if (filePath) {
|
|
734
|
-
try {
|
|
735
|
-
filePathIsDirectory = nodeFs.statSync(filePath).isDirectory();
|
|
736
|
-
} catch {}
|
|
737
|
-
}
|
|
738
|
-
const lspService = getLSPService();
|
|
739
|
-
if (operation === "capabilities") {
|
|
740
|
-
const snapshots = rawPath ? await lspService.getCapabilitySnapshots(filePath) : await lspService.getCapabilitySnapshots(undefined, workspaceScopeAttribution);
|
|
741
|
-
const output = formatCapabilities(snapshots, rawPath ? filePath : undefined);
|
|
742
|
-
return finalize({
|
|
743
|
-
content: [{ type: "text", text: output }],
|
|
744
|
-
details: {
|
|
745
|
-
operation,
|
|
746
|
-
resultCount: snapshots.length,
|
|
747
|
-
servers: snapshots.map((snapshot) => snapshot.serverId)
|
|
748
|
-
}
|
|
749
|
-
}, {
|
|
750
|
-
operation,
|
|
751
|
-
filePath: rawPath ? filePath : "(workspace)",
|
|
752
|
-
failureKind: snapshots.length === 0 ? "empty_result" : "success",
|
|
753
|
-
resultCount: snapshots.length
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
if (operation === "workspaceDiagnostics") {
|
|
757
|
-
const wsDiagSupport = rawPath ? await lspService.getWorkspaceDiagnosticsSupport(filePath) : await lspService.getWorkspaceDiagnosticsSupport(undefined, workspaceScopeAttribution);
|
|
758
|
-
diagnosticsMode = wsDiagSupport?.mode ?? "unknown";
|
|
759
|
-
if (rawPath && !filePathIsDirectory) {
|
|
760
|
-
const hasLSP = lspService.supportsLSP(filePath);
|
|
761
|
-
if (!hasLSP) {
|
|
762
|
-
return finalize({
|
|
763
|
-
content: [
|
|
764
|
-
{
|
|
765
|
-
type: "text",
|
|
766
|
-
text: `No LSP server available for ${path.basename(filePath)}. Check that the language server is installed.`
|
|
767
|
-
}
|
|
768
|
-
],
|
|
769
|
-
isError: true
|
|
770
|
-
}, {
|
|
771
|
-
operation,
|
|
772
|
-
filePath,
|
|
773
|
-
failureKind: "no_server",
|
|
774
|
-
resultCount: 0
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
await openFileBestEffort(lspService, filePath, true);
|
|
778
|
-
const diagnostics = await lspService.getDiagnostics(filePath);
|
|
779
|
-
const result = [
|
|
780
|
-
{
|
|
781
|
-
filePath,
|
|
782
|
-
diagnostics,
|
|
783
|
-
count: diagnostics.length
|
|
784
|
-
}
|
|
785
|
-
];
|
|
786
|
-
const noteMap = {
|
|
787
|
-
pull: "Note: path mode requests pull diagnostics for this file and returns the aggregated result",
|
|
788
|
-
"push-only": "Note: server is push-only; result depends on published diagnostics for this file"
|
|
789
|
-
};
|
|
790
|
-
const note = noteMap[diagnosticsMode] ?? "Note: workspace diagnostics mode unknown (no active capability snapshot)";
|
|
791
|
-
const resultCount = diagnostics.length;
|
|
792
|
-
return finalize({
|
|
793
|
-
content: [
|
|
794
|
-
{
|
|
795
|
-
type: "text",
|
|
796
|
-
text: `${note}
|
|
797
|
-
${JSON.stringify(result)}`
|
|
798
|
-
}
|
|
799
|
-
],
|
|
800
|
-
details: {
|
|
801
|
-
operation,
|
|
802
|
-
resultCount,
|
|
803
|
-
diagnosticsMode,
|
|
804
|
-
coverage: "requested-file"
|
|
805
|
-
}
|
|
806
|
-
}, {
|
|
807
|
-
operation,
|
|
808
|
-
filePath,
|
|
809
|
-
failureKind: resultCount === 0 ? "empty_result" : "success",
|
|
810
|
-
resultCount
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
const allDiagnostics = await lspService.getAllDiagnostics();
|
|
814
|
-
const result = Array.from(allDiagnostics.entries()).map(([trackedFile, { diags }]) => ({
|
|
815
|
-
filePath: trackedFile,
|
|
816
|
-
diagnostics: diags,
|
|
817
|
-
count: diags.length
|
|
818
|
-
}));
|
|
819
|
-
const noteMap2 = {
|
|
820
|
-
"push-only": "Note: push-only tracked diagnostics snapshot (not full workspace pull diagnostics).",
|
|
821
|
-
pull: "Note: tracked diagnostics snapshot from active clients. Provide path to force file-level diagnostics collection"
|
|
822
|
-
};
|
|
823
|
-
const note = noteMap2[diagnosticsMode] ?? "Note: workspace diagnostics mode unknown (no active capability snapshot)";
|
|
824
|
-
return finalize({
|
|
825
|
-
content: [
|
|
826
|
-
{
|
|
827
|
-
type: "text",
|
|
828
|
-
text: `${note}
|
|
829
|
-
${JSON.stringify(result)}`
|
|
830
|
-
}
|
|
831
|
-
],
|
|
832
|
-
details: {
|
|
833
|
-
operation,
|
|
834
|
-
resultCount: result.length,
|
|
835
|
-
diagnosticsMode,
|
|
836
|
-
coverage: "tracked-open-files"
|
|
837
|
-
}
|
|
838
|
-
}, {
|
|
839
|
-
operation,
|
|
840
|
-
filePath: rawPath ? filePath : "(workspace)",
|
|
841
|
-
failureKind: diagnosticsMode === "push-only" ? "tracked_snapshot" : "success",
|
|
842
|
-
resultCount: result.length
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
if (needsFilePath && filePathIsDirectory) {
|
|
846
|
-
return finalize({
|
|
847
|
-
content: [
|
|
848
|
-
{
|
|
849
|
-
type: "text",
|
|
850
|
-
text: `path must be a source file, got directory: ${filePath}. Pass a source file path, or omit path for workspace-level operations.`
|
|
851
|
-
}
|
|
852
|
-
],
|
|
853
|
-
isError: true
|
|
854
|
-
}, {
|
|
855
|
-
operation,
|
|
856
|
-
filePath,
|
|
857
|
-
failureKind: "filepath_is_directory",
|
|
858
|
-
resultCount: 0
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
const hasLSP = filePath ? lspService.supportsLSP(filePath) : false;
|
|
862
|
-
if (needsFilePath && !hasLSP) {
|
|
863
|
-
return finalize({
|
|
864
|
-
content: [
|
|
865
|
-
{
|
|
866
|
-
type: "text",
|
|
867
|
-
text: `No LSP server available for ${path.basename(filePath)}. Check that the language server is installed.`
|
|
868
|
-
}
|
|
869
|
-
],
|
|
870
|
-
isError: true
|
|
871
|
-
}, {
|
|
872
|
-
operation,
|
|
873
|
-
filePath,
|
|
874
|
-
failureKind: "no_server",
|
|
875
|
-
resultCount: 0
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
if (needsFilePath) {
|
|
879
|
-
const support = await lspService.getOperationSupport(filePath);
|
|
880
|
-
supported = operationSupportStatus(operation, support);
|
|
881
|
-
if (supported === false) {
|
|
882
|
-
return finalize({
|
|
883
|
-
content: [
|
|
884
|
-
{
|
|
885
|
-
type: "text",
|
|
886
|
-
text: `LSP server for ${path.basename(filePath)} does not advertise support for ${operation}`
|
|
887
|
-
}
|
|
888
|
-
],
|
|
889
|
-
isError: true,
|
|
890
|
-
details: {
|
|
891
|
-
operation,
|
|
892
|
-
supported: false,
|
|
893
|
-
emptyReason: "unsupported"
|
|
894
|
-
}
|
|
895
|
-
}, { operation, filePath, failureKind: "unsupported", resultCount: 0 });
|
|
896
|
-
}
|
|
897
|
-
await openFileBestEffort(lspService, filePath);
|
|
898
|
-
}
|
|
899
|
-
const lspLine = (line ?? 1) - 1;
|
|
900
|
-
const needsPosition = [
|
|
901
|
-
"definition",
|
|
902
|
-
"typeDefinition",
|
|
903
|
-
"declaration",
|
|
904
|
-
"references",
|
|
905
|
-
"hover",
|
|
906
|
-
"signatureHelp",
|
|
907
|
-
"codeAction",
|
|
908
|
-
"rename",
|
|
909
|
-
"implementation",
|
|
910
|
-
"prepareCallHierarchy"
|
|
911
|
-
].includes(operation);
|
|
912
|
-
const resolvedCharacter = needsPosition && filePath ? resolveSymbolColumn(nodeFs.existsSync(filePath) ? nodeFs.readFileSync(filePath, "utf-8") : "", line ?? 1, character, symbol) : {
|
|
913
|
-
character: character ?? 1,
|
|
914
|
-
strategy: "explicit"
|
|
915
|
-
};
|
|
916
|
-
columnResolution = resolvedCharacter;
|
|
917
|
-
const lspChar = resolvedCharacter.character - 1;
|
|
918
|
-
const lspEndLine = (endLine ?? line ?? 1) - 1;
|
|
919
|
-
const lspEndChar = (endCharacter ?? resolvedCharacter.character) - 1;
|
|
920
|
-
const runWorkspaceSymbolOperation = async () => {
|
|
921
|
-
const support = rawPath ? await lspService.getOperationSupport(filePath) : await lspService.getOperationSupport(undefined, workspaceScopeAttribution);
|
|
922
|
-
supported = operationSupportStatus(operation, support);
|
|
923
|
-
if (supported === false) {
|
|
924
|
-
throw new Error("__UNSUPPORTED__ Active LSP server does not advertise support for workspaceSymbol");
|
|
925
|
-
}
|
|
926
|
-
if (!query || query.trim().length === 0) {
|
|
927
|
-
throw new Error("__BADINPUT__ query parameter required for workspaceSymbol");
|
|
928
|
-
}
|
|
929
|
-
if (rawPath) {
|
|
930
|
-
await openFileBestEffort(lspService, filePath);
|
|
931
|
-
}
|
|
932
|
-
try {
|
|
933
|
-
const raw = rawPath ? await lspService.workspaceSymbol(query ?? "", filePath) : await lspService.workspaceSymbol(query ?? "", undefined, workspaceScopeAttribution);
|
|
934
|
-
const filtered = (Array.isArray(raw) ? raw : [raw]).filter((s) => typeof s === "object" && s !== null && (!s.kind || NAVIGABLE_SYMBOL_KINDS.has(s.kind)));
|
|
935
|
-
return dedupeWorkspaceSymbols(filtered).slice(0, 15);
|
|
936
|
-
} catch (err) {
|
|
937
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
938
|
-
if (rawPath && /No Project/i.test(msg)) {
|
|
939
|
-
await openFileBestEffort(lspService, filePath);
|
|
940
|
-
await new Promise((resolve) => setTimeout(resolve, 120));
|
|
941
|
-
const retryRaw = await lspService.workspaceSymbol(query ?? "", filePath);
|
|
942
|
-
const retrySymbols = (Array.isArray(retryRaw) ? retryRaw : [retryRaw]).filter((s) => typeof s === "object" && s !== null);
|
|
943
|
-
return dedupeWorkspaceSymbols(retrySymbols);
|
|
944
|
-
}
|
|
945
|
-
throw err;
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
const runOperation = async () => {
|
|
949
|
-
switch (operation) {
|
|
950
|
-
case "definition":
|
|
951
|
-
return lspService.definition(filePath, lspLine, lspChar);
|
|
952
|
-
case "typeDefinition":
|
|
953
|
-
return lspService.typeDefinition(filePath, lspLine, lspChar);
|
|
954
|
-
case "declaration":
|
|
955
|
-
return lspService.declaration(filePath, lspLine, lspChar);
|
|
956
|
-
case "references":
|
|
957
|
-
return lspService.references(filePath, lspLine, lspChar);
|
|
958
|
-
case "hover":
|
|
959
|
-
return lspService.hover(filePath, lspLine, lspChar);
|
|
960
|
-
case "signatureHelp":
|
|
961
|
-
return lspService.signatureHelp(filePath, lspLine, lspChar);
|
|
962
|
-
case "documentSymbol":
|
|
963
|
-
return lspService.documentSymbol(filePath);
|
|
964
|
-
case "findSymbol": {
|
|
965
|
-
if (!query || query.trim().length === 0) {
|
|
966
|
-
throw new Error("__BADINPUT__ query parameter required for findSymbol");
|
|
967
|
-
}
|
|
968
|
-
const symbols = await lspService.documentSymbol(filePath);
|
|
969
|
-
return findSymbolMatches(symbols, query, {
|
|
970
|
-
maxResults: Math.max(1, Math.min(100, maxResults ?? 20)),
|
|
971
|
-
topLevelOnly: topLevelOnly ?? false,
|
|
972
|
-
exactMatch: exactMatch ?? false,
|
|
973
|
-
kinds: new Set((kinds ?? []).map((kind) => kind.trim().toLowerCase()).filter(Boolean))
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
case "workspaceSymbol":
|
|
977
|
-
return runWorkspaceSymbolOperation();
|
|
978
|
-
case "codeAction":
|
|
979
|
-
return lspService.codeAction(filePath, lspLine, lspChar, lspEndLine, lspEndChar);
|
|
980
|
-
case "rename": {
|
|
981
|
-
if (!newName || newName.trim().length === 0) {
|
|
982
|
-
throw new Error("__BADINPUT__ newName parameter required for rename");
|
|
983
|
-
}
|
|
984
|
-
const edit = await lspService.rename(filePath, lspLine, lspChar, newName);
|
|
985
|
-
if (!edit)
|
|
986
|
-
return null;
|
|
987
|
-
if (!apply) {
|
|
988
|
-
return {
|
|
989
|
-
applied: false,
|
|
990
|
-
summary: summarizeWorkspaceEdit(edit, ctx.cwd || "."),
|
|
991
|
-
edit
|
|
992
|
-
};
|
|
993
|
-
}
|
|
994
|
-
const applied = await applyWorkspaceEdit(edit, ctx.cwd || ".", {
|
|
995
|
-
mutationContext
|
|
996
|
-
});
|
|
997
|
-
for (const touchedFile of applied.files) {
|
|
998
|
-
try {
|
|
999
|
-
await openFileBestEffort(lspService, touchedFile, false);
|
|
1000
|
-
} catch {}
|
|
1001
|
-
}
|
|
1002
|
-
return { applied: true, ...applied };
|
|
1003
|
-
}
|
|
1004
|
-
case "rename_file": {
|
|
1005
|
-
if (!newFilePath || newFilePath.trim().length === 0) {
|
|
1006
|
-
throw new Error("__BADINPUT__ newFilePath parameter required for rename_file");
|
|
1007
|
-
}
|
|
1008
|
-
const resolvedNewFilePath = path.isAbsolute(newFilePath) ? newFilePath : path.resolve(ctx.cwd || ".", newFilePath);
|
|
1009
|
-
const result = await lspService.renameFile(filePath, resolvedNewFilePath, {
|
|
1010
|
-
cwd: ctx.cwd || ".",
|
|
1011
|
-
apply: apply ?? false,
|
|
1012
|
-
...mutationContext ? { mutationContext } : {}
|
|
1013
|
-
});
|
|
1014
|
-
if (result.applied) {
|
|
1015
|
-
for (const touchedFile of result.files ?? []) {
|
|
1016
|
-
try {
|
|
1017
|
-
await openFileBestEffort(lspService, touchedFile, false);
|
|
1018
|
-
} catch {}
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
return result;
|
|
1022
|
-
}
|
|
1023
|
-
case "implementation":
|
|
1024
|
-
return lspService.implementation(filePath, lspLine, lspChar);
|
|
1025
|
-
case "prepareCallHierarchy":
|
|
1026
|
-
return lspService.prepareCallHierarchy(filePath, lspLine, lspChar);
|
|
1027
|
-
case "executeCommand": {
|
|
1028
|
-
if (!command || command.trim().length === 0) {
|
|
1029
|
-
throw new Error("__BADINPUT__ command parameter required for executeCommand");
|
|
1030
|
-
}
|
|
1031
|
-
const advertised = rawPath ? await lspService.getAdvertisedCommands(filePath) : await lspService.getAdvertisedCommands(undefined, workspaceScopeAttribution);
|
|
1032
|
-
const isAdvertised = advertised.includes(command);
|
|
1033
|
-
if (apply !== true) {
|
|
1034
|
-
return {
|
|
1035
|
-
executed: false,
|
|
1036
|
-
dryRun: true,
|
|
1037
|
-
command,
|
|
1038
|
-
advertised: isAdvertised,
|
|
1039
|
-
advertisedCommands: advertised,
|
|
1040
|
-
note: isAdvertised ? "Command is advertised. Re-run with apply:true to execute." : "Command is NOT advertised by the active server; execution would be refused."
|
|
1041
|
-
};
|
|
1042
|
-
}
|
|
1043
|
-
if (!isAdvertised) {
|
|
1044
|
-
throw new Error(`__UNSUPPORTED__ command "${command}" is not advertised by the active LSP server (advertised: ${advertised.join(", ") || "none"})`);
|
|
1045
|
-
}
|
|
1046
|
-
return rawPath ? lspService.executeCommand(filePath, command, commandArguments, mutationContext) : lspService.executeCommand(undefined, command, commandArguments, mutationContext, workspaceScopeAttribution);
|
|
1047
|
-
}
|
|
1048
|
-
case "incomingCalls": {
|
|
1049
|
-
if (!callHierarchyItem) {
|
|
1050
|
-
throw new Error("__BADINPUT__ callHierarchyItem parameter required for incomingCalls");
|
|
1051
|
-
}
|
|
1052
|
-
supported = operationSupportStatus(operation, await lspService.getOperationSupport(uriToPath(callHierarchyItem.uri)));
|
|
1053
|
-
if (supported === false) {
|
|
1054
|
-
throw new Error("__UNSUPPORTED__ Active LSP server does not advertise support for incomingCalls");
|
|
1055
|
-
}
|
|
1056
|
-
return lspService.incomingCalls(callHierarchyItem);
|
|
1057
|
-
}
|
|
1058
|
-
case "outgoingCalls": {
|
|
1059
|
-
if (!callHierarchyItem) {
|
|
1060
|
-
throw new Error("__BADINPUT__ callHierarchyItem parameter required for outgoingCalls");
|
|
1061
|
-
}
|
|
1062
|
-
supported = operationSupportStatus(operation, await lspService.getOperationSupport(uriToPath(callHierarchyItem.uri)));
|
|
1063
|
-
if (supported === false) {
|
|
1064
|
-
throw new Error("__UNSUPPORTED__ Active LSP server does not advertise support for outgoingCalls");
|
|
1065
|
-
}
|
|
1066
|
-
return lspService.outgoingCalls(callHierarchyItem);
|
|
1067
|
-
}
|
|
1068
|
-
default:
|
|
1069
|
-
return [];
|
|
1070
|
-
}
|
|
1071
|
-
};
|
|
1072
|
-
let result;
|
|
1073
|
-
let usedDocumentSymbolFallback = false;
|
|
1074
|
-
try {
|
|
1075
|
-
result = await runOperation();
|
|
1076
|
-
const isEmptyInitial = !result || Array.isArray(result) && result.length === 0;
|
|
1077
|
-
const shouldRetryOnEmpty = isEmptyInitial && needsFilePath && [
|
|
1078
|
-
"definition",
|
|
1079
|
-
"typeDefinition",
|
|
1080
|
-
"declaration",
|
|
1081
|
-
"references",
|
|
1082
|
-
"hover",
|
|
1083
|
-
"signatureHelp",
|
|
1084
|
-
"codeAction",
|
|
1085
|
-
"rename",
|
|
1086
|
-
"implementation"
|
|
1087
|
-
].includes(operation);
|
|
1088
|
-
if (shouldRetryOnEmpty) {
|
|
1089
|
-
await openFileBestEffort(lspService, filePath, true);
|
|
1090
|
-
result = await runOperation();
|
|
1091
|
-
}
|
|
1092
|
-
const stillEmpty = !result || Array.isArray(result) && result.length === 0;
|
|
1093
|
-
if (stillEmpty && needsFilePath && operation === "definition") {
|
|
1094
|
-
const content = nodeFs.readFileSync(filePath, "utf-8");
|
|
1095
|
-
const token = line && character ? tokenAtPosition(content, line, character) : undefined;
|
|
1096
|
-
if (token) {
|
|
1097
|
-
const docSymbols = await lspService.documentSymbol(filePath);
|
|
1098
|
-
const locations = pickLocalSymbolLocation(docSymbols, token, filePath);
|
|
1099
|
-
if (locations.length > 0) {
|
|
1100
|
-
result = locations;
|
|
1101
|
-
usedDocumentSymbolFallback = true;
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
if (mutationContext && requestedApply && !mutationContext.summaryEmitted) {
|
|
1106
|
-
const outcome = operation === "rename_file" && result && typeof result === "object" && "applied" in result && result.applied === false ? "failed" : operation === "executeCommand" && result && typeof result === "object" && ("executed" in result) && result.executed === false ? "failed" : "skipped";
|
|
1107
|
-
recordLspMutationOutcome(mutationContext, outcome);
|
|
1108
|
-
}
|
|
1109
|
-
} catch (err) {
|
|
1110
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
1111
|
-
if (msg.startsWith("__UNSUPPORTED__ ")) {
|
|
1112
|
-
return finalize({
|
|
1113
|
-
content: [
|
|
1114
|
-
{
|
|
1115
|
-
type: "text",
|
|
1116
|
-
text: msg.replace("__UNSUPPORTED__ ", "")
|
|
1117
|
-
}
|
|
1118
|
-
],
|
|
1119
|
-
isError: true,
|
|
1120
|
-
details: {
|
|
1121
|
-
operation,
|
|
1122
|
-
supported: false,
|
|
1123
|
-
emptyReason: "unsupported"
|
|
1124
|
-
}
|
|
1125
|
-
}, { operation, filePath, failureKind: "unsupported", resultCount: 0 });
|
|
1126
|
-
}
|
|
1127
|
-
if (msg.startsWith("__BADINPUT__ ")) {
|
|
1128
|
-
return finalize({
|
|
1129
|
-
content: [
|
|
1130
|
-
{
|
|
1131
|
-
type: "text",
|
|
1132
|
-
text: msg.replace("__BADINPUT__ ", "")
|
|
1133
|
-
}
|
|
1134
|
-
],
|
|
1135
|
-
isError: true,
|
|
1136
|
-
details: {}
|
|
1137
|
-
}, { operation, filePath, failureKind: "bad_input", resultCount: 0 });
|
|
1138
|
-
}
|
|
1139
|
-
return finalize({
|
|
1140
|
-
content: [
|
|
1141
|
-
{
|
|
1142
|
-
type: "text",
|
|
1143
|
-
text: `LSP error: ${err instanceof Error ? err.message : String(err)}`
|
|
1144
|
-
}
|
|
1145
|
-
],
|
|
1146
|
-
isError: true,
|
|
1147
|
-
details: {}
|
|
1148
|
-
}, { operation, filePath, failureKind: "lsp_error", resultCount: 0 });
|
|
1149
|
-
}
|
|
1150
|
-
const isEmpty = !result || Array.isArray(result) && result.length === 0;
|
|
1151
|
-
const fileCtx = filePath ? " at " + path.basename(filePath) : "";
|
|
1152
|
-
const lineCtx = line ? ":" + line + ":" + character : "";
|
|
1153
|
-
let output = isEmpty ? "No results for " + operation + fileCtx + lineCtx : JSON.stringify(result);
|
|
1154
|
-
if (isEmpty && operation === "workspaceSymbol" && !rawPath) {
|
|
1155
|
-
output += `
|
|
1156
|
-
Hint: provide path to scope workspaceSymbol to the active language server/root.`;
|
|
1157
|
-
}
|
|
1158
|
-
if (usedDocumentSymbolFallback) {
|
|
1159
|
-
output += `
|
|
1160
|
-
Note: served from documentSymbol fallback due to empty primary result.`;
|
|
1161
|
-
}
|
|
1162
|
-
if (operation === "references" && Array.isArray(result) && result.length <= 2) {
|
|
1163
|
-
output += `
|
|
1164
|
-
Hint: references from usage sites can be partial; retry from the symbol definition for broader cross-file results.`;
|
|
1165
|
-
}
|
|
1166
|
-
const actionStats = operation === "codeAction" && Array.isArray(result) ? classifyCodeActions(result) : null;
|
|
1167
|
-
if (operation === "codeAction" && actionStats) {
|
|
1168
|
-
if (actionStats.quickfix === 0 && actionStats.refactor > 0) {
|
|
1169
|
-
output += `
|
|
1170
|
-
Note: no diagnostic quick fixes returned; refactor-only actions available.`;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
const resultCount = Array.isArray(result) ? result.length : result ? 1 : 0;
|
|
1174
|
-
const searchReads = collectSearchReadsForOperation(operation, result, callHierarchyItem);
|
|
1175
|
-
return finalize({
|
|
1176
|
-
content: [{ type: "text", text: output }],
|
|
1177
|
-
details: {
|
|
1178
|
-
operation,
|
|
1179
|
-
supported,
|
|
1180
|
-
searchReads: searchReads.length > 0 ? searchReads : undefined,
|
|
1181
|
-
emptyReason: isEmpty ? emptyReasonForOperation(operation) : undefined,
|
|
1182
|
-
codeActionKinds: actionStats ?? undefined,
|
|
1183
|
-
columnResolution: columnResolution?.strategy === "explicit" ? undefined : columnResolution,
|
|
1184
|
-
resultCount
|
|
1185
|
-
}
|
|
1186
|
-
}, {
|
|
1187
|
-
operation,
|
|
1188
|
-
filePath: rawPath ? filePath : "(workspace)",
|
|
1189
|
-
failureKind: isEmpty ? "empty_result" : usedDocumentSymbolFallback ? "fallback_success" : "success",
|
|
1190
|
-
resultCount
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
};
|
|
1194
|
-
}
|