@mrclrchtr/supi-lsp 10.0.0 → 11.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.
Files changed (33) hide show
  1. package/README.md +88 -2
  2. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
  3. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
  4. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
  5. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
  6. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
  8. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
  9. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
  10. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
  11. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
  12. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
  13. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
  14. package/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
  15. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
  16. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  17. package/package.json +3 -3
  18. package/src/api.ts +1 -0
  19. package/src/client/client-diagnostic-host.ts +3 -0
  20. package/src/client/client-diagnostics.ts +6 -4
  21. package/src/client/client-request-enrollment.ts +66 -22
  22. package/src/client/client-semantic-input-barrier.ts +37 -5
  23. package/src/client/client.ts +136 -43
  24. package/src/manager/manager.ts +261 -22
  25. package/src/provider/refactor-planning.ts +13 -0
  26. package/src/provider/semantic-edit-discovery.ts +151 -0
  27. package/src/provider/semantic-edit-normalizer.ts +97 -129
  28. package/src/provider/semantic-edit-protocol.ts +132 -0
  29. package/src/session/runtime-controller.ts +8 -1
  30. package/src/session/runtime-registry.ts +7 -20
  31. package/src/session/runtime-rename.ts +172 -0
  32. package/src/session/workspace-lsp-runtime.ts +14 -0
  33. package/src/utils.ts +12 -11
package/README.md CHANGED
@@ -20,7 +20,81 @@ npm install @mrclrchtr/supi-lsp
20
20
 
21
21
  ## Language-server support
22
22
 
