@rsvelte/language-server 0.4.1 → 0.5.1
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 +45 -23
- package/bin/rsvelte-language-server.mjs +8 -1
- package/dist/vendor/rsvelte_lint_bg.wasm +0 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,32 +1,46 @@
|
|
|
1
1
|
# @rsvelte/language-server
|
|
2
2
|
|
|
3
3
|
A Language Server for [rsvelte](https://github.com/baseballyama/rsvelte) — the
|
|
4
|
-
Rust port of the Svelte compiler.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
toolchain.
|
|
4
|
+
Rust port of the Svelte compiler. The native server combines rsvelte's
|
|
5
|
+
formatter, linter and Svelte/HTML/CSS providers with a TypeScript 7 LSP child,
|
|
6
|
+
so editors get the complete Svelte and TypeScript language surface.
|
|
8
7
|
|
|
9
8
|
## Features (v1)
|
|
10
9
|
|
|
11
|
-
- **Formatting** — `textDocument/formatting`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
resolved from `node_modules/.bin/rsvelte-fmt` (install
|
|
16
|
-
[`@rsvelte/fmt`](https://www.npmjs.com/package/@rsvelte/fmt)); if it can't be
|
|
17
|
-
found, formatting is silently disabled.
|
|
10
|
+
- **Formatting** — `textDocument/formatting` uses `rsvelte_fmt::FormatSession`
|
|
11
|
+
in the native server process and returns a whole-document edit. It resolves
|
|
12
|
+
the project's oxfmt configuration without spawning `rsvelte-fmt` or requiring
|
|
13
|
+
a separate formatter installation.
|
|
18
14
|
- **Diagnostics** — push diagnostics from the bundled
|
|
19
15
|
[`rsvelte_lint`](https://github.com/baseballyama/rsvelte/tree/main/crates/rsvelte_lint)
|
|
20
16
|
engine (compiled to wasm, vendored in the package — no extra install). Runs on
|
|
21
17
|
open, on change (300 ms debounced), and on save. The rule set comes from the
|
|
22
18
|
project's own [`rsvelte-lint.json`](#lint-configuration).
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
The native server proxies hover, definitions, references, completion and
|
|
21
|
+
resolve, rename, signature help, inlay hints, semantic tokens, hierarchy,
|
|
22
|
+
symbols, code actions, code lenses and pull diagnostics through tsgo. Svelte
|
|
23
|
+
components use eagerly opened, diskless `.svelte.tsx` shadows; plain `.ts` and
|
|
24
|
+
`.js` documents share the same project.
|
|
25
|
+
|
|
26
|
+
In trusted workspaces, the server loads the nearest `svelte.config.*` through a
|
|
27
|
+
supervised Node sidecar and applies its preprocessors before generating the
|
|
28
|
+
TypeScript shadow. Preprocessor source maps keep diagnostics and TypeScript
|
|
29
|
+
locations in original-source coordinates. Config files are never executed in
|
|
30
|
+
an untrusted workspace.
|
|
31
|
+
|
|
32
|
+
Install TypeScript 7 in the workspace, or set `TSGO_BIN` to its executable:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm install -D typescript@~6 @typescript/native@npm:typescript@7
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If tsgo is unavailable, native formatting, linting and Svelte/HTML/CSS features
|
|
39
|
+
continue to work.
|
|
40
|
+
|
|
41
|
+
For VS Code, Emmet remains the built-in extension's responsibility. Enable its
|
|
42
|
+
HTML abbreviations in Svelte documents with
|
|
43
|
+
`"emmet.includeLanguages": { "svelte": "html" }`.
|
|
30
44
|
|
|
31
45
|
## Settings
|
|
32
46
|
|
|
@@ -34,9 +48,17 @@ The server reads these from the client's `rsvelte.*` configuration:
|
|
|
34
48
|
|
|
35
49
|
| Key | Default | Description |
|
|
36
50
|
| --- | --- | --- |
|
|
37
|
-
| `rsvelte.format.enable` | `true` | Enable
|
|
51
|
+
| `rsvelte.format.enable` | `true` | Enable in-process document formatting. |
|
|
38
52
|
| `rsvelte.lint.enable` | `true` | Enable linting via the bundled engine. |
|
|
39
|
-
| `rsvelte.
|
|
53
|
+
| `rsvelte.preprocess.enable` | `true` | Apply preprocessors from `svelte.config.*` in trusted workspaces. |
|
|
54
|
+
| `rsvelte.rsvelteFmtPath` | `""` | JavaScript fallback only: explicit path to a `rsvelte-fmt` binary. |
|
|
55
|
+
|
|
56
|
+
The native server also accepts the official extension's complete
|
|
57
|
+
`svelte.plugin.{typescript,css,html,svelte}.*` configuration tree, including
|
|
58
|
+
its feature switches, compiler-warning levels, formatter options, and default
|
|
59
|
+
script language. The legacy `rsvelte.*` master switches remain available as
|
|
60
|
+
additional gates, so an existing Svelte workspace can change extensions
|
|
61
|
+
without rewriting its settings.
|
|
40
62
|
|
|
41
63
|
## Lint configuration
|
|
42
64
|
|
|
@@ -76,10 +98,10 @@ config file is saved through the client, and on `workspace/didChangeConfiguratio
|
|
|
76
98
|
rsvelte-language-server --stdio
|
|
77
99
|
```
|
|
78
100
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
The [rsvelte VS Code extension](../vscode/README.md) bundles and launches the
|
|
102
|
+
native binary for supported platforms, with the JavaScript server as a
|
|
103
|
+
fallback. Neovim, Zed, Sublime Text, Helix, and Emacs setup is documented in
|
|
104
|
+
the [editor guide](../../../editors/README.md).
|
|
83
105
|
|
|
84
106
|
## Native server
|
|
85
107
|
|
|
@@ -61,7 +61,14 @@ if (override) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const result = spawnSync(command, args, {
|
|
64
|
+
const result = spawnSync(command, args, {
|
|
65
|
+
stdio: 'inherit',
|
|
66
|
+
windowsHide: true,
|
|
67
|
+
env: {
|
|
68
|
+
...process.env,
|
|
69
|
+
RSVELTE_PREPROCESS_NODE: process.env.RSVELTE_PREPROCESS_NODE ?? process.execPath,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
65
72
|
|
|
66
73
|
if (result.error) {
|
|
67
74
|
console.error(
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsvelte/language-server",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Native Svelte language server with formatting, linting and TypeScript 7 language features",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"dist/vendor/rsvelte_lint_bg.wasm"
|
|
33
33
|
],
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@rsvelte/language-server-darwin-arm64": "^0.
|
|
36
|
-
"@rsvelte/language-server-darwin-x64": "^0.
|
|
37
|
-
"@rsvelte/language-server-linux-arm64-gnu": "^0.
|
|
38
|
-
"@rsvelte/language-server-linux-x64-gnu": "^0.
|
|
39
|
-
"@rsvelte/language-server-win32-x64-msvc": "^0.
|
|
35
|
+
"@rsvelte/language-server-darwin-arm64": "^0.5.1",
|
|
36
|
+
"@rsvelte/language-server-darwin-x64": "^0.5.1",
|
|
37
|
+
"@rsvelte/language-server-linux-arm64-gnu": "^0.5.1",
|
|
38
|
+
"@rsvelte/language-server-linux-x64-gnu": "^0.5.1",
|
|
39
|
+
"@rsvelte/language-server-win32-x64-msvc": "^0.5.1"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"vscode-languageserver": "^10.0.0",
|