@volar/vscode 2.4.0-alpha.8 → 2.4.0
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 +0 -1
- package/index.js +1 -3
- package/lib/features/autoInsertion.js +3 -3
- package/package.json +4 -3
- package/lib/features/serverSys.d.ts +0 -3
- package/lib/features/serverSys.js +0 -96
package/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export { activate as activateWriteVirtualFiles } from './lib/features/writeVirtu
|
|
|
5
5
|
export { activate as activateFindFileReferences } from './lib/features/fileReferences';
|
|
6
6
|
export { activate as activateReloadProjects } from './lib/features/reloadProject';
|
|
7
7
|
export { activate as activateTsConfigStatusItem } from './lib/features/tsconfig';
|
|
8
|
-
export { activate as activateServerSys } from './lib/features/serverSys';
|
|
9
8
|
export { activate as activateTsVersionStatusItem, getTsdk } from './lib/features/tsVersion';
|
|
10
9
|
export * from 'vscode-languageclient';
|
|
11
10
|
import type { BaseLanguageClient, Middleware } from 'vscode-languageclient';
|
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.currentLabsVersion = exports.middleware = exports.getTsdk = exports.activateTsVersionStatusItem = exports.
|
|
17
|
+
exports.currentLabsVersion = exports.middleware = exports.getTsdk = exports.activateTsVersionStatusItem = exports.activateTsConfigStatusItem = exports.activateReloadProjects = exports.activateFindFileReferences = exports.activateWriteVirtualFiles = exports.activateDocumentDropEdit = exports.activateAutoInsertion = void 0;
|
|
18
18
|
exports.parseServerCommand = parseServerCommand;
|
|
19
19
|
exports.createLabsInfo = createLabsInfo;
|
|
20
20
|
const vscode = require("vscode");
|
|
@@ -30,8 +30,6 @@ var reloadProject_1 = require("./lib/features/reloadProject");
|
|
|
30
30
|
Object.defineProperty(exports, "activateReloadProjects", { enumerable: true, get: function () { return reloadProject_1.activate; } });
|
|
31
31
|
var tsconfig_1 = require("./lib/features/tsconfig");
|
|
32
32
|
Object.defineProperty(exports, "activateTsConfigStatusItem", { enumerable: true, get: function () { return tsconfig_1.activate; } });
|
|
33
|
-
var serverSys_1 = require("./lib/features/serverSys");
|
|
34
|
-
Object.defineProperty(exports, "activateServerSys", { enumerable: true, get: function () { return serverSys_1.activate; } });
|
|
35
33
|
var tsVersion_1 = require("./lib/features/tsVersion");
|
|
36
34
|
Object.defineProperty(exports, "activateTsVersionStatusItem", { enumerable: true, get: function () { return tsVersion_1.activate; } });
|
|
37
35
|
Object.defineProperty(exports, "getTsdk", { enumerable: true, get: function () { return tsVersion_1.getTsdk; } });
|
|
@@ -38,9 +38,9 @@ function activate(selector, client) {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
const lastCharacter = lastChange.text[lastChange.text.length - 1];
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const { triggerCharacters, configurationSections } =
|
|
41
|
+
const capabilities = client.initializeResult?.capabilities;
|
|
42
|
+
if (capabilities?.experimental?.autoInsertionProvider) {
|
|
43
|
+
const { triggerCharacters, configurationSections } = capabilities.experimental.autoInsertionProvider;
|
|
44
44
|
for (let i = 0; i < triggerCharacters.length; i++) {
|
|
45
45
|
const char = triggerCharacters[i];
|
|
46
46
|
const sections = configurationSections?.[i];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/vscode",
|
|
3
|
-
"version": "2.4.0
|
|
3
|
+
"version": "2.4.0",
|
|
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.4.0
|
|
15
|
+
"@volar/language-server": "2.4.0",
|
|
16
16
|
"path-browserify": "^1.0.1",
|
|
17
17
|
"vscode-languageclient": "^9.0.1",
|
|
18
18
|
"vscode-nls": "^5.2.0"
|
|
@@ -21,5 +21,6 @@
|
|
|
21
21
|
"@types/node": "latest",
|
|
22
22
|
"@types/path-browserify": "latest",
|
|
23
23
|
"@types/vscode": "^1.82.0"
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
|
+
"gitHead": "7e98885cfe284451e655cf1c3954786b51aea2f8"
|
|
25
26
|
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.activate = activate;
|
|
4
|
-
const vscode = require("vscode");
|
|
5
|
-
const protocol_1 = require("@volar/language-server/protocol");
|
|
6
|
-
const fs = require("../fs");
|
|
7
|
-
function activate(client) {
|
|
8
|
-
const subscriptions = [];
|
|
9
|
-
const jobs = new Map();
|
|
10
|
-
const progressAssets = new Set();
|
|
11
|
-
let startProgress = false;
|
|
12
|
-
let totalJobs = 0;
|
|
13
|
-
addRequestHandlers();
|
|
14
|
-
subscriptions.push(client.onDidChangeState(() => {
|
|
15
|
-
if (client.state === 2) {
|
|
16
|
-
addRequestHandlers();
|
|
17
|
-
}
|
|
18
|
-
}));
|
|
19
|
-
return vscode.Disposable.from(...subscriptions);
|
|
20
|
-
// To avoid hitting the API hourly limit, we keep requests as low as possible.
|
|
21
|
-
function addRequestHandlers() {
|
|
22
|
-
subscriptions.push(client.onRequest(protocol_1.FsStatRequest.type, stat));
|
|
23
|
-
subscriptions.push(client.onRequest(protocol_1.FsReadFileRequest.type, uri => {
|
|
24
|
-
return withProgress(() => readFile(uri), uri);
|
|
25
|
-
}));
|
|
26
|
-
subscriptions.push(client.onRequest(protocol_1.FsReadDirectoryRequest.type, uri => {
|
|
27
|
-
return withProgress(() => readDirectory(uri), uri);
|
|
28
|
-
}));
|
|
29
|
-
async function withProgress(fn, asset) {
|
|
30
|
-
if (progressAssets.has(asset)) {
|
|
31
|
-
return await fn();
|
|
32
|
-
}
|
|
33
|
-
progressAssets.add(asset);
|
|
34
|
-
asset = vscode.Uri.parse(asset).path;
|
|
35
|
-
totalJobs++;
|
|
36
|
-
let job;
|
|
37
|
-
try {
|
|
38
|
-
job = fn();
|
|
39
|
-
jobs.set(job, asset);
|
|
40
|
-
if (!startProgress && jobs.size >= 2) {
|
|
41
|
-
startProgress = true;
|
|
42
|
-
vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, async (progress) => {
|
|
43
|
-
progress.report({
|
|
44
|
-
message: `Loading ${totalJobs} resources: ${asset}`
|
|
45
|
-
});
|
|
46
|
-
while (jobs.size) {
|
|
47
|
-
for (const [_, asset] of jobs) {
|
|
48
|
-
progress.report({
|
|
49
|
-
message: `Loading ${totalJobs} resources: ${asset}`,
|
|
50
|
-
});
|
|
51
|
-
await sleep(100);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
startProgress = false;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return await job;
|
|
59
|
-
}
|
|
60
|
-
finally {
|
|
61
|
-
jobs.delete(job);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function stat(uri) {
|
|
65
|
-
// return early
|
|
66
|
-
const dirUri = uri.substring(0, uri.lastIndexOf('/'));
|
|
67
|
-
const baseName = uri.substring(uri.lastIndexOf('/') + 1);
|
|
68
|
-
const entries = await readDirectory(dirUri);
|
|
69
|
-
if (!entries.some(entry => entry[0] === baseName)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const uri2 = client.protocol2CodeConverter.asUri(uri);
|
|
73
|
-
return await fs.stat(uri2);
|
|
74
|
-
}
|
|
75
|
-
async function readFile(uri) {
|
|
76
|
-
// return early
|
|
77
|
-
const dirUri = uri.substring(0, uri.lastIndexOf('/'));
|
|
78
|
-
const baseName = uri.substring(uri.lastIndexOf('/') + 1);
|
|
79
|
-
const entries = await readDirectory(dirUri);
|
|
80
|
-
const uri2 = client.protocol2CodeConverter.asUri(uri);
|
|
81
|
-
if (!entries.some(entry => entry[0] === baseName && entry[1] === vscode.FileType.File)) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
return await fs.readFile(uri2);
|
|
85
|
-
}
|
|
86
|
-
async function readDirectory(uri) {
|
|
87
|
-
const uri2 = client.protocol2CodeConverter.asUri(uri);
|
|
88
|
-
return await (await fs.readDirectory(uri2))
|
|
89
|
-
.filter(([name]) => !name.startsWith('.'));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function sleep(ms) {
|
|
94
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=serverSys.js.map
|