@astrojs/language-server 0.7.19 → 0.8.4
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/CHANGELOG.md +24 -0
- package/dist/check.js +2 -1
- package/dist/core/config/ConfigManager.js +8 -6
- package/dist/core/documents/Document.js +6 -6
- package/dist/core/documents/DocumentBase.js +2 -2
- package/dist/core/documents/DocumentManager.js +6 -6
- package/dist/core/documents/DocumentMapper.js +9 -7
- package/dist/core/documents/parseAstro.js +3 -3
- package/dist/core/documents/parseHtml.js +2 -2
- package/dist/core/documents/utils.js +7 -6
- package/dist/plugins/PluginHost.js +7 -6
- package/dist/plugins/astro/AstroPlugin.js +6 -6
- package/dist/plugins/astro/features/CompletionProvider.js +15 -14
- package/dist/plugins/css/CSSDocument.js +1 -1
- package/dist/plugins/css/CSSPlugin.js +9 -9
- package/dist/plugins/css/StyleAttributeDocument.js +1 -1
- package/dist/plugins/html/HTMLPlugin.js +4 -4
- package/dist/plugins/typescript/DocumentSnapshot.js +17 -16
- package/dist/plugins/typescript/LanguageServiceManager.js +7 -7
- package/dist/plugins/typescript/SnapshotManager.js +3 -3
- package/dist/plugins/typescript/TypeScriptPlugin.js +11 -11
- package/dist/plugins/typescript/astro-sys.js +5 -5
- package/dist/plugins/typescript/astro2tsx.js +1 -1
- package/dist/plugins/typescript/features/CompletionsProvider.js +6 -5
- package/dist/plugins/typescript/features/DiagnosticsProvider.js +12 -11
- package/dist/plugins/typescript/features/HoverProvider.js +4 -4
- package/dist/plugins/typescript/features/SignatureHelpProvider.js +4 -4
- package/dist/plugins/typescript/features/utils.js +2 -1
- package/dist/plugins/typescript/languageService.js +8 -8
- package/dist/plugins/typescript/module-loader.js +6 -6
- package/dist/plugins/typescript/previewer.js +1 -1
- package/dist/plugins/typescript/utils.js +3 -3
- package/dist/server.js +15 -13
- package/dist/utils.js +2 -1
- package/package.json +5 -3
package/dist/server.js
CHANGED
|
@@ -12,27 +12,28 @@ const TagCloseRequest = new vscode_languageserver_1.RequestType('html/tag');
|
|
|
12
12
|
* Starts `astro-languageservice`
|
|
13
13
|
*/
|
|
14
14
|
function startServer() {
|
|
15
|
-
let connection = vscode_languageserver_1.createConnection(vscode_languageserver_1.ProposedFeatures.all);
|
|
15
|
+
let connection = (0, vscode_languageserver_1.createConnection)(vscode_languageserver_1.ProposedFeatures.all);
|
|
16
16
|
const docManager = documents_1.DocumentManager.newInstance();
|
|
17
17
|
const configManager = new config_1.ConfigManager();
|
|
18
18
|
const pluginHost = new plugins_1.PluginHost(docManager);
|
|
19
19
|
connection.onInitialize((evt) => {
|
|
20
|
-
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
21
|
+
const workspaceUris = (_b = (_a = evt.workspaceFolders) === null || _a === void 0 ? void 0 : _a.map((folder) => folder.uri.toString())) !== null && _b !== void 0 ? _b : [(_c = evt.rootUri) !== null && _c !== void 0 ? _c : ''];
|
|
21
22
|
pluginHost.initialize({
|
|
22
|
-
filterIncompleteCompletions: !evt.initializationOptions
|
|
23
|
-
definitionLinkSupport: !!evt.capabilities.textDocument
|
|
23
|
+
filterIncompleteCompletions: !((_d = evt.initializationOptions) === null || _d === void 0 ? void 0 : _d.dontFilterIncompleteCompletions),
|
|
24
|
+
definitionLinkSupport: !!((_f = (_e = evt.capabilities.textDocument) === null || _e === void 0 ? void 0 : _e.definition) === null || _f === void 0 ? void 0 : _f.linkSupport),
|
|
24
25
|
});
|
|
25
26
|
pluginHost.register(new plugins_1.HTMLPlugin(docManager, configManager));
|
|
26
27
|
pluginHost.register(new plugins_1.CSSPlugin(docManager, configManager));
|
|
27
28
|
pluginHost.register(new plugins_1.TypeScriptPlugin(docManager, configManager, workspaceUris));
|
|
28
29
|
pluginHost.register(new plugins_1.AstroPlugin(docManager, configManager, workspaceUris));
|
|
29
|
-
configManager.update(evt.initializationOptions
|
|
30
|
-
evt.initializationOptions
|
|
30
|
+
configManager.update(((_j = (_h = (_g = evt.initializationOptions) === null || _g === void 0 ? void 0 : _g.configuration) === null || _h === void 0 ? void 0 : _h.astro) === null || _j === void 0 ? void 0 : _j.plugin) ||
|
|
31
|
+
((_k = evt.initializationOptions) === null || _k === void 0 ? void 0 : _k.config) ||
|
|
31
32
|
{});
|
|
32
|
-
configManager.updateTsJsUserPreferences(evt.initializationOptions
|
|
33
|
-
evt.initializationOptions
|
|
33
|
+
configManager.updateTsJsUserPreferences(((_l = evt.initializationOptions) === null || _l === void 0 ? void 0 : _l.configuration) ||
|
|
34
|
+
((_m = evt.initializationOptions) === null || _m === void 0 ? void 0 : _m.typescriptConfig) ||
|
|
34
35
|
{});
|
|
35
|
-
configManager.updateEmmetConfig(evt.initializationOptions
|
|
36
|
+
configManager.updateEmmetConfig(((_p = (_o = evt.initializationOptions) === null || _o === void 0 ? void 0 : _o.configuration) === null || _p === void 0 ? void 0 : _p.emmet) || ((_q = evt.initializationOptions) === null || _q === void 0 ? void 0 : _q.emmetConfig) || {});
|
|
36
37
|
return {
|
|
37
38
|
capabilities: {
|
|
38
39
|
textDocumentSync: vscode_languageserver_1.TextDocumentSyncKind.Incremental,
|
|
@@ -83,14 +84,14 @@ function startServer() {
|
|
|
83
84
|
});
|
|
84
85
|
connection.onDidCloseTextDocument((evt) => docManager.closeDocument(evt.textDocument.uri));
|
|
85
86
|
const diagnosticsManager = new DiagnosticsManager_1.DiagnosticsManager(connection.sendDiagnostics, docManager, pluginHost.getDiagnostics.bind(pluginHost));
|
|
86
|
-
const updateAllDiagnostics = utils_1.debounceThrottle(() => diagnosticsManager.updateAll(), 1000);
|
|
87
|
+
const updateAllDiagnostics = (0, utils_1.debounceThrottle)(() => diagnosticsManager.updateAll(), 1000);
|
|
87
88
|
connection.onDidChangeTextDocument((evt) => {
|
|
88
89
|
docManager.updateDocument(evt.textDocument.uri, evt.contentChanges);
|
|
89
90
|
});
|
|
90
91
|
connection.onDidChangeWatchedFiles((evt) => {
|
|
91
92
|
const params = evt.changes
|
|
92
93
|
.map((change) => ({
|
|
93
|
-
fileName: utils_1.urlToPath(change.uri),
|
|
94
|
+
fileName: (0, utils_1.urlToPath)(change.uri),
|
|
94
95
|
changeType: change.type,
|
|
95
96
|
}))
|
|
96
97
|
.filter((change) => !!change.fileName);
|
|
@@ -100,7 +101,8 @@ function startServer() {
|
|
|
100
101
|
//connection.onDidChangeTextDocument(updateAllDiagnostics);
|
|
101
102
|
// Config
|
|
102
103
|
connection.onDidChangeConfiguration(({ settings }) => {
|
|
103
|
-
|
|
104
|
+
var _a;
|
|
105
|
+
configManager.update((_a = settings.astro) === null || _a === void 0 ? void 0 : _a.plugin);
|
|
104
106
|
configManager.updateEmmetConfig(settings.emmet);
|
|
105
107
|
configManager.updateTsJsUserPreferences(settings);
|
|
106
108
|
});
|
|
@@ -122,7 +124,7 @@ function startServer() {
|
|
|
122
124
|
connection.onRequest(TagCloseRequest, (evt) => pluginHost.doTagComplete(evt.textDocument, evt.position));
|
|
123
125
|
connection.onSignatureHelp((evt, cancellationToken) => pluginHost.getSignatureHelp(evt.textDocument, evt.position, evt.context, cancellationToken));
|
|
124
126
|
connection.onRenameRequest(evt => pluginHost.rename(evt.textDocument, evt.position, evt.newName));
|
|
125
|
-
docManager.on('documentChange', utils_1.debounceThrottle(async (document) => diagnosticsManager.update(document), 1000));
|
|
127
|
+
docManager.on('documentChange', (0, utils_1.debounceThrottle)(async (document) => diagnosticsManager.update(document), 1000));
|
|
126
128
|
docManager.on('documentClose', (document) => diagnosticsManager.removeDiagnostics(document));
|
|
127
129
|
connection.listen();
|
|
128
130
|
}
|
package/dist/utils.js
CHANGED
|
@@ -28,7 +28,8 @@ exports.pathToUrl = pathToUrl;
|
|
|
28
28
|
* the same name like a html tag.
|
|
29
29
|
*/
|
|
30
30
|
function isPossibleComponent(node) {
|
|
31
|
-
|
|
31
|
+
var _a;
|
|
32
|
+
return !!((_a = node.tag) === null || _a === void 0 ? void 0 : _a[0].match(/[A-Z]/));
|
|
32
33
|
}
|
|
33
34
|
exports.isPossibleComponent = isPossibleComponent;
|
|
34
35
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/language-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"author": "Skypack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,13 +23,15 @@
|
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"source-map": "^0.7.3",
|
|
25
25
|
"ts-morph": "^12.0.0",
|
|
26
|
-
"typescript": "^4.
|
|
26
|
+
"typescript": "^4.5.2",
|
|
27
27
|
"vscode-css-languageservice": "^5.1.1",
|
|
28
28
|
"vscode-emmet-helper": "2.1.2",
|
|
29
29
|
"vscode-html-languageservice": "^3.0.3",
|
|
30
30
|
"vscode-languageserver": "6.1.1",
|
|
31
31
|
"vscode-languageserver-protocol": "^3.16.0",
|
|
32
|
-
"vscode-languageserver-textdocument": "^1.0.1"
|
|
32
|
+
"vscode-languageserver-textdocument": "^1.0.1",
|
|
33
|
+
"vscode-languageserver-types": "^3.16.0",
|
|
34
|
+
"vscode-uri": "^3.0.2"
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
35
37
|
"@types/lodash": "^4.14.116",
|