23
- The runtime starts an installed server when the project contains a matching file type and, where configured, a root marker. Some built-in servers use extension-based discovery without a root marker. Built-in command names must be on `PATH`; a configured absolute command path is also supported. This table describes diagnostic support, not the full semantic feature set. A push server can still provide hover, definitions, references, symbols, and refactors.
23
+ SuPi provides 13 built-in server definitions. All are enabled unless `lsp.servers.<key>.enabled` is `false`. Install the language servers yourself; SuPi does not download or install them. Built-in commands must be on `PATH`; a configured absolute command path is also supported. Code Intelligence starts the runtime only for trusted projects.
24
+
25
+ ### Built-in route matrix
26
+
27
+ This matrix describes the default routing configuration, not a live test or a guarantee of every semantic feature. File suffixes are matched without case sensitivity. The configuration stores `fileTypes` without the leading dot.
28
+
29
+ | Language / config key | Default command and arguments | File extensions | Root markers for automatic discovery |
30
+ |---|---|---|---|
31
+ | TypeScript / JavaScript — `typescript` | `typescript-language-server --stdio` | `.ts`, `.tsx`, `.js`, `.jsx`, `.mts`, `.cts`, `.mjs`, `.cjs` | `tsconfig.json`, `jsconfig.json`, `package.json` |
32
+ | Python — `python` | `pyright-langserver --stdio` | `.py`, `.pyi` | `pyproject.toml`, `setup.py`, `setup.cfg`, `requirements.txt`, `pyrightconfig.json` |
33
+ | Rust — `rust` | `rust-analyzer` | `.rs` | `Cargo.toml` |
34
+ | Go — `go` | `gopls serve` | `.go`, `.mod` | `go.mod`, `go.sum` |
35
+ | C / C++ — `c` | `clangd --background-index` | `.c`, `.h`, `.cpp`, `.hpp`, `.cc`, `.cxx`, `.hxx`, `.c++`, `.h++` | `compile_commands.json`, `CMakeLists.txt`, `.clangd`, `Makefile` |
36
+ | Ruby — `ruby` | `ruby-lsp` | `.rb`, `.erb`, `.gemspec` | `Gemfile`, `.ruby-version` |
37
+ | Java — `java` | `jdtls` | `.java` | `pom.xml`, `build.gradle` |
38
+ | Kotlin — `kotlin` | `kotlin-lsp --stdio` | `.kt`, `.kts` | `build.gradle.kts`, `pom.xml` |
39
+ | Bash / shell — `bash` | `bash-language-server start` | `.sh`, `.bash`, `.zsh`, `.ksh` | None; matching-file scan |
40
+ | HTML — `html` | `vscode-html-language-server --stdio` | `.html`, `.htm`, `.xhtml` | `package.json` |
41
+ | SQL — `sql` | `sql-language-server up --method stdio` | `.sql` | None; matching-file scan |
42
+ | R — `r` | `R --slave -e 'languageserver::run()'` | `.r` | `DESCRIPTION`, `renv.lock`, `.Rprofile` |
43
+ | LaTeX / BibTeX — `latex` | `texlab` | `.tex`, `.bib` | None; matching-file scan |
44
+
45
+ - Automatic discovery checks installed commands, then root markers or matching files for routes without markers. A marker can detect a route without a matching source file. Exact file requests can start compatible routes lazily. Automatic path exclusions still apply to discovery.
46
+ - `cpp` is a configuration alias for `c`, not a separate server. R also requires the R `languageserver` package. Each route has one default command; SuPi does not try alternative server binaries.
47
+ - Root markers are not file routes. For example, `go.sum` can identify a Go project, but `.sum` and `.work` are not built-in Go file types.
48
+ - `.mod`, `.erb`, and `.bib` have LSP routes but no bundled AST grammar. The built-in Texlab route excludes `.sty` and `.cls`, although [Tree-sitter supports them](../supi-tree-sitter/README.md#language-support-matrix). Texlab document IDs are `latex` for `.tex` and `bibtex` for `.bib`.
49
+ - Unlisted file types have no built-in route. [Custom server configuration](#custom-server-configuration) can add routes or replace commands, arguments, file types, and root markers. This does not add AST support.
50
+
51
+ Sources: [built-in definitions](src/config/defaults.json), [configuration and suffix matching](src/config/config.ts), and [automatic discovery](src/session/scanner.ts). Regression tests cover [configuration and representative routes](__tests__/unit/config.test.ts) and [discovery](__tests__/unit/scanner.test.ts).
52
+
53
+ ### Semantic feature limits
54
+
55
+ A configured route is not a ready server. Features depend on the active server, its project state, and its negotiated capabilities. Use `code_health` or `/supi-ci-status` from Code Intelligence to inspect the current state.
56
+
57
+ | Feature | SuPi support and requirement |
58
+ |---|---|
59
+ | Hover, definitions, references, implementations, document/workspace symbols | Supported through the server's corresponding LSP methods; availability and coverage differ by server. |
60
+ | Diagnostics | Native pull, the eligible TypeScript request adapter, or ambient push. Push observation alone cannot confirm that a file is clean. See the diagnostic policy below. |
61
+ | `rename_symbol` | Requires server rename support and validated text edits; uses `prepareRename` when advertised. |
62
+ | `update_imports` / `delete_dead_code` | Requires matching `source.organizeImports` / `source.removeUnused` code actions that produce validated text edits. |
63
+ | `extract_function` / `extract_variable` | Unavailable for all languages: standard LSP code actions do not provide a safe exact extraction-name contract. |
64
+
65
+ The [operation-support model](src/config/operation-support.ts) separates server advertisement from SuPi planning limits. A server can advertise an action that SuPi cannot safely turn into a plan.
66
+
67
+ ### Reference-server acceptance
68
+
69
+ The [Code Intelligence acceptance suite](../supi-code-intelligence/__tests__/acceptance/language-baseline-harness.ts) exercises public tools against real servers for TypeScript, JavaScript, Python, Java, Go, Rust, C, and C++. Its [pinned Linux/macOS configuration](../../scripts/language-baseline/pins.json) is separate from the built-in route matrix. Qualification remains pending until both pinned CI jobs pass. Missing test prerequisites are failures, not skipped passes.
70
+
71
+ Pyright remains the default Python server, but the audited server lacks implementation lookup. The acceptance suite uses an explicit `lsp.servers.python.command: "basedpyright-langserver"` override with `args: ["--stdio"]`. This does not change existing user configurations or create a fallback. Basedpyright uses its own settings namespace and diagnostic defaults; see the [configuration example](../supi-code-intelligence/README.md#reference-server-verification).
72
+
73
+ JDTLS acceptance uses a compatible pinned JDK and isolated writable `-data` and `-configuration` directories. Keep test workspaces separate from personal JDTLS state. The [capability baseline](../../docs/conventions/code-language-baseline.md) defines the operation and evidence requirements.
74
+
75
+ ### Java startup and project JDKs
76
+
77
+ The JDK that starts JDTLS can differ from the JDK that builds your project. Set a compatible server runtime through the Java route without changing the shell or project compiler:
78
+
79
+ ```json
80
+ {
81
+ "lsp": {
82
+ "servers": {
83
+ "java": {
84
+ "env": { "JAVA_HOME": "/path/to/compatible-server-jdk" }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ Use the [pinned acceptance JDK](../../scripts/language-baseline/pins.json) for the reference combination. Do not rely only on the launcher's minimum-version check: bundled Eclipse components can require a newer Java execution environment. If startup exits before `initialize`, inspect the Eclipse configuration log for an unresolved `osgi.ee` / `JavaSE` requirement. An empty stderr tail does not establish that the JDK is compatible.
92
+
93
+ For concurrent workspaces or isolated checks, pass separate writable `-data` and `-configuration` directories. Do not share a JDTLS data directory between processes. Restart or reload to establish a new runtime settings snapshot after changing the route configuration. SuPi does not select or install a JDK automatically.
94
+
95
+ ### Historical diagnostic audit
96
+
97
+ The following table describes diagnostic support, not the full semantic feature set. A push server can still provide hover, definitions, references, symbols, and refactors.
24
98
 
25
99
  The table is a historical initialize-handshake audit performed on 2026-08-21 against the locally installed server versions. It is not a current retest. The TypeScript row also records a separate issue 407 adapter verification on 2026-09-13. That verification did not retest the other server binaries; their audit versions and statuses remain historical. The handshake is authoritative and can report a different mode after an upgrade; treat rows marked `unverified` as unknown until a probe confirms them. Pull-capability facts come from the official LSP specification (pull diagnostics are a 3.17 feature; 3.18 is the current specification at microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification).
26
100
 
@@ -77,7 +151,9 @@ Refresh and file collection share synchronization, evidence-revision, deadline,
77
151
 
78
152
  Caller cancellation or deadline stops only that caller's wait. Explicit diagnostic requests use an owned transport lifetime: supersession drops queued jobs and stops future adapter phases but does not cancel an active protocol request. The route stays occupied until actual settlement or connection disposal. The owner timeout attempts protocol cancellation but does not prove that the backend stopped. The owner bound is at least 30 seconds (or a larger collection budget). A result from an obsolete document generation is discarded. Ordinary semantic requests still pass caller cancellation to the protocol transport.
79
153
 
80
- If another request first opens a document during an active semantic or diagnostic request, the client can synchronize and repeat the request once. The retry retains the caller's original signal and deadline. Content, workspace, close, and lifecycle changes still reject stale results. A diagnostic retry collects new request evidence; it does not promote an old cache. This retry is not route recovery. A second enrollment during the retry still rejects the result. Semantic failure reasons state whether the retry failed or was exhausted. The `semantic-request.enrollment-retry` debug event records retry start and outcome with the public call's opaque operation ID, when supplied. A completed RPC alone does not establish accepted semantic evidence.
154
+ If another request first opens a document during an active semantic or diagnostic request, the client can synchronize and repeat the request once. The retry retains the caller's original signal and deadline. Content, workspace, close, and lifecycle changes still reject stale results. A diagnostic retry collects new request evidence; it does not promote an old cache. This retry is not route recovery. A second enrollment during the retry still rejects the result. Semantic failure reasons state whether the retry failed or was exhausted. The bounded `request.retry` debug event records the retry reason and outcome with the public call's opaque operation ID, when supplied. A completed RPC alone does not establish accepted semantic evidence.
155
+
156
+ A read-only semantic request can also retry once after an LSP `ContentModified` error (`-32801`). This retry shares the same one-retry budget as enrollment; it does not add another try. The client keeps the original request parameters and checks changes from the first failed input revision. It runs the full input sync before retry and checks current inputs before it accepts a result. An enrollment is still the only input change that can permit a retry. A content, workspace, close, lifecycle, or retirement change blocks it. Client replacement, caller cancellation, and a deadline also block retry. The post-request check rejects a result if inputs change while that attempt runs. This error-code retry applies only to read-only semantic requests. Diagnostics, rename, code actions, and refactors keep the default policy and do not retry `ContentModified`. See the [LSP 3.17 message-ordering rule](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#messageOrdering), the [retry guard](src/client/client-request-enrollment.ts), and the [client query path](src/client/client.ts).
81
157
 
82
158
  Diagnostic collection does not close and reopen a document to obtain confirmation. It does not send a no-op `didChange` for that purpose. Refresh retains unchanged documents and their current server state, and resynchronizes changed or invalidated documents. A client restart may reopen tracked documents to restore client state; that is recovery, not diagnostic confirmation.
83
159
 
@@ -127,6 +203,12 @@ An exact semantic request can still route an excluded file when a compatible ser
127
203
 
128
204
  Tsconfig and jsconfig filtering applies only to TypeScript and JavaScript-family files (`.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.jsx`, `.mjs`, and `.cjs`). Other-language diagnostics are not filtered by a nearby TypeScript or JavaScript project config. Automatic path exclusions and configured diagnostic suppression still apply. A single-file health result omits the `Tsconfig` coverage line for other languages.
129
205
 
206
+ ### C-family document languages
207
+
208
+ The Code Intelligence workspace host can pass ordered, trusted-project [file associations](../supi-code-intelligence/README.md#cc-file-associations). The same snapshot selects the AST grammar and the LSP document language ID. A `.h` file can use `cpp` while retaining the existing `clangd` route. Associations do not change server commands, add suffixes, or establish compiler flags.
209
+
210
+ Direct library callers can supply a validated `fileAssociations` resolver through `LspRuntimeController` options. Without that option, the existing suffix-based document language IDs remain unchanged. The caller owns configuration trust.
211
+
130
212
  ### Custom server configuration
131
213
 
132
214
  A custom server needs a command and at least one file type. Advanced server settings are JSON objects. They replace inherited settings as a whole; `initializationOptions` remains a separate initialize value:
@@ -180,6 +262,10 @@ it and otherwise uses direct standard rename. Standard LSP does not provide
180
262
  a safe exact extraction-name contract, so `extract_function` and `extract_variable`
181
263
  plans report a SuPi planning limitation instead of selecting a generated name.
182
264
 
265
+ Rename responses that need additional document state can trigger one bounded discovery/enrollment retry. SuPi validates edit shape and canonical mutation paths, enrolls at most 64 affected files on the same route, and requests fresh edits. The first response is not a plan. Numeric versions must still match. A null version for an open document requires verified synchronized-content evidence; the plan retains the request fingerprint and client version. Missing snapshots, changed inputs, a larger follow-up edit set, and unsafe edits remain unavailable. Planning and apply revalidate these preconditions; no version is discarded to make an edit fit.
266
+
267
+ Explicit maintenance retires routes whose project roots are confirmed missing or no longer directories. Retirement shuts down the route, clears its failure/recovery state, and prevents pending work from restoring it. Permission errors do not establish removal. Other routes and the workspace runtime owner remain active. Passive inventory reads do not perform this cleanup.
268
+
183
269
  Clients, `LspManager`, and the default runtime implementation remain internal.
184
270
 
185
271
  ## Runtime split
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017-present, Jon Schlinkert.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.