@volar/vscode 2.0.0-alpha.2 → 2.0.0-alpha.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/index.d.ts +2 -3
- package/index.js +2 -19
- 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 -11
- 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
|
@@ -8,15 +8,14 @@ export { activate as activateTsConfigStatusItem } from './lib/features/tsconfig'
|
|
|
8
8
|
export { activate as activateServerSys } from './lib/features/serverSys';
|
|
9
9
|
export { activate as activateTsVersionStatusItem, getTsdk } from './lib/features/tsVersion';
|
|
10
10
|
export * from 'vscode-languageclient';
|
|
11
|
-
export declare function takeOverModeActive(context: vscode.ExtensionContext): boolean;
|
|
12
11
|
import type { BaseLanguageClient, Middleware } from 'vscode-languageclient';
|
|
13
12
|
export declare const middleware: Middleware;
|
|
14
13
|
export declare function parseServerCommand(command: vscode.Command): vscode.Command;
|
|
15
|
-
export declare const supportLabsVersion
|
|
14
|
+
export declare const supportLabsVersion = "2.0.0-alpha.3";
|
|
16
15
|
export interface ExportsInfoForLabs {
|
|
17
16
|
volarLabs: {
|
|
18
17
|
version: typeof supportLabsVersion;
|
|
19
|
-
|
|
18
|
+
languageClient: BaseLanguageClient;
|
|
20
19
|
languageServerProtocol: typeof import('@volar/language-server/protocol');
|
|
21
20
|
codegenStackSupport?: boolean;
|
|
22
21
|
};
|
package/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.supportLabsVersion = exports.parseServerCommand = exports.middleware = exports.
|
|
17
|
+
exports.supportLabsVersion = exports.parseServerCommand = exports.middleware = exports.getTsdk = exports.activateTsVersionStatusItem = exports.activateServerSys = exports.activateTsConfigStatusItem = exports.activateReloadProjects = exports.activateFindFileReferences = exports.activateWriteVirtualFiles = exports.activateDocumentDropEdit = exports.activateAutoInsertion = void 0;
|
|
18
18
|
const vscode = require("vscode");
|
|
19
19
|
var autoInsertion_1 = require("./lib/features/autoInsertion");
|
|
20
20
|
Object.defineProperty(exports, "activateAutoInsertion", { enumerable: true, get: function () { return autoInsertion_1.activate; } });
|
|
@@ -34,24 +34,7 @@ var tsVersion_1 = require("./lib/features/tsVersion");
|
|
|
34
34
|
Object.defineProperty(exports, "activateTsVersionStatusItem", { enumerable: true, get: function () { return tsVersion_1.activate; } });
|
|
35
35
|
Object.defineProperty(exports, "getTsdk", { enumerable: true, get: function () { return tsVersion_1.getTsdk; } });
|
|
36
36
|
__exportStar(require("vscode-languageclient"), exports);
|
|
37
|
-
function takeOverModeActive(context) {
|
|
38
|
-
if (vscode.workspace.getConfiguration('volar').get('takeOverMode.extension') === context.extension.id) {
|
|
39
|
-
return !vscode.extensions.getExtension('vscode.typescript-language-features');
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
exports.takeOverModeActive = takeOverModeActive;
|
|
44
37
|
exports.middleware = {
|
|
45
|
-
async provideHover(document, position, token, next) {
|
|
46
|
-
const hover = await next(document, position, token);
|
|
47
|
-
for (const content of hover?.contents ?? []) {
|
|
48
|
-
if (content instanceof vscode.MarkdownString) {
|
|
49
|
-
content.isTrusted = true;
|
|
50
|
-
content.supportHtml = true;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return hover;
|
|
54
|
-
},
|
|
55
38
|
async provideCodeActions(document, range, context, token, next) {
|
|
56
39
|
let actions = await next(document, range, context, token);
|
|
57
40
|
actions = actions?.map(action => {
|
|
@@ -113,5 +96,5 @@ function parseServerCommand(command) {
|
|
|
113
96
|
return command;
|
|
114
97
|
}
|
|
115
98
|
exports.parseServerCommand = parseServerCommand;
|
|
116
|
-
exports.supportLabsVersion = 2.0;
|
|
99
|
+
exports.supportLabsVersion = '2.0.0-alpha.3';
|
|
117
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;
|
|
@@ -37,19 +37,10 @@ function activate(cmd, context, client, shouldStatusBarShow, resolveStatusText,
|
|
|
37
37
|
detail: defaultTsdkPath,
|
|
38
38
|
} : undefined,
|
|
39
39
|
},
|
|
40
|
-
...(disableTakeOverMode ? [] : [{
|
|
41
|
-
takeover: {
|
|
42
|
-
label: 'What is Takeover Mode?',
|
|
43
|
-
},
|
|
44
|
-
}])
|
|
45
40
|
]);
|
|
46
41
|
if (select === undefined) {
|
|
47
42
|
return; // cancel
|
|
48
43
|
}
|
|
49
|
-
if (select === 'takeover') {
|
|
50
|
-
vscode.env.openExternal(vscode.Uri.parse('https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode'));
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
44
|
if (select === 'useDefaultWorkspaceTsdk') {
|
|
54
45
|
await vscode.workspace.getConfiguration('typescript').update('tsdk', defaultTsdkPath);
|
|
55
46
|
}
|
|
@@ -67,7 +58,7 @@ function activate(cmd, context, client, shouldStatusBarShow, resolveStatusText,
|
|
|
67
58
|
}
|
|
68
59
|
async function updateStatusBar() {
|
|
69
60
|
if (!vscode.window.activeTextEditor
|
|
70
|
-
|| !
|
|
61
|
+
|| !vscode.languages.match(selector, vscode.window.activeTextEditor.document)) {
|
|
71
62
|
statusBar.hide();
|
|
72
63
|
}
|
|
73
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.4",
|
|
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.4",
|
|
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": "4d07249613d0cc5de4197e90c741a64adf92b84b"
|
|
26
26
|
}
|