@volar/vscode 1.5.4 → 1.6.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/out/features/showVirtualFiles.d.ts +1 -1
- package/out/features/showVirtualFiles.js +30 -21
- package/out/index.d.ts +8 -1
- package/out/index.js +5 -3
- package/package.json +4 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode';
|
|
2
2
|
import { BaseLanguageClient } from 'vscode-languageclient';
|
|
3
|
-
export declare function activate(
|
|
3
|
+
export declare function activate(_cmd: string, client: BaseLanguageClient): Promise<vscode.Disposable>;
|
|
@@ -29,8 +29,9 @@ const mappingSelectionDecorationType = vscode.window.createTextEditorDecorationT
|
|
|
29
29
|
backgroundColor: 'darkblue'
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
async function activate(
|
|
33
|
-
|
|
32
|
+
async function activate(_cmd, client) {
|
|
33
|
+
const subscriptions = [];
|
|
34
|
+
subscriptions.push(vscode.languages.registerHoverProvider({ scheme }, {
|
|
34
35
|
async provideHover(document, position, _token) {
|
|
35
36
|
const maps = virtualUriToSourceMap.get(document.uri.toString());
|
|
36
37
|
if (!maps)
|
|
@@ -56,12 +57,31 @@ async function activate(cmd, client) {
|
|
|
56
57
|
'```',
|
|
57
58
|
].join('\n')));
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
}));
|
|
61
|
+
subscriptions.push(vscode.languages.registerDefinitionProvider({ scheme }, {
|
|
62
|
+
async provideDefinition(document, position, _token) {
|
|
63
|
+
const stacks = virtualUriToStacks.get(document.uri.toString());
|
|
64
|
+
if (!stacks)
|
|
65
|
+
return;
|
|
66
|
+
const offset = document.offsetAt(position);
|
|
67
|
+
const stack = stacks.find(stack => stack.range[0] <= offset && offset <= stack.range[1]);
|
|
68
|
+
if (!stack)
|
|
69
|
+
return;
|
|
70
|
+
const line = Number(stack.source.split(':').at(-2));
|
|
71
|
+
const character = Number(stack.source.split(':').at(-1));
|
|
72
|
+
const fileName = stack.source.split(':').slice(0, -2).join(':');
|
|
73
|
+
const link = {
|
|
74
|
+
originSelectionRange: new vscode.Range(document.positionAt(stack.range[0]), document.positionAt(stack.range[1])),
|
|
75
|
+
targetUri: vscode.Uri.file(fileName),
|
|
76
|
+
targetRange: new vscode.Range(line - 1, character - 1, line - 1, character - 1),
|
|
77
|
+
};
|
|
78
|
+
return [link];
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
62
81
|
const sourceUriToVirtualUris = new Map();
|
|
63
82
|
const virtualUriToSourceEditor = new Map();
|
|
64
83
|
const virtualUriToSourceMap = new Map();
|
|
84
|
+
const virtualUriToStacks = new Map();
|
|
65
85
|
const docChangeEvent = new vscode.EventEmitter();
|
|
66
86
|
const virtualDocuments = new Map();
|
|
67
87
|
let updateVirtualDocument;
|
|
@@ -86,9 +106,9 @@ async function activate(cmd, client) {
|
|
|
86
106
|
const fileName = uri.with({ scheme: 'file' }).fsPath;
|
|
87
107
|
const requestEditor = virtualUriToSourceEditor.get(uri.toString());
|
|
88
108
|
if (requestEditor) {
|
|
89
|
-
const
|
|
109
|
+
const virtualFile = await client.sendRequest(language_server_1.GetVirtualFileRequest.type, { sourceFileUri: requestEditor.document.uri.toString(), virtualFileName: fileName });
|
|
90
110
|
virtualUriToSourceMap.set(uri.toString(), []);
|
|
91
|
-
Object.entries(
|
|
111
|
+
Object.entries(virtualFile.mappings).forEach(([sourceUri, mappings]) => {
|
|
92
112
|
const sourceEditor = vscode.window.visibleTextEditors.find(editor => editor.document.uri.toString() === sourceUri);
|
|
93
113
|
if (sourceEditor) {
|
|
94
114
|
virtualUriToSourceMap.get(uri.toString())?.push([
|
|
@@ -102,22 +122,11 @@ async function activate(cmd, client) {
|
|
|
102
122
|
sourceUriToVirtualUris.get(sourceUri)?.add(uri.toString());
|
|
103
123
|
}
|
|
104
124
|
});
|
|
105
|
-
virtualDocuments.set(uri.toString(), vscode_languageclient_1.TextDocument.create('', '', 0,
|
|
125
|
+
virtualDocuments.set(uri.toString(), vscode_languageclient_1.TextDocument.create('', '', 0, virtualFile.content));
|
|
126
|
+
virtualUriToStacks.set(uri.toString(), virtualFile.codegenStacks);
|
|
106
127
|
clearTimeout(updateDecorationsTimeout);
|
|
107
128
|
updateDecorationsTimeout = setTimeout(updateDecorations, 100);
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}));
|
|
112
|
-
subscriptions.push(vscode.commands.registerCommand(cmd, async () => {
|
|
113
|
-
const sourceEditor = vscode.window.activeTextEditor;
|
|
114
|
-
if (sourceEditor) {
|
|
115
|
-
const fileNames = await client.sendRequest(language_server_1.GetVirtualFileNamesRequest.type, client.code2ProtocolConverter.asTextDocumentIdentifier(sourceEditor.document));
|
|
116
|
-
const uris = fileNames.map(fileName => vscode.Uri.file(fileName).with({ scheme }));
|
|
117
|
-
sourceUriToVirtualUris.set(sourceEditor.document.uri.toString(), new Set(uris.map(uri => uri.toString())));
|
|
118
|
-
for (const uri of uris) {
|
|
119
|
-
virtualUriToSourceEditor.set(uri.toString(), sourceEditor);
|
|
120
|
-
vscode.window.showTextDocument(uri, { viewColumn: vscode.ViewColumn.Two, preview: false });
|
|
129
|
+
return virtualFile.content;
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
}));
|
package/out/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as vscode from 'vscode';
|
|
2
2
|
export { activate as activateAutoInsertion } from './features/autoInsertion';
|
|
3
|
-
export { activate as activateShowVirtualFiles } from './features/showVirtualFiles';
|
|
4
3
|
export { activate as activateWriteVirtualFiles } from './features/writeVirtualFiles';
|
|
5
4
|
export { activate as activateFindFileReferences } from './features/fileReferences';
|
|
6
5
|
export { activate as activateReloadProjects } from './features/reloadProject';
|
|
@@ -12,3 +11,11 @@ export declare function takeOverModeActive(context: vscode.ExtensionContext): bo
|
|
|
12
11
|
import * as lsp from 'vscode-languageclient';
|
|
13
12
|
export declare const middleware: lsp.Middleware;
|
|
14
13
|
export declare function parseServerCommand(command: vscode.Command): vscode.Command;
|
|
14
|
+
export interface Exports {
|
|
15
|
+
codegenStackSupport?: boolean;
|
|
16
|
+
languageClients: lsp.BaseLanguageClient[];
|
|
17
|
+
serverLib: typeof import('@volar/language-server');
|
|
18
|
+
}
|
|
19
|
+
export declare function createExports(exports: Exports): {
|
|
20
|
+
volar: Exports;
|
|
21
|
+
};
|
package/out/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseServerCommand = exports.middleware = exports.takeOverModeActive = exports.getTsdk = exports.activateTsVersionStatusItem = exports.activateServerSys = exports.activateTsConfigStatusItem = exports.activateServerStats = exports.activateReloadProjects = exports.activateFindFileReferences = exports.activateWriteVirtualFiles = exports.
|
|
3
|
+
exports.createExports = exports.parseServerCommand = exports.middleware = exports.takeOverModeActive = exports.getTsdk = exports.activateTsVersionStatusItem = exports.activateServerSys = exports.activateTsConfigStatusItem = exports.activateServerStats = exports.activateReloadProjects = exports.activateFindFileReferences = exports.activateWriteVirtualFiles = exports.activateAutoInsertion = void 0;
|
|
4
4
|
const vscode = require("vscode");
|
|
5
5
|
var autoInsertion_1 = require("./features/autoInsertion");
|
|
6
6
|
Object.defineProperty(exports, "activateAutoInsertion", { enumerable: true, get: function () { return autoInsertion_1.activate; } });
|
|
7
|
-
var showVirtualFiles_1 = require("./features/showVirtualFiles");
|
|
8
|
-
Object.defineProperty(exports, "activateShowVirtualFiles", { enumerable: true, get: function () { return showVirtualFiles_1.activate; } });
|
|
9
7
|
var writeVirtualFiles_1 = require("./features/writeVirtualFiles");
|
|
10
8
|
Object.defineProperty(exports, "activateWriteVirtualFiles", { enumerable: true, get: function () { return writeVirtualFiles_1.activate; } });
|
|
11
9
|
var fileReferences_1 = require("./features/fileReferences");
|
|
@@ -100,4 +98,8 @@ function parseServerCommand(command) {
|
|
|
100
98
|
return command;
|
|
101
99
|
}
|
|
102
100
|
exports.parseServerCommand = parseServerCommand;
|
|
101
|
+
function createExports(exports) {
|
|
102
|
+
return { volar: exports };
|
|
103
|
+
}
|
|
104
|
+
exports.createExports = createExports;
|
|
103
105
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/vscode",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"directory": "packages/vscode"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-server": "1.
|
|
17
|
-
"@volar/source-map": "1.
|
|
16
|
+
"@volar/language-server": "1.6.1",
|
|
17
|
+
"@volar/source-map": "1.6.1",
|
|
18
18
|
"typesafe-path": "^0.2.2",
|
|
19
19
|
"vscode-nls": "^5.2.0"
|
|
20
20
|
},
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"@types/vscode": "*",
|
|
27
27
|
"vscode-languageclient": "*"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1e1e99f43ff39db5432a33c8013eda706e765001"
|
|
30
30
|
}
|