@solid-sfc/language-server 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +17 -2
- package/bin/solid-sfc-language-server.js +4 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +212 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Alexis Munsayac
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @solid-sfc/language-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> A language server for `solid-sfc` `.solid` files.
|
|
4
|
+
|
|
5
|
+
It provides type checking, hover, completion, go-to-definition and the other TypeScript features in scripts and markup, CSS features in `<style>` blocks, and markup syntax errors and warnings. It also completes `#` blocks and `<solid:` elements, and has code actions that wrap markup in `#if`, `#for`, `#loading` or `#try`, or extract it to a `#template`.
|
|
6
|
+
|
|
7
|
+
The [VS Code extension](https://github.com/lxsmnsyc/solid-sfc/tree/main/packages/vscode) includes this server. Other editors can run it over stdio:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add -g @solid-sfc/language-server
|
|
11
|
+
solid-sfc-language-server --stdio
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The server includes its own copy of TypeScript 6, because TypeScript 7 has no JavaScript API.
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
|
|
18
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LanguageServicePlugin } from "@volar/language-server";
|
|
2
|
+
//#region src/index.d.ts
|
|
3
|
+
/** Reports `.solid` syntax errors and warnings, which TypeScript does not see. */
|
|
4
|
+
export declare function createSyntaxDiagnosticsPlugin(): LanguageServicePlugin;
|
|
5
|
+
/**
|
|
6
|
+
* Folds the parts of a `.solid` file that only exist in it, such as
|
|
7
|
+
* `<script>` blocks and `#if` blocks. TypeScript and CSS fold the code
|
|
8
|
+
* inside them.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createFoldingPlugin(): LanguageServicePlugin;
|
|
11
|
+
/**
|
|
12
|
+
* Adds the parts of a `.solid` file to the outline: `<script>` blocks with
|
|
13
|
+
* their declarations, `<style>` blocks with their rules, and `#template`
|
|
14
|
+
* declarations.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createDocumentSymbolPlugin(): LanguageServicePlugin;
|
|
17
|
+
/** Inserts the closing tag after `>` ends an opening tag in the markup. */
|
|
18
|
+
export declare function createAutoCloseTagPlugin(): LanguageServicePlugin;
|
|
19
|
+
/** Completes control flow keywords and `solid:` elements in the markup. */
|
|
20
|
+
export declare function createCompletionPlugin(): LanguageServicePlugin;
|
|
21
|
+
/** Wraps markup in a block, or extracts it to a `#template`. */
|
|
22
|
+
export declare function createCodeActionPlugin(): LanguageServicePlugin;
|
|
23
|
+
/**
|
|
24
|
+
* Starts the language server over the connection the client opened.
|
|
25
|
+
* TypeScript 7 has no JavaScript API, so the server uses its own copy of the
|
|
26
|
+
* TypeScript 6 compiler.
|
|
27
|
+
*/
|
|
28
|
+
export declare function startServer(): void;
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { createSolidLanguagePlugin, getClosingTag, getCodeActions, getCompletions, getDocumentSymbols, getFoldingRanges } from "@solid-sfc/language-core";
|
|
2
|
+
import { CompletionItemKind, DiagnosticSeverity, FoldingRangeKind, InsertTextFormat, SymbolKind, createConnection, createServer, createTypeScriptProject } from "@volar/language-server/node.js";
|
|
3
|
+
import { SFCError, compileStructure } from "solid-sfc";
|
|
4
|
+
import typescript from "typescript-api";
|
|
5
|
+
import { create } from "volar-service-css";
|
|
6
|
+
import { create as create$1 } from "volar-service-typescript";
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
/** Reports `.solid` syntax errors and warnings, which TypeScript does not see. */
|
|
9
|
+
function createSyntaxDiagnosticsPlugin() {
|
|
10
|
+
return {
|
|
11
|
+
name: "solid-sfc-syntax",
|
|
12
|
+
capabilities: { diagnosticProvider: {
|
|
13
|
+
interFileDependencies: false,
|
|
14
|
+
workspaceDiagnostics: false
|
|
15
|
+
} },
|
|
16
|
+
create() {
|
|
17
|
+
return { provideDiagnostics(document) {
|
|
18
|
+
if (document.languageId !== "solid") return [];
|
|
19
|
+
try {
|
|
20
|
+
const { warnings } = compileStructure(document.getText(), {
|
|
21
|
+
filename: document.uri,
|
|
22
|
+
typeCheck: true
|
|
23
|
+
});
|
|
24
|
+
return warnings.map((warning) => ({
|
|
25
|
+
range: {
|
|
26
|
+
start: document.positionAt(warning.offset),
|
|
27
|
+
end: document.positionAt(warning.offset + warning.length)
|
|
28
|
+
},
|
|
29
|
+
message: warning.message,
|
|
30
|
+
code: warning.code,
|
|
31
|
+
severity: DiagnosticSeverity.Warning,
|
|
32
|
+
source: "solid-sfc"
|
|
33
|
+
}));
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (!(error instanceof SFCError)) throw error;
|
|
36
|
+
const position = document.positionAt(error.offset);
|
|
37
|
+
return [{
|
|
38
|
+
range: {
|
|
39
|
+
start: position,
|
|
40
|
+
end: position
|
|
41
|
+
},
|
|
42
|
+
message: error.message.replace(/ \([^()]*:\d+:\d+\)$/, ""),
|
|
43
|
+
severity: DiagnosticSeverity.Error,
|
|
44
|
+
source: "solid-sfc"
|
|
45
|
+
}];
|
|
46
|
+
}
|
|
47
|
+
} };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Folds the parts of a `.solid` file that only exist in it, such as
|
|
53
|
+
* `<script>` blocks and `#if` blocks. TypeScript and CSS fold the code
|
|
54
|
+
* inside them.
|
|
55
|
+
*/
|
|
56
|
+
function createFoldingPlugin() {
|
|
57
|
+
return {
|
|
58
|
+
name: "solid-sfc-folding",
|
|
59
|
+
capabilities: { foldingRangeProvider: true },
|
|
60
|
+
create() {
|
|
61
|
+
return { provideFoldingRanges(document) {
|
|
62
|
+
if (document.languageId !== "solid") return [];
|
|
63
|
+
const ranges = [];
|
|
64
|
+
for (const range of getFoldingRanges(document.getText())) {
|
|
65
|
+
const startLine = document.positionAt(range.start).line;
|
|
66
|
+
const endLine = document.positionAt(range.end).line;
|
|
67
|
+
if (endLine > startLine) ranges.push({
|
|
68
|
+
startLine,
|
|
69
|
+
endLine,
|
|
70
|
+
kind: range.kind === "comment" ? FoldingRangeKind.Comment : void 0
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return ranges;
|
|
74
|
+
} };
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const SYMBOL_KINDS = {
|
|
79
|
+
module: SymbolKind.Module,
|
|
80
|
+
function: SymbolKind.Function,
|
|
81
|
+
variable: SymbolKind.Variable,
|
|
82
|
+
constant: SymbolKind.Constant,
|
|
83
|
+
class: SymbolKind.Class,
|
|
84
|
+
interface: SymbolKind.Interface,
|
|
85
|
+
enum: SymbolKind.Enum
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Adds the parts of a `.solid` file to the outline: `<script>` blocks with
|
|
89
|
+
* their declarations, `<style>` blocks with their rules, and `#template`
|
|
90
|
+
* declarations.
|
|
91
|
+
*/
|
|
92
|
+
function createDocumentSymbolPlugin() {
|
|
93
|
+
return {
|
|
94
|
+
name: "solid-sfc-symbols",
|
|
95
|
+
capabilities: { documentSymbolProvider: true },
|
|
96
|
+
create() {
|
|
97
|
+
return { provideDocumentSymbols(document) {
|
|
98
|
+
if (document.languageId !== "solid") return [];
|
|
99
|
+
const convert = (symbol) => ({
|
|
100
|
+
name: symbol.name,
|
|
101
|
+
kind: SYMBOL_KINDS[symbol.kind],
|
|
102
|
+
range: {
|
|
103
|
+
start: document.positionAt(symbol.start),
|
|
104
|
+
end: document.positionAt(symbol.end)
|
|
105
|
+
},
|
|
106
|
+
selectionRange: {
|
|
107
|
+
start: document.positionAt(symbol.selectionStart),
|
|
108
|
+
end: document.positionAt(symbol.selectionEnd)
|
|
109
|
+
},
|
|
110
|
+
children: symbol.children.map(convert)
|
|
111
|
+
});
|
|
112
|
+
return getDocumentSymbols(document.getText()).map(convert);
|
|
113
|
+
} };
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/** Inserts the closing tag after `>` ends an opening tag in the markup. */
|
|
118
|
+
function createAutoCloseTagPlugin() {
|
|
119
|
+
return {
|
|
120
|
+
name: "solid-sfc-auto-close",
|
|
121
|
+
capabilities: { autoInsertionProvider: {
|
|
122
|
+
triggerCharacters: [">"],
|
|
123
|
+
configurationSections: ["solid.autoClosingTags"]
|
|
124
|
+
} },
|
|
125
|
+
create(context) {
|
|
126
|
+
return { async provideAutoInsertSnippet(document, selection, change) {
|
|
127
|
+
if (document.languageId !== "solid" || !change.text.endsWith(">") || await context.env.getConfiguration?.("solid.autoClosingTags") === false) return;
|
|
128
|
+
const tag = getClosingTag(document.getText(), document.offsetAt(selection));
|
|
129
|
+
return tag && `$0${tag}`;
|
|
130
|
+
} };
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** Completes control flow keywords and `solid:` elements in the markup. */
|
|
135
|
+
function createCompletionPlugin() {
|
|
136
|
+
return {
|
|
137
|
+
name: "solid-sfc-completion",
|
|
138
|
+
capabilities: { completionProvider: { triggerCharacters: ["#", ":"] } },
|
|
139
|
+
create() {
|
|
140
|
+
return { provideCompletionItems(document, position) {
|
|
141
|
+
if (document.languageId !== "solid") return;
|
|
142
|
+
const offset = document.offsetAt(position);
|
|
143
|
+
return {
|
|
144
|
+
isIncomplete: false,
|
|
145
|
+
items: getCompletions(document.getText(), offset).map((item) => ({
|
|
146
|
+
label: item.label,
|
|
147
|
+
detail: item.detail,
|
|
148
|
+
kind: CompletionItemKind.Keyword,
|
|
149
|
+
insertTextFormat: InsertTextFormat.Snippet,
|
|
150
|
+
textEdit: {
|
|
151
|
+
range: {
|
|
152
|
+
start: document.positionAt(item.start),
|
|
153
|
+
end: position
|
|
154
|
+
},
|
|
155
|
+
newText: item.snippet
|
|
156
|
+
}
|
|
157
|
+
}))
|
|
158
|
+
};
|
|
159
|
+
} };
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** Wraps markup in a block, or extracts it to a `#template`. */
|
|
164
|
+
function createCodeActionPlugin() {
|
|
165
|
+
return {
|
|
166
|
+
name: "solid-sfc-code-actions",
|
|
167
|
+
capabilities: { codeActionProvider: { codeActionKinds: ["refactor.rewrite", "refactor.extract"] } },
|
|
168
|
+
create() {
|
|
169
|
+
return { provideCodeActions(document, range) {
|
|
170
|
+
if (document.languageId !== "solid") return;
|
|
171
|
+
return getCodeActions(document.getText(), document.offsetAt(range.start), document.offsetAt(range.end)).map((action) => ({
|
|
172
|
+
title: action.title,
|
|
173
|
+
kind: action.kind,
|
|
174
|
+
edit: { changes: { [document.uri]: action.edits.map((edit) => ({
|
|
175
|
+
range: {
|
|
176
|
+
start: document.positionAt(edit.start),
|
|
177
|
+
end: document.positionAt(edit.end)
|
|
178
|
+
},
|
|
179
|
+
newText: edit.text
|
|
180
|
+
})) } }
|
|
181
|
+
}));
|
|
182
|
+
} };
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Starts the language server over the connection the client opened.
|
|
188
|
+
* TypeScript 7 has no JavaScript API, so the server uses its own copy of the
|
|
189
|
+
* TypeScript 6 compiler.
|
|
190
|
+
*/
|
|
191
|
+
function startServer() {
|
|
192
|
+
const ts = typescript;
|
|
193
|
+
const connection = createConnection();
|
|
194
|
+
const server = createServer(connection);
|
|
195
|
+
connection.listen();
|
|
196
|
+
connection.onInitialize((params) => server.initialize(params, createTypeScriptProject(ts, void 0, () => ({ languagePlugins: [createSolidLanguagePlugin({}, (uri) => uri.fsPath.replaceAll("\\", "/"))] })), [
|
|
197
|
+
...create$1(ts),
|
|
198
|
+
create(),
|
|
199
|
+
createSyntaxDiagnosticsPlugin(),
|
|
200
|
+
createFoldingPlugin(),
|
|
201
|
+
createDocumentSymbolPlugin(),
|
|
202
|
+
createAutoCloseTagPlugin(),
|
|
203
|
+
createCompletionPlugin(),
|
|
204
|
+
createCodeActionPlugin()
|
|
205
|
+
]));
|
|
206
|
+
connection.onInitialized(server.initialized);
|
|
207
|
+
connection.onShutdown(server.shutdown);
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
export { createAutoCloseTagPlugin, createCodeActionPlugin, createCompletionPlugin, createDocumentSymbolPlugin, createFoldingPlugin, createSyntaxDiagnosticsPlugin, startServer };
|
|
211
|
+
|
|
212
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["createTypeScriptServices","createCssServices"],"sources":["../src/index.ts"],"sourcesContent":["import {\n createSolidLanguagePlugin,\n getClosingTag,\n getCodeActions,\n getCompletions,\n getDocumentSymbols,\n getFoldingRanges,\n} from '@solid-sfc/language-core';\nimport type { DocumentSymbol as SolidSymbol } from '@solid-sfc/language-core';\nimport type {\n CodeAction,\n CompletionItem,\n Diagnostic,\n DocumentSymbol,\n FoldingRange,\n LanguageServicePlugin,\n} from '@volar/language-server';\nimport {\n CompletionItemKind,\n DiagnosticSeverity,\n InsertTextFormat,\n FoldingRangeKind,\n SymbolKind,\n createConnection,\n createServer,\n createTypeScriptProject,\n} from '@volar/language-server/node.js';\nimport { SFCError, compileStructure } from 'solid-sfc';\nimport typescript from 'typescript-api';\nimport { create as createCssServices } from 'volar-service-css';\nimport { create as createTypeScriptServices } from 'volar-service-typescript';\nimport type { URI } from 'vscode-uri';\n\n/** Reports `.solid` syntax errors and warnings, which TypeScript does not see. */\nexport function createSyntaxDiagnosticsPlugin(): LanguageServicePlugin {\n return {\n name: 'solid-sfc-syntax',\n capabilities: {\n diagnosticProvider: {\n interFileDependencies: false,\n workspaceDiagnostics: false,\n },\n },\n create() {\n return {\n provideDiagnostics(document) {\n if (document.languageId !== 'solid') {\n return [];\n }\n try {\n // Like the editor's TSX, so warnings that only apply without a bundler, such as\n // on SCSS stylesheets, are left out.\n const { warnings } = compileStructure(document.getText(), {\n filename: document.uri,\n typeCheck: true,\n });\n return warnings.map((warning): Diagnostic => ({\n range: {\n start: document.positionAt(warning.offset),\n end: document.positionAt(warning.offset + warning.length),\n },\n message: warning.message,\n code: warning.code,\n severity: DiagnosticSeverity.Warning,\n source: 'solid-sfc',\n }));\n } catch (error) {\n if (!(error instanceof SFCError)) {\n throw error;\n }\n const position = document.positionAt(error.offset);\n const diagnostic: Diagnostic = {\n range: { start: position, end: position },\n message: error.message.replace(/ \\([^()]*:\\d+:\\d+\\)$/, ''),\n severity: DiagnosticSeverity.Error,\n source: 'solid-sfc',\n };\n return [diagnostic];\n }\n },\n };\n },\n };\n}\n\n/**\n * Folds the parts of a `.solid` file that only exist in it, such as\n * `<script>` blocks and `#if` blocks. TypeScript and CSS fold the code\n * inside them.\n */\nexport function createFoldingPlugin(): LanguageServicePlugin {\n return {\n name: 'solid-sfc-folding',\n capabilities: {\n foldingRangeProvider: true,\n },\n create() {\n return {\n provideFoldingRanges(document) {\n if (document.languageId !== 'solid') {\n return [];\n }\n const ranges: FoldingRange[] = [];\n for (const range of getFoldingRanges(document.getText())) {\n const startLine = document.positionAt(range.start).line;\n const endLine = document.positionAt(range.end).line;\n if (endLine > startLine) {\n ranges.push({\n startLine,\n endLine,\n kind: range.kind === 'comment' ? FoldingRangeKind.Comment : undefined,\n });\n }\n }\n return ranges;\n },\n };\n },\n };\n}\n\nconst SYMBOL_KINDS: Record<SolidSymbol['kind'], SymbolKind> = {\n module: SymbolKind.Module,\n function: SymbolKind.Function,\n variable: SymbolKind.Variable,\n constant: SymbolKind.Constant,\n class: SymbolKind.Class,\n interface: SymbolKind.Interface,\n enum: SymbolKind.Enum,\n};\n\n/**\n * Adds the parts of a `.solid` file to the outline: `<script>` blocks with\n * their declarations, `<style>` blocks with their rules, and `#template`\n * declarations.\n */\nexport function createDocumentSymbolPlugin(): LanguageServicePlugin {\n return {\n name: 'solid-sfc-symbols',\n capabilities: {\n documentSymbolProvider: true,\n },\n create() {\n return {\n provideDocumentSymbols(document) {\n if (document.languageId !== 'solid') {\n return [];\n }\n const convert = (symbol: SolidSymbol): DocumentSymbol => ({\n name: symbol.name,\n kind: SYMBOL_KINDS[symbol.kind],\n range: {\n start: document.positionAt(symbol.start),\n end: document.positionAt(symbol.end),\n },\n selectionRange: {\n start: document.positionAt(symbol.selectionStart),\n end: document.positionAt(symbol.selectionEnd),\n },\n children: symbol.children.map(convert),\n });\n return getDocumentSymbols(document.getText()).map(convert);\n },\n };\n },\n };\n}\n\n/** Inserts the closing tag after `>` ends an opening tag in the markup. */\nexport function createAutoCloseTagPlugin(): LanguageServicePlugin {\n return {\n name: 'solid-sfc-auto-close',\n capabilities: {\n autoInsertionProvider: {\n triggerCharacters: ['>'],\n configurationSections: ['solid.autoClosingTags'],\n },\n },\n create(context) {\n return {\n async provideAutoInsertSnippet(document, selection, change) {\n if (\n document.languageId !== 'solid' ||\n !change.text.endsWith('>') ||\n (await context.env.getConfiguration?.<boolean>('solid.autoClosingTags')) === false\n ) {\n return undefined;\n }\n const tag = getClosingTag(document.getText(), document.offsetAt(selection));\n return tag && `$0${tag}`;\n },\n };\n },\n };\n}\n\n/** Completes control flow keywords and `solid:` elements in the markup. */\nexport function createCompletionPlugin(): LanguageServicePlugin {\n return {\n name: 'solid-sfc-completion',\n capabilities: {\n completionProvider: { triggerCharacters: ['#', ':'] },\n },\n create() {\n return {\n provideCompletionItems(document, position) {\n if (document.languageId !== 'solid') {\n return undefined;\n }\n const offset = document.offsetAt(position);\n const items = getCompletions(document.getText(), offset).map((item): CompletionItem => ({\n label: item.label,\n detail: item.detail,\n kind: CompletionItemKind.Keyword,\n insertTextFormat: InsertTextFormat.Snippet,\n textEdit: {\n range: { start: document.positionAt(item.start), end: position },\n newText: item.snippet,\n },\n }));\n return { isIncomplete: false, items };\n },\n };\n },\n };\n}\n\n/** Wraps markup in a block, or extracts it to a `#template`. */\nexport function createCodeActionPlugin(): LanguageServicePlugin {\n return {\n name: 'solid-sfc-code-actions',\n capabilities: {\n codeActionProvider: { codeActionKinds: ['refactor.rewrite', 'refactor.extract'] },\n },\n create() {\n return {\n provideCodeActions(document, range) {\n if (document.languageId !== 'solid') {\n return undefined;\n }\n const actions = getCodeActions(\n document.getText(),\n document.offsetAt(range.start),\n document.offsetAt(range.end),\n );\n return actions.map((action): CodeAction => ({\n title: action.title,\n kind: action.kind,\n edit: {\n changes: {\n [document.uri]: action.edits.map((edit) => ({\n range: {\n start: document.positionAt(edit.start),\n end: document.positionAt(edit.end),\n },\n newText: edit.text,\n })),\n },\n },\n }));\n },\n };\n },\n };\n}\n\n/**\n * Starts the language server over the connection the client opened.\n * TypeScript 7 has no JavaScript API, so the server uses its own copy of the\n * TypeScript 6 compiler.\n */\nexport function startServer(): void {\n // Volar's types name the `typescript` package, which is TypeScript 7 in\n // this workspace. The TypeScript 6 API is what Volar expects at runtime.\n const ts = typescript as never;\n const connection = createConnection();\n const server = createServer(connection);\n\n connection.listen();\n\n connection.onInitialize((params) =>\n server.initialize(\n params,\n createTypeScriptProject(ts, undefined, () => ({\n languagePlugins: [\n createSolidLanguagePlugin<URI>({}, (uri) => uri.fsPath.replaceAll('\\\\', '/')),\n ],\n })),\n [\n ...createTypeScriptServices(ts),\n createCssServices(),\n createSyntaxDiagnosticsPlugin(),\n createFoldingPlugin(),\n createDocumentSymbolPlugin(),\n createAutoCloseTagPlugin(),\n createCompletionPlugin(),\n createCodeActionPlugin(),\n ],\n ),\n );\n connection.onInitialized(server.initialized);\n connection.onShutdown(server.shutdown);\n}\n"],"mappings":";;;;;;;;AAkCA,SAAgB,gCAAuD;CACrE,OAAO;EACL,MAAM;EACN,cAAc,EACZ,oBAAoB;GAClB,uBAAuB;GACvB,sBAAsB;EACxB,EACF;EACA,SAAS;GACP,OAAO,EACL,mBAAmB,UAAU;IAC3B,IAAI,SAAS,eAAe,SAC1B,OAAO,CAAC;IAEV,IAAI;KAGF,MAAM,EAAE,aAAa,iBAAiB,SAAS,QAAQ,GAAG;MACxD,UAAU,SAAS;MACnB,WAAW;KACb,CAAC;KACD,OAAO,SAAS,KAAK,aAAyB;MAC5C,OAAO;OACL,OAAO,SAAS,WAAW,QAAQ,MAAM;OACzC,KAAK,SAAS,WAAW,QAAQ,SAAS,QAAQ,MAAM;MAC1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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solid-sfc/language-server",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Language server for solid-sfc",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"language-server",
|
|
7
|
+
"sfc",
|
|
8
|
+
"solid-js",
|
|
9
|
+
"volar"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/lxsmnsyc/solid-sfc/tree/main/packages/language-server",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/lxsmnsyc/solid-sfc/issues"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Alexis Munsayac",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/lxsmnsyc/solid-sfc.git",
|
|
20
|
+
"directory": "packages/language-server"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"solid-sfc-language-server": "./bin/solid-sfc-language-server.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"bin",
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@solid-sfc/language-core": "0.0.0",
|
|
42
|
+
"@volar/language-server": "2.4.28",
|
|
43
|
+
"@volar/language-service": "2.4.28",
|
|
44
|
+
"solid-sfc": "0.2.0",
|
|
45
|
+
"typescript-api": "npm:typescript@6.0.3",
|
|
46
|
+
"volar-service-css": "0.0.71",
|
|
47
|
+
"volar-service-typescript": "0.0.71",
|
|
48
|
+
"vscode-uri": "^3.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^24.0.0",
|
|
52
|
+
"tsdown": "^0.23.1",
|
|
53
|
+
"typescript": "^7.0.2"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=22"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsdown",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
61
|
+
}
|
|
6
62
|
}
|