@macroforge/svelte-language-server 0.1.3
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 +331 -0
- package/bin/server.js +5 -0
- package/dist/src/importPackage.d.ts +16 -0
- package/dist/src/importPackage.js +76 -0
- package/dist/src/importPackage.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +23 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/DiagnosticsManager.d.ts +20 -0
- package/dist/src/lib/DiagnosticsManager.js +71 -0
- package/dist/src/lib/DiagnosticsManager.js.map +1 -0
- package/dist/src/lib/FallbackWatcher.d.ts +15 -0
- package/dist/src/lib/FallbackWatcher.js +66 -0
- package/dist/src/lib/FallbackWatcher.js.map +1 -0
- package/dist/src/lib/documentHighlight/wordHighlight.d.ts +3 -0
- package/dist/src/lib/documentHighlight/wordHighlight.js +62 -0
- package/dist/src/lib/documentHighlight/wordHighlight.js.map +1 -0
- package/dist/src/lib/documents/Document.d.ts +63 -0
- package/dist/src/lib/documents/Document.js +138 -0
- package/dist/src/lib/documents/Document.js.map +1 -0
- package/dist/src/lib/documents/DocumentBase.d.ts +65 -0
- package/dist/src/lib/documents/DocumentBase.js +69 -0
- package/dist/src/lib/documents/DocumentBase.js.map +1 -0
- package/dist/src/lib/documents/DocumentManager.d.ts +28 -0
- package/dist/src/lib/documents/DocumentManager.js +122 -0
- package/dist/src/lib/documents/DocumentManager.js.map +1 -0
- package/dist/src/lib/documents/DocumentMapper.d.ts +88 -0
- package/dist/src/lib/documents/DocumentMapper.js +258 -0
- package/dist/src/lib/documents/DocumentMapper.js.map +1 -0
- package/dist/src/lib/documents/configLoader.d.ts +80 -0
- package/dist/src/lib/documents/configLoader.js +265 -0
- package/dist/src/lib/documents/configLoader.js.map +1 -0
- package/dist/src/lib/documents/fileCollection.d.ts +41 -0
- package/dist/src/lib/documents/fileCollection.js +87 -0
- package/dist/src/lib/documents/fileCollection.js.map +1 -0
- package/dist/src/lib/documents/index.d.ts +5 -0
- package/dist/src/lib/documents/index.js +22 -0
- package/dist/src/lib/documents/index.js.map +1 -0
- package/dist/src/lib/documents/parseHtml.d.ts +13 -0
- package/dist/src/lib/documents/parseHtml.js +160 -0
- package/dist/src/lib/documents/parseHtml.js.map +1 -0
- package/dist/src/lib/documents/utils.d.ts +105 -0
- package/dist/src/lib/documents/utils.js +410 -0
- package/dist/src/lib/documents/utils.js.map +1 -0
- package/dist/src/lib/foldingRange/indentFolding.d.ts +26 -0
- package/dist/src/lib/foldingRange/indentFolding.js +142 -0
- package/dist/src/lib/foldingRange/indentFolding.js.map +1 -0
- package/dist/src/lib/semanticToken/semanticTokenLegend.d.ts +33 -0
- package/dist/src/lib/semanticToken/semanticTokenLegend.js +37 -0
- package/dist/src/lib/semanticToken/semanticTokenLegend.js.map +1 -0
- package/dist/src/logger.d.ts +9 -0
- package/dist/src/logger.js +28 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/ls-config.d.ts +326 -0
- package/dist/src/ls-config.js +386 -0
- package/dist/src/ls-config.js.map +1 -0
- package/dist/src/plugins/PluginHost.d.ts +68 -0
- package/dist/src/plugins/PluginHost.js +447 -0
- package/dist/src/plugins/PluginHost.js.map +1 -0
- package/dist/src/plugins/css/CSSDocument.d.ts +46 -0
- package/dist/src/plugins/css/CSSDocument.js +78 -0
- package/dist/src/plugins/css/CSSDocument.js.map +1 -0
- package/dist/src/plugins/css/CSSPlugin.d.ts +35 -0
- package/dist/src/plugins/css/CSSPlugin.js +407 -0
- package/dist/src/plugins/css/CSSPlugin.js.map +1 -0
- package/dist/src/plugins/css/FileSystemProvider.d.ts +10 -0
- package/dist/src/plugins/css/FileSystemProvider.js +75 -0
- package/dist/src/plugins/css/FileSystemProvider.js.map +1 -0
- package/dist/src/plugins/css/StyleAttributeDocument.d.ts +41 -0
- package/dist/src/plugins/css/StyleAttributeDocument.js +65 -0
- package/dist/src/plugins/css/StyleAttributeDocument.js.map +1 -0
- package/dist/src/plugins/css/features/getIdClassCompletion.d.ts +19 -0
- package/dist/src/plugins/css/features/getIdClassCompletion.js +56 -0
- package/dist/src/plugins/css/features/getIdClassCompletion.js.map +1 -0
- package/dist/src/plugins/css/features/svelte-selectors.d.ts +2 -0
- package/dist/src/plugins/css/features/svelte-selectors.js +18 -0
- package/dist/src/plugins/css/features/svelte-selectors.js.map +1 -0
- package/dist/src/plugins/css/global-vars.d.ts +16 -0
- package/dist/src/plugins/css/global-vars.js +82 -0
- package/dist/src/plugins/css/global-vars.js.map +1 -0
- package/dist/src/plugins/css/service.d.ts +5 -0
- package/dist/src/plugins/css/service.js +66 -0
- package/dist/src/plugins/css/service.js.map +1 -0
- package/dist/src/plugins/documentContext.d.ts +3 -0
- package/dist/src/plugins/documentContext.js +36 -0
- package/dist/src/plugins/documentContext.js.map +1 -0
- package/dist/src/plugins/html/HTMLPlugin.d.ts +36 -0
- package/dist/src/plugins/html/HTMLPlugin.js +363 -0
- package/dist/src/plugins/html/HTMLPlugin.js.map +1 -0
- package/dist/src/plugins/html/dataProvider.d.ts +1 -0
- package/dist/src/plugins/html/dataProvider.js +481 -0
- package/dist/src/plugins/html/dataProvider.js.map +1 -0
- package/dist/src/plugins/index.d.ts +7 -0
- package/dist/src/plugins/index.js +24 -0
- package/dist/src/plugins/index.js.map +1 -0
- package/dist/src/plugins/interfaces.d.ts +132 -0
- package/dist/src/plugins/interfaces.js +3 -0
- package/dist/src/plugins/interfaces.js.map +1 -0
- package/dist/src/plugins/svelte/SvelteDocument.d.ts +98 -0
- package/dist/src/plugins/svelte/SvelteDocument.js +318 -0
- package/dist/src/plugins/svelte/SvelteDocument.js.map +1 -0
- package/dist/src/plugins/svelte/SveltePlugin.d.ts +24 -0
- package/dist/src/plugins/svelte/SveltePlugin.js +306 -0
- package/dist/src/plugins/svelte/SveltePlugin.js.map +1 -0
- package/dist/src/plugins/svelte/features/SvelteTags.d.ts +28 -0
- package/dist/src/plugins/svelte/features/SvelteTags.js +136 -0
- package/dist/src/plugins/svelte/features/SvelteTags.js.map +1 -0
- package/dist/src/plugins/svelte/features/getCodeActions/getQuickfixes.d.ts +11 -0
- package/dist/src/plugins/svelte/features/getCodeActions/getQuickfixes.js +140 -0
- package/dist/src/plugins/svelte/features/getCodeActions/getQuickfixes.js.map +1 -0
- package/dist/src/plugins/svelte/features/getCodeActions/getRefactorings.d.ts +9 -0
- package/dist/src/plugins/svelte/features/getCodeActions/getRefactorings.js +140 -0
- package/dist/src/plugins/svelte/features/getCodeActions/getRefactorings.js.map +1 -0
- package/dist/src/plugins/svelte/features/getCodeActions/index.d.ts +4 -0
- package/dist/src/plugins/svelte/features/getCodeActions/index.js +19 -0
- package/dist/src/plugins/svelte/features/getCodeActions/index.js.map +1 -0
- package/dist/src/plugins/svelte/features/getCompletions.d.ts +4 -0
- package/dist/src/plugins/svelte/features/getCompletions.js +184 -0
- package/dist/src/plugins/svelte/features/getCompletions.js.map +1 -0
- package/dist/src/plugins/svelte/features/getDiagnostics.d.ts +9 -0
- package/dist/src/plugins/svelte/features/getDiagnostics.js +284 -0
- package/dist/src/plugins/svelte/features/getDiagnostics.js.map +1 -0
- package/dist/src/plugins/svelte/features/getHoverInfo.d.ts +7 -0
- package/dist/src/plugins/svelte/features/getHoverInfo.js +93 -0
- package/dist/src/plugins/svelte/features/getHoverInfo.js.map +1 -0
- package/dist/src/plugins/svelte/features/getModifierData.d.ts +7 -0
- package/dist/src/plugins/svelte/features/getModifierData.js +56 -0
- package/dist/src/plugins/svelte/features/getModifierData.js.map +1 -0
- package/dist/src/plugins/svelte/features/getSelectionRanges.d.ts +3 -0
- package/dist/src/plugins/svelte/features/getSelectionRanges.js +46 -0
- package/dist/src/plugins/svelte/features/getSelectionRanges.js.map +1 -0
- package/dist/src/plugins/svelte/features/utils.d.ts +5 -0
- package/dist/src/plugins/svelte/features/utils.js +18 -0
- package/dist/src/plugins/svelte/features/utils.js.map +1 -0
- package/dist/src/plugins/typescript/ComponentInfoProvider.d.ts +27 -0
- package/dist/src/plugins/typescript/ComponentInfoProvider.js +116 -0
- package/dist/src/plugins/typescript/ComponentInfoProvider.js.map +1 -0
- package/dist/src/plugins/typescript/DocumentMapper.d.ts +10 -0
- package/dist/src/plugins/typescript/DocumentMapper.js +25 -0
- package/dist/src/plugins/typescript/DocumentMapper.js.map +1 -0
- package/dist/src/plugins/typescript/DocumentSnapshot.d.ts +173 -0
- package/dist/src/plugins/typescript/DocumentSnapshot.js +623 -0
- package/dist/src/plugins/typescript/DocumentSnapshot.js.map +1 -0
- package/dist/src/plugins/typescript/LSAndTSDocResolver.d.ts +100 -0
- package/dist/src/plugins/typescript/LSAndTSDocResolver.js +301 -0
- package/dist/src/plugins/typescript/LSAndTSDocResolver.js.map +1 -0
- package/dist/src/plugins/typescript/SnapshotManager.d.ts +59 -0
- package/dist/src/plugins/typescript/SnapshotManager.js +238 -0
- package/dist/src/plugins/typescript/SnapshotManager.js.map +1 -0
- package/dist/src/plugins/typescript/TypeScriptPlugin.d.ts +65 -0
- package/dist/src/plugins/typescript/TypeScriptPlugin.js +332 -0
- package/dist/src/plugins/typescript/TypeScriptPlugin.js.map +1 -0
- package/dist/src/plugins/typescript/features/CallHierarchyProvider.d.ts +24 -0
- package/dist/src/plugins/typescript/features/CallHierarchyProvider.js +325 -0
- package/dist/src/plugins/typescript/features/CallHierarchyProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/CodeActionsProvider.d.ts +72 -0
- package/dist/src/plugins/typescript/features/CodeActionsProvider.js +1030 -0
- package/dist/src/plugins/typescript/features/CodeActionsProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/CodeLensProvider.d.ts +28 -0
- package/dist/src/plugins/typescript/features/CodeLensProvider.js +205 -0
- package/dist/src/plugins/typescript/features/CodeLensProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/CompletionProvider.d.ts +57 -0
- package/dist/src/plugins/typescript/features/CompletionProvider.js +791 -0
- package/dist/src/plugins/typescript/features/CompletionProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/DiagnosticsProvider.d.ts +36 -0
- package/dist/src/plugins/typescript/features/DiagnosticsProvider.js +497 -0
- package/dist/src/plugins/typescript/features/DiagnosticsProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/DocumentHighlightProvider.d.ts +17 -0
- package/dist/src/plugins/typescript/features/DocumentHighlightProvider.js +211 -0
- package/dist/src/plugins/typescript/features/DocumentHighlightProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/FindComponentReferencesProvider.d.ts +9 -0
- package/dist/src/plugins/typescript/features/FindComponentReferencesProvider.js +66 -0
- package/dist/src/plugins/typescript/features/FindComponentReferencesProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/FindFileReferencesProvider.d.ts +9 -0
- package/dist/src/plugins/typescript/features/FindFileReferencesProvider.js +38 -0
- package/dist/src/plugins/typescript/features/FindFileReferencesProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/FindReferencesProvider.d.ts +20 -0
- package/dist/src/plugins/typescript/features/FindReferencesProvider.js +149 -0
- package/dist/src/plugins/typescript/features/FindReferencesProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/FoldingRangeProvider.d.ts +28 -0
- package/dist/src/plugins/typescript/features/FoldingRangeProvider.js +247 -0
- package/dist/src/plugins/typescript/features/FoldingRangeProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/HoverProvider.d.ts +11 -0
- package/dist/src/plugins/typescript/features/HoverProvider.js +75 -0
- package/dist/src/plugins/typescript/features/HoverProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/ImplementationProvider.d.ts +9 -0
- package/dist/src/plugins/typescript/features/ImplementationProvider.js +47 -0
- package/dist/src/plugins/typescript/features/ImplementationProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/InlayHintProvider.d.ts +22 -0
- package/dist/src/plugins/typescript/features/InlayHintProvider.js +225 -0
- package/dist/src/plugins/typescript/features/InlayHintProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/RenameProvider.d.ts +53 -0
- package/dist/src/plugins/typescript/features/RenameProvider.js +423 -0
- package/dist/src/plugins/typescript/features/RenameProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/SelectionRangeProvider.d.ts +18 -0
- package/dist/src/plugins/typescript/features/SelectionRangeProvider.js +62 -0
- package/dist/src/plugins/typescript/features/SelectionRangeProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/SemanticTokensProvider.d.ts +15 -0
- package/dist/src/plugins/typescript/features/SemanticTokensProvider.js +116 -0
- package/dist/src/plugins/typescript/features/SemanticTokensProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/SignatureHelpProvider.d.ts +22 -0
- package/dist/src/plugins/typescript/features/SignatureHelpProvider.js +110 -0
- package/dist/src/plugins/typescript/features/SignatureHelpProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/TypeDefinitionProvider.d.ts +9 -0
- package/dist/src/plugins/typescript/features/TypeDefinitionProvider.js +35 -0
- package/dist/src/plugins/typescript/features/TypeDefinitionProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/UpdateImportsProvider.d.ts +11 -0
- package/dist/src/plugins/typescript/features/UpdateImportsProvider.js +109 -0
- package/dist/src/plugins/typescript/features/UpdateImportsProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/WorkspaceSymbolProvider.d.ts +25 -0
- package/dist/src/plugins/typescript/features/WorkspaceSymbolProvider.js +176 -0
- package/dist/src/plugins/typescript/features/WorkspaceSymbolProvider.js.map +1 -0
- package/dist/src/plugins/typescript/features/getDirectiveCommentCompletions.d.ts +13 -0
- package/dist/src/plugins/typescript/features/getDirectiveCommentCompletions.js +58 -0
- package/dist/src/plugins/typescript/features/getDirectiveCommentCompletions.js.map +1 -0
- package/dist/src/plugins/typescript/features/getJsDocTemplateCompletion.d.ts +4 -0
- package/dist/src/plugins/typescript/features/getJsDocTemplateCompletion.js +57 -0
- package/dist/src/plugins/typescript/features/getJsDocTemplateCompletion.js.map +1 -0
- package/dist/src/plugins/typescript/features/utils.d.ts +81 -0
- package/dist/src/plugins/typescript/features/utils.js +331 -0
- package/dist/src/plugins/typescript/features/utils.js.map +1 -0
- package/dist/src/plugins/typescript/macroforgeAugmenter.d.ts +23 -0
- package/dist/src/plugins/typescript/macroforgeAugmenter.js +41 -0
- package/dist/src/plugins/typescript/macroforgeAugmenter.js.map +1 -0
- package/dist/src/plugins/typescript/module-loader.d.ts +28 -0
- package/dist/src/plugins/typescript/module-loader.js +254 -0
- package/dist/src/plugins/typescript/module-loader.js.map +1 -0
- package/dist/src/plugins/typescript/previewer.d.ts +7 -0
- package/dist/src/plugins/typescript/previewer.js +120 -0
- package/dist/src/plugins/typescript/previewer.js.map +1 -0
- package/dist/src/plugins/typescript/service.d.ts +105 -0
- package/dist/src/plugins/typescript/service.js +1073 -0
- package/dist/src/plugins/typescript/service.js.map +1 -0
- package/dist/src/plugins/typescript/serviceCache.d.ts +90 -0
- package/dist/src/plugins/typescript/serviceCache.js +50 -0
- package/dist/src/plugins/typescript/serviceCache.js.map +1 -0
- package/dist/src/plugins/typescript/svelte-ast-utils.d.ts +77 -0
- package/dist/src/plugins/typescript/svelte-ast-utils.js +100 -0
- package/dist/src/plugins/typescript/svelte-ast-utils.js.map +1 -0
- package/dist/src/plugins/typescript/svelte-sys.d.ts +9 -0
- package/dist/src/plugins/typescript/svelte-sys.js +79 -0
- package/dist/src/plugins/typescript/svelte-sys.js.map +1 -0
- package/dist/src/plugins/typescript/utils.d.ts +48 -0
- package/dist/src/plugins/typescript/utils.js +334 -0
- package/dist/src/plugins/typescript/utils.js.map +1 -0
- package/dist/src/server.d.ts +19 -0
- package/dist/src/server.js +434 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/svelte-check.d.ts +65 -0
- package/dist/src/svelte-check.js +288 -0
- package/dist/src/svelte-check.js.map +1 -0
- package/dist/src/utils.d.ts +111 -0
- package/dist/src/utils.js +337 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +79 -0
package/README.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# Svelte Language Server
|
|
2
|
+
|
|
3
|
+
A language server (implementing the [language server protocol](https://microsoft.github.io/language-server-protocol/))
|
|
4
|
+
for Svelte.
|
|
5
|
+
|
|
6
|
+
Requires Node 12 or later.
|
|
7
|
+
|
|
8
|
+
## What is a language server?
|
|
9
|
+
|
|
10
|
+
From https://microsoft.github.io/language-server-protocol/overview
|
|
11
|
+
|
|
12
|
+
> The idea behind a Language Server is to provide the language-specific smarts inside a server that can communicate with development tooling over a protocol that enables inter-process communication.
|
|
13
|
+
|
|
14
|
+
In simpler terms, this allows editor and addon devs to add support for svelte specific 'smarts' (e.g. diagnostics, autocomplete, etc) to any editor without reinventing the wheel.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
Svelte language server is under development and the list of features will surely grow over time.
|
|
19
|
+
|
|
20
|
+
Currently Supported:
|
|
21
|
+
|
|
22
|
+
- Svelte
|
|
23
|
+
- Diagnostic messages for warnings and errors
|
|
24
|
+
- Svelte specific formatting (via [prettier-plugin-svelte](https://github.com/UnwrittenFun/prettier-plugin-svelte))
|
|
25
|
+
- HTML (via [vscode-html-languageservice](https://github.com/Microsoft/vscode-html-languageservice))
|
|
26
|
+
- Hover info
|
|
27
|
+
- Autocompletions
|
|
28
|
+
- [Emmet](https://emmet.io/)
|
|
29
|
+
- Symbols in Outline panel
|
|
30
|
+
- CSS / SCSS / LESS (via [vscode-css-languageservice](https://github.com/Microsoft/vscode-css-languageservice))
|
|
31
|
+
- Diagnostic messages for syntax and lint errors
|
|
32
|
+
- Hover info
|
|
33
|
+
- Autocompletions
|
|
34
|
+
- Formatting (via [prettier](https://github.com/prettier/prettier))
|
|
35
|
+
- [Emmet](https://emmet.io/)
|
|
36
|
+
- Color highlighting and color picker
|
|
37
|
+
- Symbols in Outline panel
|
|
38
|
+
- TypeScript / JavaScript (via TypeScript)
|
|
39
|
+
- Diagnostics messages for syntax errors, semantic errors, and suggestions
|
|
40
|
+
- Hover info
|
|
41
|
+
- Formatting (via [prettier](https://github.com/prettier/prettier))
|
|
42
|
+
- Symbols in Outline panel
|
|
43
|
+
- Autocompletions
|
|
44
|
+
- Go to definition
|
|
45
|
+
- Code Actions
|
|
46
|
+
|
|
47
|
+
## How can I use it?
|
|
48
|
+
|
|
49
|
+
Install a plugin for your editor:
|
|
50
|
+
|
|
51
|
+
- [VS Code](../svelte-vscode)
|
|
52
|
+
|
|
53
|
+
## Settings
|
|
54
|
+
|
|
55
|
+
The language server has quite a few settings to toggle features. They are listed below. When using the VS Code extension, you can set these through the settings UI or in the `settings.json` using the keys mentioned below.
|
|
56
|
+
|
|
57
|
+
When using the language server directly, put the settings as JSON inside `initializationOptions.configuration` for the [initialize command](https://microsoft.github.io/language-server-protocol/specification#initialize). When using the [didChangeConfiguration command](https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeConfiguration), pass the JSON directly. The language server also accepts configuration for Emmet (key: `emmet`; [settings reference](https://github.com/microsoft/vscode/blob/main/extensions/emmet/package.json#L26)), Prettier (key: `prettier`), CSS (key: `css` / `less` / `scss`; [settings reference](https://github.com/microsoft/vscode/blob/main/extensions/css-language-features/package.json#L36)) and TypeScript (keys: `javascript` and `typescript` for JS/TS config; [settings reference](https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/package.json#L141)).
|
|
58
|
+
|
|
59
|
+
Example:
|
|
60
|
+
|
|
61
|
+
Init:
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
{
|
|
65
|
+
initializationOptions: {
|
|
66
|
+
configuration: {
|
|
67
|
+
svelte: {
|
|
68
|
+
plugin: {
|
|
69
|
+
css: { enable: false },
|
|
70
|
+
// ...
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
typescript: { /* .. */ },
|
|
74
|
+
javascript: { /* .. */ },
|
|
75
|
+
prettier: { /* .. */ },
|
|
76
|
+
// ...
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Update:
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
{
|
|
86
|
+
svelte: {
|
|
87
|
+
plugin: {
|
|
88
|
+
css: { enable: false },
|
|
89
|
+
// ...
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
typescript: { /* .. */ },
|
|
93
|
+
javascript: { /* .. */ },
|
|
94
|
+
prettier: { /* .. */ },
|
|
95
|
+
// ...
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### List of settings
|
|
101
|
+
|
|
102
|
+
##### `svelte.plugin.typescript.enable`
|
|
103
|
+
|
|
104
|
+
Enable the TypeScript plugin. _Default_: `true`
|
|
105
|
+
|
|
106
|
+
##### `svelte.plugin.typescript.diagnostics.enable`
|
|
107
|
+
|
|
108
|
+
Enable diagnostic messages for TypeScript. _Default_: `true`
|
|
109
|
+
|
|
110
|
+
##### `svelte.plugin.typescript.hover.enable`
|
|
111
|
+
|
|
112
|
+
Enable hover info for TypeScript. _Default_: `true`
|
|
113
|
+
|
|
114
|
+
##### `svelte.plugin.typescript.documentSymbols.enable`
|
|
115
|
+
|
|
116
|
+
Enable document symbols for TypeScript. _Default_: `true`
|
|
117
|
+
|
|
118
|
+
##### `svelte.plugin.typescript.completions.enable`
|
|
119
|
+
|
|
120
|
+
Enable completions for TypeScript. _Default_: `true`
|
|
121
|
+
|
|
122
|
+
##### `svelte.plugin.typescript.codeActions.enable`
|
|
123
|
+
|
|
124
|
+
Enable code actions for TypeScript. _Default_: `true`
|
|
125
|
+
|
|
126
|
+
##### `svelte.plugin.typescript.selectionRange.enable`
|
|
127
|
+
|
|
128
|
+
Enable selection range for TypeScript. _Default_: `true`
|
|
129
|
+
|
|
130
|
+
##### `svelte.plugin.typescript.signatureHelp.enable`
|
|
131
|
+
|
|
132
|
+
Enable signature help (parameter hints) for JS/TS. _Default_: `true`
|
|
133
|
+
|
|
134
|
+
##### `svelte.plugin.typescript.semanticTokens.enable`
|
|
135
|
+
|
|
136
|
+
Enable semantic tokens (semantic highlight) for TypeScript. _Default_: `true`
|
|
137
|
+
|
|
138
|
+
#### `svelte.plugin.typescript.workspaceSymbols.enable`
|
|
139
|
+
|
|
140
|
+
Enable workspace symbols for TypeScript. You can disable this if the language server client you're using doesn't deduplicate results from the TSServer. _Default_: `true`.
|
|
141
|
+
|
|
142
|
+
##### `svelte.plugin.css.enable`
|
|
143
|
+
|
|
144
|
+
Enable the CSS plugin. _Default_: `true`
|
|
145
|
+
|
|
146
|
+
##### `svelte.plugin.css.globals`
|
|
147
|
+
|
|
148
|
+
Which css files should be checked for global variables (`--global-var: value;`). These variables are added to the css completions. String of comma-separated file paths or globs relative to workspace root.
|
|
149
|
+
|
|
150
|
+
##### `svelte.plugin.css.diagnostics.enable`
|
|
151
|
+
|
|
152
|
+
Enable diagnostic messages for CSS. _Default_: `true`
|
|
153
|
+
|
|
154
|
+
##### `svelte.plugin.css.hover.enable`
|
|
155
|
+
|
|
156
|
+
Enable hover info for CSS. _Default_: `true`
|
|
157
|
+
|
|
158
|
+
##### `svelte.plugin.css.completions.enable`
|
|
159
|
+
|
|
160
|
+
Enable auto completions for CSS. _Default_: `true`
|
|
161
|
+
|
|
162
|
+
##### `svelte.plugin.css.completions.emmet`
|
|
163
|
+
|
|
164
|
+
Enable emmet auto completions for CSS. _Default_: `true`
|
|
165
|
+
If you want to disable emmet completely everywhere (not just Svelte), you can also set `"emmet.showExpandedAbbreviation": "never"` in your settings.
|
|
166
|
+
|
|
167
|
+
##### `svelte.plugin.css.documentColors.enable`
|
|
168
|
+
|
|
169
|
+
Enable document colors for CSS. _Default_: `true`
|
|
170
|
+
|
|
171
|
+
##### `svelte.plugin.css.colorPresentations.enable`
|
|
172
|
+
|
|
173
|
+
Enable color picker for CSS. _Default_: `true`
|
|
174
|
+
|
|
175
|
+
##### `svelte.plugin.css.documentSymbols.enable`
|
|
176
|
+
|
|
177
|
+
Enable document symbols for CSS. _Default_: `true`
|
|
178
|
+
|
|
179
|
+
##### `svelte.plugin.css.selectionRange.enable`
|
|
180
|
+
|
|
181
|
+
Enable selection range for CSS. _Default_: `true`
|
|
182
|
+
|
|
183
|
+
##### `svelte.plugin.html.enable`
|
|
184
|
+
|
|
185
|
+
Enable the HTML plugin. _Default_: `true`
|
|
186
|
+
|
|
187
|
+
##### `svelte.plugin.html.hover.enable`
|
|
188
|
+
|
|
189
|
+
Enable hover info for HTML. _Default_: `true`
|
|
190
|
+
|
|
191
|
+
##### `svelte.plugin.html.completions.enable`
|
|
192
|
+
|
|
193
|
+
Enable auto completions for HTML. _Default_: `true`
|
|
194
|
+
|
|
195
|
+
##### `svelte.plugin.html.completions.emmet`
|
|
196
|
+
|
|
197
|
+
Enable emmet auto completions for HTML. _Default_: `true`
|
|
198
|
+
If you want to disable emmet completely everywhere (not just Svelte), you can also set `"emmet.showExpandedAbbreviation": "never"` in your settings.
|
|
199
|
+
|
|
200
|
+
##### `svelte.plugin.html.tagComplete.enable`
|
|
201
|
+
|
|
202
|
+
Enable HTML tag auto closing. _Default_: `true`
|
|
203
|
+
|
|
204
|
+
##### `svelte.plugin.html.documentSymbols.enable`
|
|
205
|
+
|
|
206
|
+
Enable document symbols for HTML. _Default_: `true`
|
|
207
|
+
|
|
208
|
+
##### `svelte.plugin.html.linkedEditing.enable`
|
|
209
|
+
|
|
210
|
+
Enable Linked Editing for HTML. _Default_: `true`
|
|
211
|
+
|
|
212
|
+
##### `svelte.plugin.svelte.enable`
|
|
213
|
+
|
|
214
|
+
Enable the Svelte plugin. _Default_: `true`
|
|
215
|
+
|
|
216
|
+
##### `svelte.plugin.svelte.diagnostics.enable`
|
|
217
|
+
|
|
218
|
+
Enable diagnostic messages for Svelte. _Default_: `true`
|
|
219
|
+
|
|
220
|
+
##### `svelte.plugin.svelte.compilerWarnings`
|
|
221
|
+
|
|
222
|
+
Svelte compiler warning codes to ignore or to treat as errors. Example: { 'css-unused-selector': 'ignore', 'unused-export-let': 'error'}
|
|
223
|
+
|
|
224
|
+
##### `svelte.plugin.svelte.format.enable`
|
|
225
|
+
|
|
226
|
+
Enable formatting for Svelte (includes css & js) using [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte). _Default_: `true`
|
|
227
|
+
|
|
228
|
+
You can set some formatting options through this extension. They will be ignored if there's any kind of configuration file, for example a `.prettierrc` file. Read more about Prettier's configuration file [here](https://prettier.io/docs/en/configuration.html).
|
|
229
|
+
|
|
230
|
+
##### `svelte.plugin.svelte.format.config.svelteSortOrder`
|
|
231
|
+
|
|
232
|
+
Format: join the keys `options`, `scripts`, `markup`, `styles` with a `-` in the order you want. _Default_: `options-scripts-markup-styles`
|
|
233
|
+
|
|
234
|
+
This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file.
|
|
235
|
+
|
|
236
|
+
##### `svelte.plugin.svelte.format.config.svelteStrictMode`
|
|
237
|
+
|
|
238
|
+
More strict HTML syntax. _Default_: `false`
|
|
239
|
+
|
|
240
|
+
This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file.
|
|
241
|
+
|
|
242
|
+
##### `svelte.plugin.svelte.format.config.svelteAllowShorthand`
|
|
243
|
+
|
|
244
|
+
Option to enable/disable component attribute shorthand if attribute name and expression are the same. _Default_: `true`
|
|
245
|
+
|
|
246
|
+
This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file.
|
|
247
|
+
|
|
248
|
+
##### `svelte.plugin.svelte.format.config.svelteBracketNewLine`
|
|
249
|
+
|
|
250
|
+
Put the `>` of a multiline element on a new line. _Default_: `true`
|
|
251
|
+
|
|
252
|
+
This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file.
|
|
253
|
+
|
|
254
|
+
##### `svelte.plugin.svelte.format.config.svelteIndentScriptAndStyle`
|
|
255
|
+
|
|
256
|
+
Whether or not to indent code inside `<script>` and `<style>` tags. _Default_: `true`
|
|
257
|
+
|
|
258
|
+
This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file.
|
|
259
|
+
|
|
260
|
+
##### `svelte.plugin.svelte.format.config.printWidth`
|
|
261
|
+
|
|
262
|
+
Maximum line width after which code is tried to be broken up. This is a Prettier core option. If you have the Prettier extension installed, this option is ignored and the corresponding option of that extension is used instead. This option is also ignored if there's any kind of configuration file, for example a `.prettierrc` file. _Default_: `80`
|
|
263
|
+
|
|
264
|
+
##### `svelte.plugin.svelte.format.config.singleQuote`
|
|
265
|
+
|
|
266
|
+
Use single quotes instead of double quotes, where possible. This is a Prettier core option. If you have the Prettier extension installed, this option is ignored and the corresponding option of that extension is used instead. This option is also ignored if there's any kind of configuration file, for example a `.prettierrc` file. _Default_: `false`
|
|
267
|
+
|
|
268
|
+
##### `svelte.plugin.svelte.hover.enable`
|
|
269
|
+
|
|
270
|
+
Enable hover info for Svelte (for tags like #if/#each). _Default_: `true`
|
|
271
|
+
|
|
272
|
+
##### `svelte.plugin.svelte.completions.enable`
|
|
273
|
+
|
|
274
|
+
Enable autocompletion for Svelte (for tags like #if/#each). _Default_: `true`
|
|
275
|
+
|
|
276
|
+
##### `svelte.plugin.svelte.rename.enable`
|
|
277
|
+
|
|
278
|
+
Enable rename/move Svelte files functionality. _Default_: `true`
|
|
279
|
+
|
|
280
|
+
##### `svelte.plugin.svelte.codeActions.enable`
|
|
281
|
+
|
|
282
|
+
Enable code actions for Svelte. _Default_: `true`
|
|
283
|
+
|
|
284
|
+
##### `svelte.plugin.svelte.selectionRange.enable`
|
|
285
|
+
|
|
286
|
+
Enable selection range for Svelte. _Default_: `true`
|
|
287
|
+
|
|
288
|
+
##### `svelte.plugin.svelte.runesLegacyModeCodeLens.enable`
|
|
289
|
+
|
|
290
|
+
Whether or not to show a code lens at the top of Svelte files indicating if they are in runes mode or legacy mode. Only visible in Svelte 5 projects. _Default_: `true`
|
|
291
|
+
|
|
292
|
+
##### `svelte.plugin.svelte.defaultScriptLanguage`
|
|
293
|
+
|
|
294
|
+
The default language to use when generating new script tags in Svelte. _Default_: `none`
|
|
295
|
+
|
|
296
|
+
#### `svelte.plugin.svelte.documentHighlight.enable`
|
|
297
|
+
|
|
298
|
+
Enable document highlight support. Requires a restart. _Default_: `true`
|
|
299
|
+
|
|
300
|
+
## TS Macros Integration Overview
|
|
301
|
+
|
|
302
|
+
Some projects rely on the `@macroforge/typescript-plugin` TypeScript plugin to
|
|
303
|
+
inject macro-generated APIs (for example `toJSON()` or `toString()` for classes
|
|
304
|
+
decorated with `@derive`). tsserver plugins are not guaranteed to load when the
|
|
305
|
+
Svelte language server runs inside sandboxed editor runtimes (Zed, WASM, etc.),
|
|
306
|
+
so we mirrored the plugin’s logic in the language server itself.
|
|
307
|
+
|
|
308
|
+
Implementation outline:
|
|
309
|
+
|
|
310
|
+
1. `src/plugins/typescript/macroforgeAugmenter.ts` contains the decorator scan and
|
|
311
|
+
interface generation logic extracted from the original plugin. It exposes a
|
|
312
|
+
small configuration struct (`macroNames`, `mixinModule`, `mixinTypes`) plus an
|
|
313
|
+
`augmentWithMacroforges` helper that rewrites source text when decorated classes
|
|
314
|
+
are found.
|
|
315
|
+
2. During TypeScript service boot (`src/plugins/typescript/service.ts`) we read
|
|
316
|
+
any `@macroforge/typescript-plugin` entry from the workspace tsconfig and build
|
|
317
|
+
the augmentation config from it. The config travels with the parsed compiler
|
|
318
|
+
options and is passed to every snapshot factory.
|
|
319
|
+
3. `DocumentSnapshot` applies the augmentation for both Svelte snapshots and
|
|
320
|
+
plain JS/TS snapshots (`src/plugins/typescript/DocumentSnapshot.ts`). The
|
|
321
|
+
rewritten text—including the synthetic mixin interfaces—is what the
|
|
322
|
+
TypeScript language service consumes, so diagnostics/completions in `.svelte`
|
|
323
|
+
files “see” the macro-generated methods even without tsserver plugin support.
|
|
324
|
+
|
|
325
|
+
This keeps the plugin available for plain TypeScript projects (via VTSLS) while
|
|
326
|
+
ensuring the Svelte LS behaves consistently in sandboxed environments.
|
|
327
|
+
|
|
328
|
+
## Credits
|
|
329
|
+
|
|
330
|
+
- [James Birtles](https://github.com/jamesbirtles) for creating the foundation which this language server is built on
|
|
331
|
+
- Vue's [Vetur](https://github.com/vuejs/vetur) language server which heavily inspires this project
|
package/bin/server.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as prettier from 'prettier';
|
|
2
|
+
import * as svelte from 'svelte/compiler';
|
|
3
|
+
export declare function setIsTrusted(_isTrusted: boolean): void;
|
|
4
|
+
export declare function getPackageInfo(packageName: string, fromPath: string, use_fallback?: boolean): {
|
|
5
|
+
path: string;
|
|
6
|
+
version: {
|
|
7
|
+
full: any;
|
|
8
|
+
major: number;
|
|
9
|
+
minor: number;
|
|
10
|
+
patch: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare function importPrettier(fromPath: string): typeof prettier;
|
|
14
|
+
export declare function importSvelte(fromPath: string): typeof svelte;
|
|
15
|
+
/** Can throw because no fallback guaranteed */
|
|
16
|
+
export declare function importSveltePreprocess(fromPath: string): any;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setIsTrusted = setIsTrusted;
|
|
4
|
+
exports.getPackageInfo = getPackageInfo;
|
|
5
|
+
exports.importPrettier = importPrettier;
|
|
6
|
+
exports.importSvelte = importSvelte;
|
|
7
|
+
exports.importSveltePreprocess = importSveltePreprocess;
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const logger_1 = require("./logger");
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not the current workspace can be trusted.
|
|
12
|
+
* TODO rework this to a class which depends on the LsConfigManager
|
|
13
|
+
* and inject that class into all places where it's needed (Document etc.)
|
|
14
|
+
*/
|
|
15
|
+
let isTrusted = true;
|
|
16
|
+
function setIsTrusted(_isTrusted) {
|
|
17
|
+
isTrusted = _isTrusted;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* This function encapsulates the require call in one place
|
|
21
|
+
* so we can replace its content inside rollup builds
|
|
22
|
+
* so it's not transformed.
|
|
23
|
+
*/
|
|
24
|
+
function dynamicRequire(dynamicFileToRequire) {
|
|
25
|
+
// prettier-ignore
|
|
26
|
+
return require(dynamicFileToRequire);
|
|
27
|
+
}
|
|
28
|
+
function getPackageInfo(packageName, fromPath, use_fallback = true) {
|
|
29
|
+
const paths = [];
|
|
30
|
+
if (isTrusted) {
|
|
31
|
+
paths.push(fromPath);
|
|
32
|
+
}
|
|
33
|
+
if (use_fallback) {
|
|
34
|
+
paths.push(__dirname);
|
|
35
|
+
}
|
|
36
|
+
const packageJSONPath = require.resolve(`${packageName}/package.json`, {
|
|
37
|
+
paths
|
|
38
|
+
});
|
|
39
|
+
const { version } = dynamicRequire(packageJSONPath);
|
|
40
|
+
const [major, minor, patch] = version.split('.');
|
|
41
|
+
return {
|
|
42
|
+
path: (0, path_1.dirname)(packageJSONPath),
|
|
43
|
+
version: {
|
|
44
|
+
full: version,
|
|
45
|
+
major: Number(major),
|
|
46
|
+
minor: Number(minor),
|
|
47
|
+
patch: Number(patch)
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function importPrettier(fromPath) {
|
|
52
|
+
const pkg = getPackageInfo('prettier', fromPath);
|
|
53
|
+
const main = (0, path_1.resolve)(pkg.path);
|
|
54
|
+
logger_1.Logger.debug('Using Prettier v' + pkg.version.full, 'from', main);
|
|
55
|
+
return dynamicRequire(main);
|
|
56
|
+
}
|
|
57
|
+
function importSvelte(fromPath) {
|
|
58
|
+
const pkg = getPackageInfo('svelte', fromPath);
|
|
59
|
+
const main = (0, path_1.resolve)(pkg.path, 'compiler');
|
|
60
|
+
logger_1.Logger.debug('Using Svelte v' + pkg.version.full, 'from', main);
|
|
61
|
+
if (pkg.version.major === 4) {
|
|
62
|
+
return dynamicRequire(main + '.cjs');
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return dynamicRequire(main);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Can throw because no fallback guaranteed */
|
|
69
|
+
function importSveltePreprocess(fromPath) {
|
|
70
|
+
const pkg = getPackageInfo('svelte-preprocess', fromPath, false // svelte-language-server doesn't have a dependency on svelte-preprocess so we can't provide a fallback
|
|
71
|
+
);
|
|
72
|
+
const main = (0, path_1.resolve)(pkg.path);
|
|
73
|
+
logger_1.Logger.debug('Using svelte-preprocess v' + pkg.version.full, 'from', main);
|
|
74
|
+
return dynamicRequire(main);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=importPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importPackage.js","sourceRoot":"","sources":["../../src/importPackage.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.SvelteCheck = exports.offsetAt = void 0;
|
|
18
|
+
__exportStar(require("./server"), exports);
|
|
19
|
+
var documents_1 = require("./lib/documents");
|
|
20
|
+
Object.defineProperty(exports, "offsetAt", { enumerable: true, get: function () { return documents_1.offsetAt; } });
|
|
21
|
+
var svelte_check_1 = require("./svelte-check");
|
|
22
|
+
Object.defineProperty(exports, "SvelteCheck", { enumerable: true, get: function () { return svelte_check_1.SvelteCheck; } });
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2C;AAAlC,qGAAA,QAAQ,OAAA;AACjB,+CAA8F;AAArF,2GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Connection, TextDocumentIdentifier, Diagnostic, CancellationToken } from 'vscode-languageserver';
|
|
2
|
+
import { DocumentManager, Document } from './documents';
|
|
3
|
+
export type SendDiagnostics = Connection['sendDiagnostics'];
|
|
4
|
+
export type GetDiagnostics = (doc: TextDocumentIdentifier, cancellationToken?: CancellationToken) => Thenable<Diagnostic[]>;
|
|
5
|
+
export declare class DiagnosticsManager {
|
|
6
|
+
private sendDiagnostics;
|
|
7
|
+
private docManager;
|
|
8
|
+
private getDiagnostics;
|
|
9
|
+
constructor(sendDiagnostics: SendDiagnostics, docManager: DocumentManager, getDiagnostics: GetDiagnostics);
|
|
10
|
+
private pendingUpdates;
|
|
11
|
+
private cancellationTokens;
|
|
12
|
+
private updateAll;
|
|
13
|
+
scheduleUpdateAll(): void;
|
|
14
|
+
private debouncedUpdateAll;
|
|
15
|
+
private update;
|
|
16
|
+
cancelStarted(uri: string): void;
|
|
17
|
+
removeDiagnostics(document: Document): void;
|
|
18
|
+
scheduleUpdate(document: Document): void;
|
|
19
|
+
private scheduleBatchUpdate;
|
|
20
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiagnosticsManager = void 0;
|
|
4
|
+
const vscode_languageserver_1 = require("vscode-languageserver");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
class DiagnosticsManager {
|
|
7
|
+
constructor(sendDiagnostics, docManager, getDiagnostics) {
|
|
8
|
+
this.sendDiagnostics = sendDiagnostics;
|
|
9
|
+
this.docManager = docManager;
|
|
10
|
+
this.getDiagnostics = getDiagnostics;
|
|
11
|
+
this.pendingUpdates = new Set();
|
|
12
|
+
this.cancellationTokens = new Map();
|
|
13
|
+
this.debouncedUpdateAll = (0, utils_1.debounceThrottle)(() => this.updateAll(), 1000);
|
|
14
|
+
this.scheduleBatchUpdate = (0, utils_1.debounceThrottle)(() => {
|
|
15
|
+
this.pendingUpdates.forEach((doc) => {
|
|
16
|
+
this.update(doc);
|
|
17
|
+
});
|
|
18
|
+
this.pendingUpdates.clear();
|
|
19
|
+
}, 700);
|
|
20
|
+
}
|
|
21
|
+
updateAll() {
|
|
22
|
+
this.docManager.getAllOpenedByClient().forEach((doc) => {
|
|
23
|
+
this.update(doc[1]);
|
|
24
|
+
});
|
|
25
|
+
this.pendingUpdates.clear();
|
|
26
|
+
}
|
|
27
|
+
scheduleUpdateAll() {
|
|
28
|
+
this.cancellationTokens.forEach((token) => token.cancel());
|
|
29
|
+
this.cancellationTokens.clear();
|
|
30
|
+
this.pendingUpdates.clear();
|
|
31
|
+
this.debouncedUpdateAll();
|
|
32
|
+
}
|
|
33
|
+
async update(document) {
|
|
34
|
+
const uri = document.getURL();
|
|
35
|
+
this.cancelStarted(uri);
|
|
36
|
+
const tokenSource = new vscode_languageserver_1.CancellationTokenSource();
|
|
37
|
+
this.cancellationTokens.set(uri, tokenSource);
|
|
38
|
+
const diagnostics = await this.getDiagnostics({ uri: document.getURL() }, tokenSource.token);
|
|
39
|
+
this.sendDiagnostics({
|
|
40
|
+
uri: document.getURL(),
|
|
41
|
+
diagnostics
|
|
42
|
+
});
|
|
43
|
+
tokenSource.dispose();
|
|
44
|
+
if (this.cancellationTokens.get(uri) === tokenSource) {
|
|
45
|
+
this.cancellationTokens.delete(uri);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
cancelStarted(uri) {
|
|
49
|
+
const started = this.cancellationTokens.get(uri);
|
|
50
|
+
if (started) {
|
|
51
|
+
started.cancel();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
removeDiagnostics(document) {
|
|
55
|
+
this.pendingUpdates.delete(document);
|
|
56
|
+
this.sendDiagnostics({
|
|
57
|
+
uri: document.getURL(),
|
|
58
|
+
diagnostics: []
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
scheduleUpdate(document) {
|
|
62
|
+
if (!this.docManager.isOpenedInClient(document.getURL())) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.cancelStarted(document.getURL());
|
|
66
|
+
this.pendingUpdates.add(document);
|
|
67
|
+
this.scheduleBatchUpdate();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.DiagnosticsManager = DiagnosticsManager;
|
|
71
|
+
//# sourceMappingURL=DiagnosticsManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagnosticsManager.js","sourceRoot":"","sources":["../../../src/lib/DiagnosticsManager.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DidChangeWatchedFilesParams, RelativePattern } from 'vscode-languageserver';
|
|
2
|
+
type DidChangeHandler = (para: DidChangeWatchedFilesParams) => void;
|
|
3
|
+
export declare class FallbackWatcher {
|
|
4
|
+
private readonly watcher;
|
|
5
|
+
private readonly callbacks;
|
|
6
|
+
private undeliveredFileEvents;
|
|
7
|
+
constructor(watchExtensions: string[], workspacePaths: string[]);
|
|
8
|
+
private convert;
|
|
9
|
+
private onFSEvent;
|
|
10
|
+
private readonly scheduleTrigger;
|
|
11
|
+
onDidChangeWatchedFiles(callback: DidChangeHandler): void;
|
|
12
|
+
watchDirectory(patterns: RelativePattern[]): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FallbackWatcher = void 0;
|
|
4
|
+
const chokidar_1 = require("chokidar");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const vscode_languageserver_1 = require("vscode-languageserver");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const url_1 = require("url");
|
|
10
|
+
const DELAY = 50;
|
|
11
|
+
class FallbackWatcher {
|
|
12
|
+
constructor(watchExtensions, workspacePaths) {
|
|
13
|
+
this.callbacks = [];
|
|
14
|
+
this.undeliveredFileEvents = [];
|
|
15
|
+
this.scheduleTrigger = (0, lodash_1.debounce)(() => {
|
|
16
|
+
const para = {
|
|
17
|
+
changes: this.undeliveredFileEvents
|
|
18
|
+
};
|
|
19
|
+
this.undeliveredFileEvents = [];
|
|
20
|
+
this.callbacks.forEach((callback) => callback(para));
|
|
21
|
+
}, DELAY);
|
|
22
|
+
const gitOrNodeModules = /\.git|node_modules/;
|
|
23
|
+
const ignoredExtensions = (fileName, stats) => {
|
|
24
|
+
return (stats?.isFile() === true && !watchExtensions.some((ext) => fileName.endsWith(ext)));
|
|
25
|
+
};
|
|
26
|
+
this.watcher = (0, chokidar_1.watch)(workspacePaths, {
|
|
27
|
+
ignored: [gitOrNodeModules, ignoredExtensions],
|
|
28
|
+
// typescript would scan the project files on init.
|
|
29
|
+
// We only need to know what got updated.
|
|
30
|
+
ignoreInitial: true,
|
|
31
|
+
ignorePermissionErrors: true
|
|
32
|
+
});
|
|
33
|
+
this.watcher
|
|
34
|
+
.on('add', (path) => this.onFSEvent(path, vscode_languageserver_1.FileChangeType.Created))
|
|
35
|
+
.on('unlink', (path) => this.onFSEvent(path, vscode_languageserver_1.FileChangeType.Deleted))
|
|
36
|
+
.on('change', (path) => this.onFSEvent(path, vscode_languageserver_1.FileChangeType.Changed));
|
|
37
|
+
}
|
|
38
|
+
convert(path, type) {
|
|
39
|
+
return {
|
|
40
|
+
type,
|
|
41
|
+
uri: (0, utils_1.pathToUrl)(path)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
onFSEvent(path, type) {
|
|
45
|
+
const fileEvent = this.convert(path, type);
|
|
46
|
+
this.undeliveredFileEvents.push(fileEvent);
|
|
47
|
+
this.scheduleTrigger();
|
|
48
|
+
}
|
|
49
|
+
onDidChangeWatchedFiles(callback) {
|
|
50
|
+
this.callbacks.push(callback);
|
|
51
|
+
}
|
|
52
|
+
watchDirectory(patterns) {
|
|
53
|
+
for (const pattern of patterns) {
|
|
54
|
+
const basePath = (0, url_1.fileURLToPath)(typeof pattern.baseUri === 'string' ? pattern.baseUri : pattern.baseUri.uri);
|
|
55
|
+
if (!basePath) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
this.watcher.add((0, path_1.join)(basePath, pattern.pattern));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
dispose() {
|
|
62
|
+
this.watcher.close();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.FallbackWatcher = FallbackWatcher;
|
|
66
|
+
//# sourceMappingURL=FallbackWatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FallbackWatcher.js","sourceRoot":"","sources":["../../../src/lib/FallbackWatcher.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DocumentHighlight, Position } from 'vscode-languageserver-types';
|
|
2
|
+
import { Document, TagInformation } from '../documents';
|
|
3
|
+
export declare function wordHighlightForTag(document: Document, position: Position, tag: TagInformation | null, wordPattern: RegExp): DocumentHighlight[] | null;
|