@mrclrchtr/supi-tree-sitter 9.1.2 → 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.
- package/README.md +63 -17
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/package.json +3 -3
- package/src/language.ts +16 -10
- package/src/operation-support.ts +13 -6
- package/src/provider/tree-sitter-provider.ts +19 -1
- package/src/session/runtime-controller.ts +18 -4
- package/src/session/session.ts +10 -3
- package/src/session/structural-worker-client.ts +17 -2
- package/src/session/structural-worker-process.ts +22 -5
- package/src/session/structural-worker-protocol.ts +36 -1
- package/src/syntax-errors.ts +73 -0
- package/src/syntax-node.ts +4 -0
- package/src/tool/call-sites.ts +15 -9
- package/src/tool/callees.ts +24 -15
- package/src/tool/exports.ts +8 -1
- package/src/tool/imports.ts +233 -7
- package/src/tool/node-at.ts +7 -3
- package/src/tool/outline-expansion.ts +78 -0
- package/src/tool/outline-jvm.ts +25 -4
- package/src/tool/outline-nested.ts +390 -0
- package/src/tool/outline.ts +49 -28
- package/src/types.ts +16 -0
- package/src/worker/process-host.mjs +61 -24
- package/src/worker/runtime.ts +44 -10
- package/src/worker/service.ts +13 -9
- package/src/worker/worker-main.ts +15 -2
package/README.md
CHANGED
|
@@ -38,27 +38,60 @@ It does **not** register pi tools or commands on its own.
|
|
|
38
38
|
|
|
39
39
|
Coordinates in the library APIs use **1-based** line and character columns. Character positions use UTF-16 code units. Relative paths resolve from the session cwd, and a leading `@` on file paths is stripped.
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Language support matrix
|
|
42
42
|
|
|
43
|
-
-
|
|
44
|
-
- Python (`.py`, `.pyi`)
|
|
45
|
-
- Rust (`.rs`)
|
|
46
|
-
- Go (`.go`)
|
|
47
|
-
- C / C++ (`.c`, `.h`, `.cpp`, `.hpp`, `.cc`, `.cxx`, `.hxx`, `.c++`, `.h++`)
|
|
48
|
-
- Java (`.java`)
|
|
49
|
-
- Kotlin (`.kt`, `.kts`)
|
|
50
|
-
- Ruby (`.rb`, `.gemspec`)
|
|
51
|
-
- Bash / shell (`.sh`, `.bash`, `.zsh`, `.ksh`)
|
|
52
|
-
- HTML (`.html`, `.htm`, `.xhtml`)
|
|
53
|
-
- R (`.r`)
|
|
54
|
-
- SQL (`.sql`)
|
|
55
|
-
- LaTeX (`.tex`, `.sty`, `.cls`)
|
|
43
|
+
The package bundles 16 grammars for 38 file extensions. All listed extensions support parsing, point-node inspection, and custom Tree-sitter queries without an LSP server. Grammar selection uses the file extension without case sensitivity, not a shebang.
|
|
56
44
|
|
|
57
|
-
|
|
45
|
+
**Yes** means that a built-in extractor or query exists. **No** means that the operation is not implemented for that grammar. Parser support does not guarantee complete extraction of every language construct.
|
|
58
46
|
|
|
59
|
-
|
|
47
|
+
| Language / grammar | File extensions | Outline | Imports | Exports | Call sites / callees |
|
|
48
|
+
|---|---|---|---|---|---|
|
|
49
|
+
| JavaScript | `.js`, `.jsx`, `.mjs`, `.cjs` | Yes | Yes | Yes | Yes |
|
|
50
|
+
| TypeScript | `.ts`, `.mts`, `.cts` | Yes | Yes | Yes | Yes |
|
|
51
|
+
| TSX | `.tsx` | Yes | Yes | Yes | Yes |
|
|
52
|
+
| Python | `.py`, `.pyi` | Yes | Yes | No | Yes |
|
|
53
|
+
| Rust | `.rs` | Yes | Yes | No | Yes |
|
|
54
|
+
| Go | `.go` | Yes | Yes | No | Yes |
|
|
55
|
+
| C | `.c`, `.h` | Yes | Yes | No | Yes |
|
|
56
|
+
| C++ | `.cpp`, `.hpp`, `.cc`, `.cxx`, `.hxx`, `.c++`, `.h++` | Yes | Yes | No | Yes |
|
|
57
|
+
| Java | `.java` | Yes | Yes | No | Yes |
|
|
58
|
+
| Kotlin | `.kt`, `.kts` | Yes | No | No | Yes |
|
|
59
|
+
| Ruby | `.rb`, `.gemspec` | Yes | No | No | Yes |
|
|
60
|
+
| Bash | `.sh`, `.bash`, `.zsh`, `.ksh` | Yes | No | No | Yes |
|
|
61
|
+
| HTML | `.html`, `.htm`, `.xhtml` | Yes | No | No | No |
|
|
62
|
+
| R | `.r` | Yes | No | No | Yes |
|
|
63
|
+
| SQL | `.sql` | Yes | No | No | No |
|
|
64
|
+
| LaTeX | `.tex`, `.sty`, `.cls` | Yes | Yes | No | No |
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
For a bulk scan, use `getStructuralSearchSupportedExtensions(operation)`. It returns operation-specific extensions: 38 for `outline`, 25 for `imports`, 8 for `exports`, and 31 for `call-sites`. It does not accept `callees` or public search-kind names.
|
|
67
|
+
|
|
68
|
+
### Mapping to Code Intelligence search
|
|
69
|
+
|
|
70
|
+
[`code_find` in AST mode](../supi-code-intelligence/README.md#language-support) uses these library operations:
|
|
71
|
+
|
|
72
|
+
| `code_find` kind | Structural operation | Match source |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| `definition` | `outline` | Extracted declaration names |
|
|
75
|
+
| `type`, `interface`, `class`, `method`, `enum` | `outline` | Declaration names filtered by outline kind |
|
|
76
|
+
| `import` | `imports` | Written import/source targets, not local aliases or resolved files |
|
|
77
|
+
| `export` | `exports` | Exported names |
|
|
78
|
+
| `call` | `call-sites` | Written call names, not symbol identity |
|
|
79
|
+
|
|
80
|
+
The `type` filter accepts `class`, `interface`, `type`, `enum`, `struct`, `union`, `record`, `object`, and `concept`. The other kind filters require an exact common outline kind. Not every grammar produces every kind. Results retain `nativeKind` separately. For example, Rust traits use the common `interface` filter but retain `trait`; Go structs retain `struct`, and Java records retain `record`. These do not become `class` results.
|
|
81
|
+
|
|
82
|
+
### Extraction limits
|
|
83
|
+
|
|
84
|
+
- TS/JS, Python, Java, Go, Rust, and C/C++ outlines include nested named declarations and members. They are not complete indexes of local variables, parameters, or anonymous expressions. Other languages retain their existing extraction depth. HTML outlines list only elements with non-empty `id` attributes. SQL outlines list supported `CREATE` declarations and first-level table/type members. LaTeX outlines list section headings and selected command, environment, label, acronym, glossary-entry, and color definitions.
|
|
85
|
+
- JavaScript-family imports collect `import` statements, not CommonJS `require()` calls. Exports collect file-level `export` statements, including TypeScript `export =`; they do not collect `module.exports` assignments or nested namespace exports. An eligible `.cjs` file can therefore return no imports or exports.
|
|
86
|
+
- Python imports retain `import`/`from` module targets, including relative prefixes. Java imports retain ordinary/static targets. Go imports retain single/grouped paths. Rust imports retain explicit `use` paths, `extern crate`, and external `mod` names; inline module bodies are not imports. C/C++ imports retain literal quoted and angle-bracket include targets. Grouped paths use explicit syntax only; no files or bindings are resolved. Conditional directives are written evidence, not proof of active dependencies. Dynamic loaders, computed targets, and C++20 module imports remain outside extraction support.
|
|
87
|
+
- LaTeX imports include package, class, source, and bibliography directives. Bibliography directives can refer to `.bib` files, but the grammar does not parse those files.
|
|
88
|
+
- Call-site and callee queries use syntax, not resolved symbol identity. Distinct sites have source ranges; repeated names on one line are not merged. Rust macro invocations are syntax evidence, not expanded calls. JSX tags are not call expressions. Library callee queries work without LSP, but new `code_graph` targets require semantic readiness in Code Intelligence.
|
|
89
|
+
- `.jsx` uses JavaScript; `.tsx` uses the separate TSX grammar. `.h` uses C by default. An explicit session association can select C++ without changing the supported suffix set. `.zsh` and `.ksh` use Bash; this is not complete support for those shell dialects.
|
|
90
|
+
- Go module manifests (`.mod`), Ruby ERB templates (`.erb`), and BibTeX (`.bib`) have [built-in LSP routes](../supi-lsp/README.md#built-in-route-matrix), but no AST grammar. Unlisted extensions, including JSON, YAML, TOML, and CSS, have no grammar. Custom LSP configuration does not add one.
|
|
91
|
+
|
|
92
|
+
A recovered parse returns `partial` with usable data, a reason, and available syntax-error ranges. Callers must preserve that state instead of interpreting it as complete absence or discarding the data. `canParse()` remains a parseability check, not a claim that syntax or extraction is complete.
|
|
93
|
+
|
|
94
|
+
Sources: [extension and grammar map](src/language.ts), [operation support](src/operation-support.ts), [call-site queries](src/tool/call-sites.ts), [callee queries](src/tool/callees.ts), and [Code Intelligence kind filters](../supi-code-intelligence/src/analysis/search/pattern-analysis.ts). Regression tests cover [grammar mappings](__tests__/language.test.ts), [operation eligibility](__tests__/operation-support.test.ts), and [call-site queries](__tests__/call-site-languages.test.ts).
|
|
62
95
|
|
|
63
96
|
## Architecture
|
|
64
97
|
|
|
@@ -97,6 +130,19 @@ const callees = await session.calleesAt("src/index.ts", 42, 10);
|
|
|
97
130
|
await session.dispose();
|
|
98
131
|
```
|
|
99
132
|
|
|
133
|
+
For C-family paths, direct library callers can pass ordered rules:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
const session = createTreeSitterSession("/project", {
|
|
137
|
+
fileAssociations: [
|
|
138
|
+
{ pattern: "vendor/**/*.h", language: "c" },
|
|
139
|
+
{ pattern: "**/*.h", language: "cpp" },
|
|
140
|
+
],
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The first match wins; patterns are case-sensitive project-relative globs. Without rules, the extension map stays unchanged. Direct callers own configuration trust. The Code Intelligence workspace host reads trusted project rules and supplies the same snapshot to Tree-sitter and LSP. This library does not read SuPi configuration on its own.
|
|
145
|
+
|
|
100
146
|
## Structural performance baseline
|
|
101
147
|
|
|
102
148
|
Run the stable outline fixture on the same machine and dependency versions:
|
|
@@ -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.
|