@volar/vscode 2.0.0-alpha.3 → 2.0.0-alpha.5
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/index.d.ts +2 -2
- package/index.js +1 -11
- package/lib/features/autoInsertion.d.ts +1 -1
- package/lib/features/autoInsertion.js +18 -20
- package/lib/features/reloadProject.d.ts +1 -1
- package/lib/features/reloadProject.js +2 -4
- package/lib/features/tsVersion.d.ts +1 -1
- package/lib/features/tsVersion.js +2 -2
- package/lib/features/tsconfig.d.ts +1 -1
- package/lib/features/tsconfig.js +2 -2
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export * from 'vscode-languageclient';
|
|
|
11
11
|
import type { BaseLanguageClient, Middleware } from 'vscode-languageclient';
|
|
12
12
|
export declare const middleware: Middleware;
|
|
13
13
|
export declare function parseServerCommand(command: vscode.Command): vscode.Command;
|
|
14
|
-
export declare const supportLabsVersion
|
|
14
|
+
export declare const supportLabsVersion = "2.0.0-alpha.3";
|
|
15
15
|
export interface ExportsInfoForLabs {
|
|
16
16
|
volarLabs: {
|
|
17
17
|
version: typeof supportLabsVersion;
|
|
18
|
-
|
|
18
|
+
languageClient: BaseLanguageClient;
|
|
19
19
|
languageServerProtocol: typeof import('@volar/language-server/protocol');
|
|
20
20
|
codegenStackSupport?: boolean;
|
|
21
21
|
};
|
package/index.js
CHANGED
|
@@ -35,16 +35,6 @@ Object.defineProperty(exports, "activateTsVersionStatusItem", { enumerable: true
|
|
|
35
35
|
Object.defineProperty(exports, "getTsdk", { enumerable: true, get: function () { return tsVersion_1.getTsdk; } });
|
|
36
36
|
__exportStar(require("vscode-languageclient"), exports);
|
|
37
37
|
exports.middleware = {
|
|
38
|
-
async provideHover(document, position, token, next) {
|
|
39
|
-
const hover = await next(document, position, token);
|
|
40
|
-
for (const content of hover?.contents ?? []) {
|
|
41
|
-
if (content instanceof vscode.MarkdownString) {
|
|
42
|
-
content.isTrusted = true;
|
|
43
|
-
content.supportHtml = true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return hover;
|
|
47
|
-
},
|
|
48
38
|
async provideCodeActions(document, range, context, token, next) {
|
|
49
39
|
let actions = await next(document, range, context, token);
|
|
50
40
|
actions = actions?.map(action => {
|
|
@@ -106,5 +96,5 @@ function parseServerCommand(command) {
|
|
|
106
96
|
return command;
|
|
107
97
|
}
|
|
108
98
|
exports.parseServerCommand = parseServerCommand;
|
|
109
|
-
exports.supportLabsVersion = 2.0;
|
|
99
|
+
exports.supportLabsVersion = '2.0.0-alpha.3';
|
|
110
100
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode';
|
|
2
2
|
import type { BaseLanguageClient } from 'vscode-languageclient';
|
|
3
|
-
export declare function activate(
|
|
3
|
+
export declare function activate(selector: vscode.DocumentSelector, client: BaseLanguageClient): vscode.Disposable;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.activate = void 0;
|
|
4
4
|
const vscode = require("vscode");
|
|
5
5
|
const protocol_1 = require("@volar/language-server/protocol");
|
|
6
|
-
function activate(
|
|
6
|
+
function activate(selector, client) {
|
|
7
7
|
let isEnabled = false;
|
|
8
8
|
let timeout;
|
|
9
9
|
updateEnabledState();
|
|
@@ -17,7 +17,7 @@ function activate(clients, active) {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
let document = editor.document;
|
|
20
|
-
if (!
|
|
20
|
+
if (!vscode.languages.match(selector, document)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
isEnabled = true;
|
|
@@ -32,24 +32,22 @@ function activate(clients, active) {
|
|
|
32
32
|
}
|
|
33
33
|
const lastChange = contentChanges[contentChanges.length - 1];
|
|
34
34
|
doAutoInsert(document, lastChange, async (document, position, lastChange, isCancel) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return client.protocol2CodeConverter.asTextEdit(result);
|
|
52
|
-
}
|
|
35
|
+
const params = {
|
|
36
|
+
...client.code2ProtocolConverter.asTextDocumentPositionParams(document, position),
|
|
37
|
+
lastChange: {
|
|
38
|
+
text: lastChange.text,
|
|
39
|
+
range: client.code2ProtocolConverter.asRange(lastChange.range),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
if (isCancel())
|
|
43
|
+
return;
|
|
44
|
+
const result = await client.sendRequest(protocol_1.AutoInsertRequest.type, params);
|
|
45
|
+
if (result !== undefined && result !== null) {
|
|
46
|
+
if (typeof result === 'string') {
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return client.protocol2CodeConverter.asTextEdit(result);
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode';
|
|
2
2
|
import type { BaseLanguageClient } from 'vscode-languageclient';
|
|
3
|
-
export declare function activate(cmd: string,
|
|
3
|
+
export declare function activate(cmd: string, client: BaseLanguageClient): vscode.Disposable;
|
|
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.activate = void 0;
|
|
4
4
|
const vscode = require("vscode");
|
|
5
5
|
const protocol_1 = require("@volar/language-server/protocol");
|
|
6
|
-
function activate(cmd,
|
|
6
|
+
function activate(cmd, client) {
|
|
7
7
|
return vscode.commands.registerCommand(cmd, () => {
|
|
8
8
|
if (vscode.window.activeTextEditor) {
|
|
9
|
-
|
|
10
|
-
client.sendNotification(protocol_1.ReloadProjectNotification.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
|
|
11
|
-
}
|
|
9
|
+
client.sendNotification(protocol_1.ReloadProjectNotification.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
|
|
12
10
|
}
|
|
13
11
|
});
|
|
14
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vscode from 'vscode';
|
|
2
2
|
import type { BaseLanguageClient } from 'vscode-languageclient';
|
|
3
|
-
export declare function activate(cmd: string, context: vscode.ExtensionContext, client: BaseLanguageClient,
|
|
3
|
+
export declare function activate(selector: vscode.DocumentSelector, cmd: string, context: vscode.ExtensionContext, client: BaseLanguageClient, resolveStatusText: (text: string) => string): vscode.Disposable;
|
|
4
4
|
export declare function getTsdk(context: vscode.ExtensionContext): Promise<{
|
|
5
5
|
tsdk: string;
|
|
6
6
|
version: string | undefined;
|
|
@@ -5,7 +5,7 @@ const path = require("path-browserify");
|
|
|
5
5
|
const vscode = require("vscode");
|
|
6
6
|
const common_1 = require("../common");
|
|
7
7
|
const defaultTsdkPath = 'node_modules/typescript/lib';
|
|
8
|
-
function activate(cmd, context, client,
|
|
8
|
+
function activate(selector, cmd, context, client, resolveStatusText) {
|
|
9
9
|
const subscriptions = [];
|
|
10
10
|
const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
|
11
11
|
statusBar.command = cmd;
|
|
@@ -58,7 +58,7 @@ function activate(cmd, context, client, shouldStatusBarShow, resolveStatusText)
|
|
|
58
58
|
}
|
|
59
59
|
async function updateStatusBar() {
|
|
60
60
|
if (!vscode.window.activeTextEditor
|
|
61
|
-
|| !
|
|
61
|
+
|| !vscode.languages.match(selector, vscode.window.activeTextEditor.document)) {
|
|
62
62
|
statusBar.hide();
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode';
|
|
2
2
|
import type { BaseLanguageClient } from 'vscode-languageclient';
|
|
3
|
-
export declare function activate(cmd: string, client: BaseLanguageClient
|
|
3
|
+
export declare function activate(selector: vscode.DocumentSelector, cmd: string, client: BaseLanguageClient): void;
|
package/lib/features/tsconfig.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.activate = void 0;
|
|
|
4
4
|
const vscode = require("vscode");
|
|
5
5
|
const protocol_1 = require("@volar/language-server/protocol");
|
|
6
6
|
const path = require("path-browserify");
|
|
7
|
-
function activate(cmd, client
|
|
7
|
+
function activate(selector, cmd, client) {
|
|
8
8
|
const subscriptions = [];
|
|
9
9
|
const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
|
10
10
|
let currentTsconfigUri;
|
|
@@ -19,7 +19,7 @@ function activate(cmd, client, shouldStatusBarShow) {
|
|
|
19
19
|
subscriptions.push(...subscriptions);
|
|
20
20
|
async function updateStatusBar() {
|
|
21
21
|
if (!vscode.window.activeTextEditor
|
|
22
|
-
|| !
|
|
22
|
+
|| !vscode.languages.match(selector, vscode.window.activeTextEditor.document)) {
|
|
23
23
|
statusBar.hide();
|
|
24
24
|
}
|
|
25
25
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/vscode",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"directory": "packages/vscode"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-server": "2.0.0-alpha.
|
|
15
|
+
"@volar/language-server": "2.0.0-alpha.5",
|
|
16
16
|
"path-browserify": "^1.0.1",
|
|
17
17
|
"vscode-languageclient": "^9.0.1",
|
|
18
18
|
"vscode-nls": "^5.2.0"
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@types/path-browserify": "latest",
|
|
23
23
|
"@types/vscode": "^1.82.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "80f4f8791c304fbcf4a0a8425eae8ea0b5ab739c"
|
|
26
26
|
}
|