astro-vscode 0.8.9 → 0.9.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/CHANGELOG.md +28 -0
- package/README.md +8 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +50 -44
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# astro-vscode
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7dc85cc: Add support for Emmet inside components, upgrade Emmet version
|
|
8
|
+
- Updated dependencies [7dc85cc]
|
|
9
|
+
- @astrojs/language-server@0.9.1
|
|
10
|
+
|
|
11
|
+
## 0.9.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 6b6b47a: Remove internal astro.d.ts files, instead prefer the one provided by Astro itself
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [6b6b47a]
|
|
20
|
+
- @astrojs/language-server@0.9.0
|
|
21
|
+
- @astrojs/ts-plugin@0.2.0
|
|
22
|
+
|
|
23
|
+
## 0.8.10
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 8878324: Add feature to reload language server on ts/jsconfig change
|
|
28
|
+
- Updated dependencies [5b16fb4]
|
|
29
|
+
- @astrojs/language-server@0.8.10
|
|
30
|
+
|
|
3
31
|
## 0.8.9
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -17,3 +17,11 @@ Provides language support for `.astro` files. This extension is powered by the [
|
|
|
17
17
|
## Configuration
|
|
18
18
|
|
|
19
19
|
You can disable most features in the extension by going to your workspace settings page. Under __Extension__ find Astro configuration and uncheck the feature you do not want. For example to disable error messages unselect __TypeScript > Diagnostics: Enable__.
|
|
20
|
+
|
|
21
|
+
## Troubleshooting
|
|
22
|
+
|
|
23
|
+
### Cannot find name "Astro" or Property 'env' does not exist on type 'ImportMeta' or Cannot find name "Fragment"
|
|
24
|
+
|
|
25
|
+
Starting from 0.23.5 version of Astro and the 0.9 version of this extension, typechecking is now done using types that are provided by Astro itself. Therefore, to benefit from those included types, you need to use any version of Astro that is higher or equal to 0.23.5
|
|
26
|
+
|
|
27
|
+
If you can't upgrade to a newer version of Astro for the moment, you can downgrade the extension to the latest pre 0.9.0 version by right clicking the Astro extension in the sidebar and pressing "Install another version"
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare function activate(context:
|
|
1
|
+
import { ExtensionContext } from 'vscode';
|
|
2
|
+
import { LanguageClient } from 'vscode-languageclient/node';
|
|
3
|
+
export declare function activate(context: ExtensionContext): Promise<{
|
|
4
|
+
getLanguageServer: () => LanguageClient;
|
|
5
|
+
}>;
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
@@ -41,50 +24,40 @@ __markAsModule(exports);
|
|
|
41
24
|
__export(exports, {
|
|
42
25
|
activate: () => activate
|
|
43
26
|
});
|
|
44
|
-
var
|
|
45
|
-
var
|
|
27
|
+
var import_vscode = __toModule(require("vscode"));
|
|
28
|
+
var import_node = __toModule(require("vscode-languageclient/node"));
|
|
46
29
|
var import_autoClose = __toModule(require("./html/autoClose.js"));
|
|
47
|
-
|
|
48
|
-
const TagCloseRequest = new lsp.RequestType("html/tag");
|
|
30
|
+
const TagCloseRequest = new import_node.RequestType("html/tag");
|
|
49
31
|
async function activate(context) {
|
|
50
|
-
docClient = createLanguageService(context, "doc", "astro", "Astro", 6040);
|
|
51
|
-
await docClient.onReady();
|
|
52
|
-
}
|
|
53
|
-
function createLanguageService(context, mode, id, name, port) {
|
|
54
|
-
const {workspace} = vscode;
|
|
55
32
|
const serverModule = require.resolve("@astrojs/language-server/bin/server.js");
|
|
33
|
+
const port = 6040;
|
|
56
34
|
const debugOptions = {execArgv: ["--nolazy", "--inspect=" + port]};
|
|
57
35
|
const serverOptions = {
|
|
58
|
-
run: {module: serverModule, transport:
|
|
36
|
+
run: {module: serverModule, transport: import_node.TransportKind.ipc},
|
|
59
37
|
debug: {
|
|
60
38
|
module: serverModule,
|
|
61
|
-
transport:
|
|
39
|
+
transport: import_node.TransportKind.ipc,
|
|
62
40
|
options: debugOptions
|
|
63
41
|
}
|
|
64
42
|
};
|
|
65
|
-
const serverInitOptions = {
|
|
66
|
-
mode,
|
|
67
|
-
appRoot: vscode.env.appRoot,
|
|
68
|
-
language: vscode.env.language
|
|
69
|
-
};
|
|
70
43
|
const clientOptions = {
|
|
71
44
|
documentSelector: [{scheme: "file", language: "astro"}],
|
|
72
45
|
synchronize: {
|
|
73
46
|
configurationSection: ["astro", "javascript", "typescript", "prettier"],
|
|
74
|
-
fileEvents: workspace.createFileSystemWatcher("{**/*.js,**/*.ts}", false, false, false)
|
|
47
|
+
fileEvents: import_vscode.workspace.createFileSystemWatcher("{**/*.js,**/*.ts}", false, false, false)
|
|
75
48
|
},
|
|
76
|
-
initializationOptions:
|
|
49
|
+
initializationOptions: {
|
|
77
50
|
configuration: {
|
|
78
|
-
astro: workspace.getConfiguration("astro"),
|
|
79
|
-
prettier: workspace.getConfiguration("prettier"),
|
|
80
|
-
emmet: workspace.getConfiguration("emmet"),
|
|
81
|
-
typescript: workspace.getConfiguration("typescript"),
|
|
82
|
-
javascript: workspace.getConfiguration("javascript")
|
|
51
|
+
astro: import_vscode.workspace.getConfiguration("astro"),
|
|
52
|
+
prettier: import_vscode.workspace.getConfiguration("prettier"),
|
|
53
|
+
emmet: import_vscode.workspace.getConfiguration("emmet"),
|
|
54
|
+
typescript: import_vscode.workspace.getConfiguration("typescript"),
|
|
55
|
+
javascript: import_vscode.workspace.getConfiguration("javascript")
|
|
83
56
|
},
|
|
84
57
|
dontFilterIncompleteCompletions: true
|
|
85
|
-
}
|
|
58
|
+
}
|
|
86
59
|
};
|
|
87
|
-
|
|
60
|
+
let client = createLanguageServer(serverOptions, clientOptions);
|
|
88
61
|
context.subscriptions.push(client.start());
|
|
89
62
|
client.onReady().then(() => {
|
|
90
63
|
const tagRequestor = (document, position) => {
|
|
@@ -96,10 +69,43 @@ function createLanguageService(context, mode, id, name, port) {
|
|
|
96
69
|
}).catch((err) => {
|
|
97
70
|
console.error("Astro, unable to load language server.", err);
|
|
98
71
|
});
|
|
99
|
-
|
|
72
|
+
import_vscode.workspace.onDidSaveTextDocument(async (doc) => {
|
|
73
|
+
var _a;
|
|
74
|
+
const fileName = (_a = doc.fileName.split(/\/|\\/).pop()) != null ? _a : doc.fileName;
|
|
75
|
+
if ([/^tsconfig\.json$/, /^jsconfig\.json$/, /^astro\.config\.(js|cjs|mjs|ts)$/].some((regex) => regex.test(fileName))) {
|
|
76
|
+
await restartClient(false);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
context.subscriptions.push(import_vscode.commands.registerCommand("astro.restartLanguageServer", async () => {
|
|
80
|
+
await restartClient(true);
|
|
81
|
+
}));
|
|
82
|
+
let restartingClient = false;
|
|
83
|
+
async function restartClient(showNotification) {
|
|
84
|
+
if (restartingClient) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
restartingClient = true;
|
|
88
|
+
await client.stop();
|
|
89
|
+
client = createLanguageServer(serverOptions, clientOptions);
|
|
90
|
+
context.subscriptions.push(client.start());
|
|
91
|
+
await client.onReady();
|
|
92
|
+
if (showNotification) {
|
|
93
|
+
import_vscode.window.showInformationMessage("Astro language server restarted.");
|
|
94
|
+
}
|
|
95
|
+
restartingClient = false;
|
|
96
|
+
}
|
|
97
|
+
function getLSClient() {
|
|
98
|
+
return client;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
getLanguageServer: getLSClient
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function createLanguageServer(serverOptions, clientOptions) {
|
|
105
|
+
return new import_node.LanguageClient("astro", "Astro", serverOptions, clientOptions);
|
|
100
106
|
}
|
|
101
107
|
// Annotate the CommonJS export names for ESM import in node:
|
|
102
108
|
0 && (module.exports = {
|
|
103
109
|
activate
|
|
104
110
|
});
|
|
105
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
111
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2luZGV4LnR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BQUEsSUFDTixtQkFBbUI7QUFBQTtBQUFBO0FBSXJCLDhCQUE4QixlQUE4QixlQUFzQztBQUNqRyxTQUFPLElBQUksMkJBQWUsU0FBUyxTQUFTLGVBQWU7QUFBQTsiLAogICJuYW1lcyI6IFtdCn0K
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"color": "#FFBE2D",
|
|
9
9
|
"theme": "dark"
|
|
10
10
|
},
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.9.1",
|
|
12
12
|
"author": "withastro",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"publisher": "astro-build",
|
|
@@ -24,10 +24,8 @@
|
|
|
24
24
|
"onLanguage:astro"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@astrojs/language-server": "0.
|
|
28
|
-
"@astrojs/ts-plugin": "0.
|
|
29
|
-
"vscode-emmet-helper": "2.1.2",
|
|
30
|
-
"vscode-html-languageservice": "^3.0.3",
|
|
27
|
+
"@astrojs/language-server": "0.9.1",
|
|
28
|
+
"@astrojs/ts-plugin": "0.2.0",
|
|
31
29
|
"vscode-languageclient": "~7.0.0"
|
|
32
30
|
},
|
|
33
31
|
"devDependencies": {
|
|
@@ -53,6 +51,12 @@
|
|
|
53
51
|
"enableForWorkspaceTypeScriptVersions": true
|
|
54
52
|
}
|
|
55
53
|
],
|
|
54
|
+
"commands": [
|
|
55
|
+
{
|
|
56
|
+
"command": "astro.restartLanguageServer",
|
|
57
|
+
"title": "Astro: Restart Language Server"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
56
60
|
"configuration": {
|
|
57
61
|
"type": "object",
|
|
58
62
|
"title": "Astro configuration",
|