@volar/vscode 1.4.0-alpha.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-present Johnson Chu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ import * as vscode from 'vscode';
2
+ export declare function quickPick<T extends {
3
+ [K: string]: vscode.QuickPickItem | undefined;
4
+ }>(groups: T | T[], placeholder?: string): Promise<keyof T | undefined>;
package/out/common.js ADDED
@@ -0,0 +1,45 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.quickPick = void 0;
3
+ const vscode = require("vscode");
4
+ function quickPick(groups, placeholder) {
5
+ return new Promise(resolve => {
6
+ const quickPick = vscode.window.createQuickPick();
7
+ const items = [];
8
+ for (const group of Array.isArray(groups) ? groups : [groups]) {
9
+ const groupItems = Object.values(group);
10
+ if (groupItems.length) {
11
+ if (items.length) {
12
+ items.push({ label: '', kind: vscode.QuickPickItemKind.Separator });
13
+ }
14
+ for (const item of groupItems) {
15
+ if (item) {
16
+ items.push(item);
17
+ }
18
+ }
19
+ }
20
+ }
21
+ quickPick.items = items;
22
+ quickPick.placeholder = placeholder;
23
+ quickPick.onDidChangeSelection(selection => {
24
+ if (selection[0]) {
25
+ for (const options of Array.isArray(groups) ? groups : [groups]) {
26
+ for (let key in options) {
27
+ const option = options[key];
28
+ if (selection[0] === option) {
29
+ resolve(key);
30
+ quickPick.hide();
31
+ break;
32
+ }
33
+ }
34
+ }
35
+ }
36
+ });
37
+ quickPick.onDidHide(() => {
38
+ quickPick.dispose();
39
+ resolve(undefined);
40
+ });
41
+ quickPick.show();
42
+ });
43
+ }
44
+ exports.quickPick = quickPick;
45
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import type { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(clients: BaseLanguageClient[], active: (document: vscode.TextDocument) => boolean): Promise<vscode.Disposable>;
@@ -0,0 +1,100 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const language_server_1 = require("@volar/language-server");
14
+ function activate(clients, active) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ let isEnabled = false;
17
+ let timeout;
18
+ updateEnabledState();
19
+ const d1 = vscode.workspace.onDidChangeTextDocument(onDidChangeTextDocument, null);
20
+ const d2 = vscode.window.onDidChangeActiveTextEditor(updateEnabledState, null);
21
+ return vscode.Disposable.from(d1, d2);
22
+ function updateEnabledState() {
23
+ isEnabled = false;
24
+ let editor = vscode.window.activeTextEditor;
25
+ if (!editor) {
26
+ return;
27
+ }
28
+ let document = editor.document;
29
+ if (!active(document)) {
30
+ return;
31
+ }
32
+ isEnabled = true;
33
+ }
34
+ function onDidChangeTextDocument({ document, contentChanges, reason }) {
35
+ var _a;
36
+ if (!isEnabled || contentChanges.length === 0 || reason === vscode.TextDocumentChangeReason.Undo || reason === vscode.TextDocumentChangeReason.Redo) {
37
+ return;
38
+ }
39
+ const activeDocument = (_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document;
40
+ if (document !== activeDocument) {
41
+ return;
42
+ }
43
+ const lastChange = contentChanges[contentChanges.length - 1];
44
+ doAutoInsert(document, lastChange, (document, position, lastChange, isCancel) => __awaiter(this, void 0, void 0, function* () {
45
+ for (const client of clients) {
46
+ const params = Object.assign(Object.assign({}, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position)), { options: {
47
+ lastChange: Object.assign(Object.assign({}, lastChange), { range: client.code2ProtocolConverter.asRange(lastChange.range) }),
48
+ } });
49
+ if (isCancel())
50
+ return;
51
+ const result = yield client.sendRequest(language_server_1.AutoInsertRequest.type, params);
52
+ if (result !== undefined && result !== null) {
53
+ if (typeof result === 'string') {
54
+ return result;
55
+ }
56
+ else {
57
+ return client.protocol2CodeConverter.asTextEdit(result);
58
+ }
59
+ }
60
+ }
61
+ }));
62
+ }
63
+ function doAutoInsert(document, lastChange, provider) {
64
+ if (timeout) {
65
+ clearTimeout(timeout);
66
+ timeout = undefined;
67
+ }
68
+ const version = document.version;
69
+ timeout = setTimeout(() => {
70
+ const rangeStart = lastChange.range.start;
71
+ const position = new vscode.Position(rangeStart.line, rangeStart.character + lastChange.text.length);
72
+ provider(document, position, lastChange, () => { var _a; return ((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.version) !== version; }).then(text => {
73
+ if (text && isEnabled) {
74
+ const activeEditor = vscode.window.activeTextEditor;
75
+ if (activeEditor) {
76
+ const activeDocument = activeEditor.document;
77
+ if (document === activeDocument && activeDocument.version === version) {
78
+ if (typeof text === 'string') {
79
+ const selections = activeEditor.selections;
80
+ if (selections.length && selections.some(s => s.active.isEqual(position))) {
81
+ activeEditor.insertSnippet(new vscode.SnippetString(text), selections.map(s => s.active));
82
+ }
83
+ else {
84
+ activeEditor.insertSnippet(new vscode.SnippetString(text), position);
85
+ }
86
+ }
87
+ else {
88
+ activeEditor.insertSnippet(new vscode.SnippetString(text.newText), text.range);
89
+ }
90
+ }
91
+ }
92
+ }
93
+ });
94
+ timeout = undefined;
95
+ }, 100);
96
+ }
97
+ });
98
+ }
99
+ exports.activate = activate;
100
+ //# sourceMappingURL=autoInsertion.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(cmd: string, client: BaseLanguageClient): Promise<vscode.Disposable>;
@@ -0,0 +1,50 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const nls = require("vscode-nls");
14
+ const language_server_1 = require("@volar/language-server");
15
+ const localize = nls.loadMessageBundle();
16
+ function activate(cmd, client) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ return vscode.commands.registerCommand(cmd, (uri) => __awaiter(this, void 0, void 0, function* () {
19
+ // https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/fileReferences.ts
20
+ yield vscode.window.withProgress({
21
+ location: vscode.ProgressLocation.Window,
22
+ title: localize('progress.title', "Finding file references")
23
+ }, (_progress) => __awaiter(this, void 0, void 0, function* () {
24
+ var _a;
25
+ if (!uri) {
26
+ const editor = vscode.window.activeTextEditor;
27
+ if (!editor)
28
+ return;
29
+ uri = editor.document.uri;
30
+ }
31
+ const response = yield client.sendRequest(language_server_1.FindFileReferenceRequest.type, { textDocument: { uri: uri.toString() } });
32
+ if (!response) {
33
+ return;
34
+ }
35
+ const locations = response.map(loc => client.protocol2CodeConverter.asLocation(loc));
36
+ const config = vscode.workspace.getConfiguration('references');
37
+ const existingSetting = config.inspect('preferredLocation');
38
+ yield config.update('preferredLocation', 'view');
39
+ try {
40
+ yield vscode.commands.executeCommand('editor.action.showReferences', uri, new vscode.Position(0, 0), locations);
41
+ }
42
+ finally {
43
+ yield config.update('preferredLocation', (_a = existingSetting === null || existingSetting === void 0 ? void 0 : existingSetting.workspaceFolderValue) !== null && _a !== void 0 ? _a : existingSetting === null || existingSetting === void 0 ? void 0 : existingSetting.workspaceValue);
44
+ }
45
+ }));
46
+ }));
47
+ });
48
+ }
49
+ exports.activate = activate;
50
+ //# sourceMappingURL=fileReferences.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import type { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(cmd: string, clients: BaseLanguageClient[]): Promise<vscode.Disposable>;
@@ -0,0 +1,26 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const language_server_1 = require("@volar/language-server");
14
+ function activate(cmd, clients) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ return vscode.commands.registerCommand(cmd, () => {
17
+ if (vscode.window.activeTextEditor) {
18
+ for (const client of clients) {
19
+ client.sendNotification(language_server_1.ReloadProjectNotification.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
20
+ }
21
+ }
22
+ });
23
+ });
24
+ }
25
+ exports.activate = activate;
26
+ //# sourceMappingURL=reloadProject.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import type { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(cmd: string, clients: BaseLanguageClient[]): Promise<vscode.Disposable>;
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const language_server_1 = require("@volar/language-server");
14
+ function activate(cmd, clients) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ return vscode.commands.registerCommand(cmd, () => __awaiter(this, void 0, void 0, function* () {
17
+ for (const client of clients) {
18
+ yield client.sendNotification(language_server_1.ReportStats.type);
19
+ client.outputChannel.show();
20
+ }
21
+ }));
22
+ });
23
+ }
24
+ exports.activate = activate;
25
+ //# sourceMappingURL=serverStatus.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(context: vscode.ExtensionContext, client: BaseLanguageClient, cdn: string | undefined): Promise<vscode.Disposable>;
@@ -0,0 +1,61 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const vscode_languageclient_1 = require("vscode-languageclient");
14
+ const language_server_1 = require("@volar/language-server");
15
+ function activate(context, client, cdn) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const subscriptions = [];
18
+ addHandle();
19
+ subscriptions.push(client.onDidChangeState(() => {
20
+ if (client.state === vscode_languageclient_1.State.Running) {
21
+ addHandle();
22
+ }
23
+ }));
24
+ if (cdn) {
25
+ console.log('skips:', context.globalState.keys().filter(key => key.startsWith(cdn)).length);
26
+ }
27
+ return vscode.Disposable.from(...subscriptions);
28
+ function addHandle() {
29
+ subscriptions.push(client.onRequest(language_server_1.FsReadFileRequest.type, (uri) => __awaiter(this, void 0, void 0, function* () {
30
+ if (cdn && uri.startsWith(cdn) && context.globalState.get(uri) === false) {
31
+ return;
32
+ }
33
+ const uri2 = client.protocol2CodeConverter.asUri(uri);
34
+ try {
35
+ return yield vscode.workspace.fs.readFile(uri2);
36
+ }
37
+ catch (err) {
38
+ if (cdn && uri.startsWith(cdn)) {
39
+ context.globalState.update(uri, false);
40
+ }
41
+ }
42
+ })));
43
+ subscriptions.push(client.onRequest(language_server_1.FsReadDirectoryRequest.type, (uri) => __awaiter(this, void 0, void 0, function* () {
44
+ try {
45
+ if (cdn && uri.startsWith(cdn)) {
46
+ return [];
47
+ }
48
+ const uri2 = client.protocol2CodeConverter.asUri(uri);
49
+ let data = yield vscode.workspace.fs.readDirectory(uri2);
50
+ data = data.filter(([name]) => !name.startsWith('.'));
51
+ return data;
52
+ }
53
+ catch (_a) {
54
+ return [];
55
+ }
56
+ })));
57
+ }
58
+ });
59
+ }
60
+ exports.activate = activate;
61
+ //# sourceMappingURL=serverSys.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(client: BaseLanguageClient): Promise<vscode.Disposable>;
@@ -0,0 +1,36 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const vscode_languageclient_1 = require("vscode-languageclient");
14
+ const language_server_1 = require("@volar/language-server");
15
+ function activate(client) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const subscriptions = [];
18
+ addHandle();
19
+ subscriptions.push(client.onDidChangeState(() => {
20
+ if (client.state === vscode_languageclient_1.State.Running) {
21
+ addHandle();
22
+ }
23
+ }));
24
+ return vscode.Disposable.from(...subscriptions);
25
+ function addHandle() {
26
+ subscriptions.push(client.onNotification(language_server_1.ShowReferencesNotification.type, params => {
27
+ const uri = params.textDocument.uri;
28
+ const pos = params.position;
29
+ const refs = params.references;
30
+ vscode.commands.executeCommand('editor.action.showReferences', vscode.Uri.parse(uri), new vscode.Position(pos.line, pos.character), refs.map(ref => new vscode.Location(vscode.Uri.parse(ref.uri), new vscode.Range(ref.range.start.line, ref.range.start.character, ref.range.end.line, ref.range.end.character))));
31
+ }));
32
+ }
33
+ });
34
+ }
35
+ exports.activate = activate;
36
+ //# sourceMappingURL=showReferences.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(cmd: string, client: BaseLanguageClient): Promise<vscode.Disposable>;
@@ -0,0 +1,204 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const vscode_languageclient_1 = require("vscode-languageclient");
14
+ const language_server_1 = require("@volar/language-server");
15
+ const source_map_1 = require("@volar/source-map");
16
+ const scheme = 'volar-virtual-file';
17
+ const mappingDecorationType = vscode.window.createTextEditorDecorationType({
18
+ borderWidth: '1px',
19
+ borderStyle: 'solid',
20
+ overviewRulerColor: 'blue',
21
+ overviewRulerLane: vscode.OverviewRulerLane.Right,
22
+ light: {
23
+ // this color will be used in light color themes
24
+ borderColor: 'darkblue'
25
+ },
26
+ dark: {
27
+ // this color will be used in dark color themes
28
+ borderColor: 'lightblue'
29
+ }
30
+ });
31
+ const mappingSelectionDecorationType = vscode.window.createTextEditorDecorationType({
32
+ cursor: 'crosshair',
33
+ light: {
34
+ backgroundColor: 'lightblue'
35
+ },
36
+ dark: {
37
+ backgroundColor: 'darkblue'
38
+ }
39
+ });
40
+ function activate(cmd, client) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ class MappingDataHoverProvider {
43
+ provideHover(document, position, _token) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const maps = virtualUriToSourceMap.get(document.uri.toString());
46
+ if (!maps)
47
+ return;
48
+ const data = [];
49
+ for (const [sourceUri, _, map] of maps) {
50
+ const source = map.toSourceOffset(document.offsetAt(position));
51
+ if (source) {
52
+ data.push({
53
+ uri: sourceUri,
54
+ mapping: source,
55
+ });
56
+ }
57
+ }
58
+ if (data.length === 0)
59
+ return;
60
+ return new vscode.Hover(data.map((data) => [
61
+ data.uri,
62
+ '',
63
+ '',
64
+ '```json',
65
+ JSON.stringify(data.mapping, null, 2),
66
+ '```',
67
+ ].join('\n')));
68
+ });
69
+ }
70
+ }
71
+ const subscriptions = [];
72
+ subscriptions.push(vscode.languages.registerHoverProvider({ scheme }, new MappingDataHoverProvider()));
73
+ const sourceUriToVirtualUris = new Map();
74
+ const virtualUriToSourceEditor = new Map();
75
+ const virtualUriToSourceMap = new Map();
76
+ const docChangeEvent = new vscode.EventEmitter();
77
+ const virtualDocuments = new Map();
78
+ let updateVirtualDocument;
79
+ let updateDecorationsTimeout;
80
+ subscriptions.push(vscode.window.onDidChangeActiveTextEditor(updateDecorations));
81
+ subscriptions.push(vscode.window.onDidChangeTextEditorSelection(updateDecorations));
82
+ subscriptions.push(vscode.window.onDidChangeVisibleTextEditors(updateDecorations));
83
+ subscriptions.push(vscode.workspace.onDidChangeTextDocument(e => {
84
+ if (sourceUriToVirtualUris.has(e.document.uri.toString())) {
85
+ const virtualUris = sourceUriToVirtualUris.get(e.document.uri.toString());
86
+ clearTimeout(updateVirtualDocument);
87
+ updateVirtualDocument = setTimeout(() => {
88
+ virtualUris === null || virtualUris === void 0 ? void 0 : virtualUris.forEach(uri => {
89
+ docChangeEvent.fire(vscode.Uri.parse(uri));
90
+ });
91
+ }, 100);
92
+ }
93
+ }));
94
+ subscriptions.push(vscode.workspace.registerTextDocumentContentProvider(scheme, {
95
+ onDidChange: docChangeEvent.event,
96
+ provideTextDocumentContent(uri) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ const fileName = uri.with({ scheme: 'file' }).fsPath;
99
+ const requestEditor = virtualUriToSourceEditor.get(uri.toString());
100
+ if (requestEditor) {
101
+ const virtual = yield client.sendRequest(language_server_1.GetVirtualFileRequest.type, { sourceFileUri: requestEditor.document.uri.toString(), virtualFileName: fileName });
102
+ virtualUriToSourceMap.set(uri.toString(), []);
103
+ Object.entries(virtual.mappings).forEach(([sourceUri, mappings]) => {
104
+ var _a, _b;
105
+ const sourceEditor = vscode.window.visibleTextEditors.find(editor => editor.document.uri.toString() === sourceUri);
106
+ if (sourceEditor) {
107
+ (_a = virtualUriToSourceMap.get(uri.toString())) === null || _a === void 0 ? void 0 : _a.push([
108
+ sourceEditor.document.uri.toString(),
109
+ sourceEditor.document.version,
110
+ new source_map_1.SourceMap(mappings),
111
+ ]);
112
+ if (!sourceUriToVirtualUris.has(sourceUri)) {
113
+ sourceUriToVirtualUris.set(sourceUri, new Set());
114
+ }
115
+ (_b = sourceUriToVirtualUris.get(sourceUri)) === null || _b === void 0 ? void 0 : _b.add(uri.toString());
116
+ }
117
+ });
118
+ virtualDocuments.set(uri.toString(), vscode_languageclient_1.TextDocument.create('', '', 0, virtual.content));
119
+ clearTimeout(updateDecorationsTimeout);
120
+ updateDecorationsTimeout = setTimeout(updateDecorations, 100);
121
+ return virtual.content;
122
+ }
123
+ });
124
+ }
125
+ }));
126
+ subscriptions.push(vscode.commands.registerCommand(cmd, () => __awaiter(this, void 0, void 0, function* () {
127
+ const sourceEditor = vscode.window.activeTextEditor;
128
+ if (sourceEditor) {
129
+ const fileNames = yield client.sendRequest(language_server_1.GetVirtualFileNamesRequest.type, client.code2ProtocolConverter.asTextDocumentIdentifier(sourceEditor.document));
130
+ const uris = fileNames.map(fileName => vscode.Uri.file(fileName).with({ scheme }));
131
+ sourceUriToVirtualUris.set(sourceEditor.document.uri.toString(), new Set(uris.map(uri => uri.toString())));
132
+ for (const uri of uris) {
133
+ virtualUriToSourceEditor.set(uri.toString(), sourceEditor);
134
+ vscode.window.showTextDocument(uri, { viewColumn: vscode.ViewColumn.Two, preview: false });
135
+ }
136
+ }
137
+ })));
138
+ return vscode.Disposable.from(...subscriptions);
139
+ function updateDecorations() {
140
+ for (const [virtualUri, sources] of virtualUriToSourceMap) {
141
+ const virtualEditor = vscode.window.visibleTextEditors.find(editor => editor.document.uri.toString() === virtualUri);
142
+ let virtualRanges1 = [];
143
+ let virtualRanges2 = [];
144
+ if (virtualEditor) {
145
+ for (const [sourceUri, sourceVersion, map] of sources) {
146
+ const sourceEditor = vscode.window.visibleTextEditors.find(editor => editor.document.uri.toString() === sourceUri);
147
+ if (sourceEditor && sourceEditor.document.version === sourceVersion) {
148
+ const mappingDecorationRanges = map.mappings.map(mapping => new vscode.Range(sourceEditor.document.positionAt(mapping.sourceRange[0]), sourceEditor.document.positionAt(mapping.sourceRange[1])));
149
+ sourceEditor.setDecorations(mappingDecorationType, mappingDecorationRanges);
150
+ virtualRanges1 = virtualRanges1.concat(map.mappings.map(mapping => new vscode.Range(getGeneratedPosition(virtualUri, mapping.generatedRange[0]), getGeneratedPosition(virtualUri, mapping.generatedRange[1]))));
151
+ /**
152
+ * selection
153
+ */
154
+ if (vscode.window.activeTextEditor) {
155
+ const selection = vscode.window.activeTextEditor.selection;
156
+ const startOffset = vscode.window.activeTextEditor.document.offsetAt(selection.start);
157
+ sourceEditor.setDecorations(mappingSelectionDecorationType, []);
158
+ if (vscode.window.activeTextEditor === sourceEditor) {
159
+ const matchVirtualRanges = [...map.toGeneratedOffsets(startOffset)];
160
+ sourceEditor.setDecorations(mappingSelectionDecorationType, matchVirtualRanges.map(mapped => new vscode.Range(sourceEditor.document.positionAt(mapped[1].sourceRange[0]), sourceEditor.document.positionAt(mapped[1].sourceRange[1]))));
161
+ virtualRanges2 = virtualRanges2.concat(matchVirtualRanges.map(mapped => new vscode.Range(getGeneratedPosition(virtualUri, mapped[1].generatedRange[0]), getGeneratedPosition(virtualUri, mapped[1].generatedRange[1]))));
162
+ const mapped = matchVirtualRanges.sort((a, b) => a[1].generatedRange[0] - b[1].generatedRange[0])[0];
163
+ if (mapped) {
164
+ virtualEditor.revealRange(new vscode.Range(getGeneratedPosition(virtualUri, mapped[1].generatedRange[0]), getGeneratedPosition(virtualUri, mapped[1].generatedRange[1])));
165
+ }
166
+ }
167
+ else if (vscode.window.activeTextEditor === virtualEditor) {
168
+ const matchSourceRanges = [...map.toSourceOffsets(startOffset)];
169
+ sourceEditor.setDecorations(mappingSelectionDecorationType, matchSourceRanges.map(mapped => new vscode.Range(sourceEditor.document.positionAt(mapped[1].sourceRange[0]), sourceEditor.document.positionAt(mapped[1].sourceRange[1]))));
170
+ virtualRanges2 = virtualRanges2.concat(matchSourceRanges.map(mapped => new vscode.Range(getGeneratedPosition(virtualUri, mapped[1].generatedRange[0]), getGeneratedPosition(virtualUri, mapped[1].generatedRange[1]))));
171
+ const mapped = matchSourceRanges.sort((a, b) => a[1].sourceRange[0] - b[1].sourceRange[0])[0];
172
+ if (mapped) {
173
+ sourceEditor.revealRange(new vscode.Range(sourceEditor.document.positionAt(mapped[1].sourceRange[0]), sourceEditor.document.positionAt(mapped[1].sourceRange[1])));
174
+ }
175
+ }
176
+ }
177
+ else {
178
+ sourceEditor.setDecorations(mappingSelectionDecorationType, []);
179
+ }
180
+ }
181
+ }
182
+ virtualEditor.setDecorations(mappingDecorationType, virtualRanges1);
183
+ virtualEditor.setDecorations(mappingSelectionDecorationType, virtualRanges2);
184
+ }
185
+ else {
186
+ for (const [sourceUri] of sources) {
187
+ const sourceEditor = vscode.window.visibleTextEditors.find(editor => editor.document.uri.toString() === sourceUri);
188
+ if (sourceEditor) {
189
+ sourceEditor.setDecorations(mappingDecorationType, []);
190
+ sourceEditor.setDecorations(mappingSelectionDecorationType, []);
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ function getGeneratedPosition(virtualUri, offset) {
197
+ const document = virtualDocuments.get(virtualUri);
198
+ const position = document.positionAt(offset);
199
+ return new vscode.Position(position.line, position.character);
200
+ }
201
+ });
202
+ }
203
+ exports.activate = activate;
204
+ //# sourceMappingURL=showVirtualFiles.js.map
@@ -0,0 +1,8 @@
1
+ import * as vscode from 'vscode';
2
+ import { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(cmd: string, context: vscode.ExtensionContext, client: BaseLanguageClient, shouldStatusBarShow: (document: vscode.TextDocument) => boolean, resolveStatusText: (text: string) => string, disableTakeOverMode: boolean, cdn?: string): Promise<vscode.Disposable>;
4
+ export declare function getTsdk(context: vscode.ExtensionContext): {
5
+ tsdk: string;
6
+ version: any;
7
+ isWorkspacePath: boolean;
8
+ };
@@ -0,0 +1,209 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.getTsdk = exports.activate = void 0;
12
+ const path = require("typesafe-path");
13
+ const vscode = require("vscode");
14
+ const common_1 = require("../common");
15
+ const defaultTsdkPath = 'node_modules/typescript/lib';
16
+ function activate(cmd, context, client, shouldStatusBarShow, resolveStatusText, disableTakeOverMode, cdn = 'https://unpkg.com/') {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ const subscriptions = [];
19
+ const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
20
+ statusBar.command = cmd;
21
+ subscriptions.push({ dispose: () => statusBar.dispose() });
22
+ subscriptions.push(vscode.commands.registerCommand(cmd, onCommand));
23
+ vscode.workspace.onDidChangeConfiguration(onDidChangeConfiguration, undefined, subscriptions);
24
+ vscode.window.onDidChangeActiveTextEditor(updateStatusBar, undefined, subscriptions);
25
+ updateStatusBar();
26
+ return vscode.Disposable.from(...subscriptions);
27
+ function onCommand() {
28
+ var _a, _b, _c, _d;
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const tsdk = getTsdk(context);
31
+ const configTsdkPath = getConfigTsdkPath();
32
+ const vscodeTsdk = getVScodeTsdk();
33
+ const select = yield (0, common_1.quickPick)([
34
+ {
35
+ useVSCodeTsdk: {
36
+ label: (!tsdk.isWorkspacePath ? '• ' : '') + "Use VS Code's Version",
37
+ description: vscodeTsdk.version,
38
+ detail: vscodeTsdk.isWeb ? vscodeTsdk.path.replace('/node_modules/', cdn) : undefined,
39
+ },
40
+ useConfigWorkspaceTsdk: configTsdkPath && !vscodeTsdk.isWeb ? {
41
+ label: (tsdk.isWorkspacePath ? '• ' : '') + 'Use Workspace Version',
42
+ description: (_b = yield getTsVersion((_a = resolveWorkspaceTsdk(configTsdkPath)) !== null && _a !== void 0 ? _a : '/')) !== null && _b !== void 0 ? _b : 'Could not load the TypeScript version at this path',
43
+ detail: configTsdkPath,
44
+ } : undefined,
45
+ useDefaultWorkspaceTsdk: configTsdkPath !== defaultTsdkPath && !vscodeTsdk.isWeb ? {
46
+ label: (tsdk.isWorkspacePath ? '• ' : '') + 'Use Workspace Version',
47
+ description: (_d = yield getTsVersion((_c = resolveWorkspaceTsdk(defaultTsdkPath)) !== null && _c !== void 0 ? _c : '/')) !== null && _d !== void 0 ? _d : 'Could not load the TypeScript version at this path',
48
+ detail: defaultTsdkPath,
49
+ } : undefined,
50
+ },
51
+ ...(disableTakeOverMode ? [] : [{
52
+ takeover: {
53
+ label: 'What is Takeover Mode?',
54
+ },
55
+ }])
56
+ ]);
57
+ if (select === undefined) {
58
+ return; // cancel
59
+ }
60
+ if (select === 'takeover') {
61
+ vscode.env.openExternal(vscode.Uri.parse('https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode'));
62
+ return;
63
+ }
64
+ if (select === 'useDefaultWorkspaceTsdk') {
65
+ yield vscode.workspace.getConfiguration('typescript').update('tsdk', defaultTsdkPath);
66
+ }
67
+ const useWorkspaceTsdk = select === 'useConfigWorkspaceTsdk' || select === 'useDefaultWorkspaceTsdk';
68
+ if (useWorkspaceTsdk !== isUseWorkspaceTsdk(context)) {
69
+ context.workspaceState.update('typescript.useWorkspaceTsdk', useWorkspaceTsdk);
70
+ reloadServers();
71
+ }
72
+ updateStatusBar();
73
+ });
74
+ }
75
+ function onDidChangeConfiguration(e) {
76
+ if (e.affectsConfiguration('typescript.tsdk') && isUseWorkspaceTsdk(context)) {
77
+ reloadServers();
78
+ }
79
+ }
80
+ function updateStatusBar() {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ if (!vscode.window.activeTextEditor
83
+ || !shouldStatusBarShow(vscode.window.activeTextEditor.document)) {
84
+ statusBar.hide();
85
+ }
86
+ else {
87
+ const tsVersion = getTsdk(context).version;
88
+ statusBar.text = tsVersion !== null && tsVersion !== void 0 ? tsVersion : 'x.x.x';
89
+ statusBar.text = resolveStatusText(statusBar.text);
90
+ statusBar.show();
91
+ }
92
+ });
93
+ }
94
+ function reloadServers() {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ const tsPaths = getTsdk(context);
97
+ const newInitOptions = Object.assign(Object.assign({}, client.clientOptions.initializationOptions), { typescript: tsPaths });
98
+ client.clientOptions.initializationOptions = newInitOptions;
99
+ vscode.commands.executeCommand('volar.action.restartServer');
100
+ });
101
+ }
102
+ });
103
+ }
104
+ exports.activate = activate;
105
+ function getTsdk(context) {
106
+ if (isUseWorkspaceTsdk(context)) {
107
+ const resolvedTsdk = resolveWorkspaceTsdk(getConfigTsdkPath() || defaultTsdkPath);
108
+ if (resolvedTsdk) {
109
+ return {
110
+ tsdk: resolvedTsdk,
111
+ version: getTsVersion(resolvedTsdk),
112
+ isWorkspacePath: true,
113
+ };
114
+ }
115
+ }
116
+ const tsdk = getVScodeTsdk();
117
+ return {
118
+ tsdk: tsdk.path,
119
+ version: tsdk.version,
120
+ isWorkspacePath: false,
121
+ };
122
+ }
123
+ exports.getTsdk = getTsdk;
124
+ function resolveWorkspaceTsdk(tsdk) {
125
+ var _a;
126
+ if (path.isAbsolute(tsdk)) {
127
+ try {
128
+ if (require.resolve('./typescript.js', { paths: [tsdk] })) {
129
+ return tsdk;
130
+ }
131
+ }
132
+ catch (_b) { }
133
+ }
134
+ const workspaceFolderFsPaths = ((_a = vscode.workspace.workspaceFolders) !== null && _a !== void 0 ? _a : []).map(folder => folder.uri.fsPath);
135
+ for (const folder of workspaceFolderFsPaths) {
136
+ const _path = path.join(folder, tsdk);
137
+ try {
138
+ if (require.resolve('./typescript.js', { paths: [_path] })) {
139
+ return _path;
140
+ }
141
+ }
142
+ catch (_c) { }
143
+ }
144
+ }
145
+ function getVScodeTsdk() {
146
+ const nightly = vscode.extensions.getExtension('ms-vscode.vscode-typescript-next');
147
+ if (nightly) {
148
+ const path = nightly.extensionPath.toString() + '/node_modules/typescript/lib';
149
+ return {
150
+ path,
151
+ version: getTsVersion(path),
152
+ isWeb: false,
153
+ };
154
+ }
155
+ if (vscode.env.appRoot) {
156
+ const libPath = path.join(vscode.env.appRoot, 'extensions/node_modules/typescript/lib');
157
+ return {
158
+ path: libPath,
159
+ version: getTsVersion(libPath),
160
+ isWeb: false,
161
+ };
162
+ }
163
+ // web
164
+ const version = require('typescript/package.json').version;
165
+ return {
166
+ path: `/node_modules/typescript@${version}/lib`,
167
+ version,
168
+ isWeb: true,
169
+ };
170
+ }
171
+ function getConfigTsdkPath() {
172
+ return vscode.workspace.getConfiguration('typescript').get('tsdk');
173
+ }
174
+ function isUseWorkspaceTsdk(context) {
175
+ return context.workspaceState.get('typescript.useWorkspaceTsdk', false);
176
+ }
177
+ function getTsVersion(libPath) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ const p = libPath.toString().split('/');
180
+ const p2 = p.slice(0, -1);
181
+ const modulePath = p2.join('/');
182
+ const filePath = modulePath + '/package.json';
183
+ const contents = yield readFile(filePath);
184
+ if (contents === undefined) {
185
+ return;
186
+ }
187
+ let desc = null;
188
+ try {
189
+ desc = JSON.parse(contents);
190
+ }
191
+ catch (err) {
192
+ return;
193
+ }
194
+ if (!desc || !desc.version) {
195
+ return;
196
+ }
197
+ return desc.version;
198
+ });
199
+ }
200
+ function readFile(path) {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ try {
203
+ const data = yield vscode.workspace.fs.readFile(vscode.Uri.file(path));
204
+ return new TextDecoder('utf8').decode(data);
205
+ }
206
+ catch (_a) { }
207
+ });
208
+ }
209
+ //# sourceMappingURL=tsVersion.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(cmd: string, client: BaseLanguageClient, shouldStatusBarShow: (document: vscode.TextDocument) => boolean): Promise<void>;
@@ -0,0 +1,53 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const language_server_1 = require("@volar/language-server");
14
+ const path = require("typesafe-path");
15
+ function activate(cmd, client, shouldStatusBarShow) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const subscriptions = [];
18
+ const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
19
+ let currentTsconfigUri;
20
+ updateStatusBar();
21
+ vscode.window.onDidChangeActiveTextEditor(updateStatusBar, undefined, subscriptions);
22
+ subscriptions.push(vscode.commands.registerCommand(cmd, () => __awaiter(this, void 0, void 0, function* () {
23
+ if (currentTsconfigUri) {
24
+ const document = yield vscode.workspace.openTextDocument(currentTsconfigUri);
25
+ yield vscode.window.showTextDocument(document);
26
+ }
27
+ })));
28
+ subscriptions.push(...subscriptions);
29
+ function updateStatusBar() {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ if (!vscode.window.activeTextEditor
32
+ || !shouldStatusBarShow(vscode.window.activeTextEditor.document)) {
33
+ statusBar.hide();
34
+ }
35
+ else {
36
+ const tsconfig = yield client.sendRequest(language_server_1.GetMatchTsConfigRequest.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
37
+ if (tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.uri) {
38
+ currentTsconfigUri = vscode.Uri.parse(tsconfig.uri);
39
+ statusBar.text = path.relative((vscode.workspace.rootPath || '/'), currentTsconfigUri.fsPath);
40
+ statusBar.command = cmd;
41
+ }
42
+ else {
43
+ statusBar.text = 'No tsconfig';
44
+ statusBar.command = undefined;
45
+ }
46
+ statusBar.show();
47
+ }
48
+ });
49
+ }
50
+ });
51
+ }
52
+ exports.activate = activate;
53
+ //# sourceMappingURL=tsconfig.js.map
@@ -0,0 +1,3 @@
1
+ import * as vscode from 'vscode';
2
+ import type { BaseLanguageClient } from 'vscode-languageclient';
3
+ export declare function activate(cmd: string, client: BaseLanguageClient): Promise<vscode.Disposable>;
@@ -0,0 +1,24 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.activate = void 0;
12
+ const vscode = require("vscode");
13
+ const language_server_1 = require("@volar/language-server");
14
+ function activate(cmd, client) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ return vscode.commands.registerCommand(cmd, () => {
17
+ if (vscode.window.activeTextEditor) {
18
+ client.sendNotification(language_server_1.WriteVirtualFilesNotification.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
19
+ }
20
+ });
21
+ });
22
+ }
23
+ exports.activate = activate;
24
+ //# sourceMappingURL=writeVirtualFiles.js.map
package/out/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import * as vscode from 'vscode';
2
+ export { activate as activateAutoInsertion } from './features/autoInsertion';
3
+ export { activate as activateShowVirtualFiles } from './features/showVirtualFiles';
4
+ export { activate as activateWriteVirtualFiles } from './features/writeVirtualFiles';
5
+ export { activate as activateFindFileReferences } from './features/fileReferences';
6
+ export { activate as activateReloadProjects } from './features/reloadProject';
7
+ export { activate as activateServerStats } from './features/serverStatus';
8
+ export { activate as activateTsConfigStatusItem } from './features/tsconfig';
9
+ export { activate as activateShowReferences } from './features/showReferences';
10
+ export { activate as activateServerSys } from './features/serverSys';
11
+ export { activate as activateTsVersionStatusItem, getTsdk } from './features/tsVersion';
12
+ export declare function takeOverModeActive(context: vscode.ExtensionContext): boolean;
package/out/index.js ADDED
@@ -0,0 +1,32 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.takeOverModeActive = exports.getTsdk = exports.activateTsVersionStatusItem = exports.activateServerSys = exports.activateShowReferences = exports.activateTsConfigStatusItem = exports.activateServerStats = exports.activateReloadProjects = exports.activateFindFileReferences = exports.activateWriteVirtualFiles = exports.activateShowVirtualFiles = exports.activateAutoInsertion = void 0;
3
+ const vscode = require("vscode");
4
+ var autoInsertion_1 = require("./features/autoInsertion");
5
+ Object.defineProperty(exports, "activateAutoInsertion", { enumerable: true, get: function () { return autoInsertion_1.activate; } });
6
+ var showVirtualFiles_1 = require("./features/showVirtualFiles");
7
+ Object.defineProperty(exports, "activateShowVirtualFiles", { enumerable: true, get: function () { return showVirtualFiles_1.activate; } });
8
+ var writeVirtualFiles_1 = require("./features/writeVirtualFiles");
9
+ Object.defineProperty(exports, "activateWriteVirtualFiles", { enumerable: true, get: function () { return writeVirtualFiles_1.activate; } });
10
+ var fileReferences_1 = require("./features/fileReferences");
11
+ Object.defineProperty(exports, "activateFindFileReferences", { enumerable: true, get: function () { return fileReferences_1.activate; } });
12
+ var reloadProject_1 = require("./features/reloadProject");
13
+ Object.defineProperty(exports, "activateReloadProjects", { enumerable: true, get: function () { return reloadProject_1.activate; } });
14
+ var serverStatus_1 = require("./features/serverStatus");
15
+ Object.defineProperty(exports, "activateServerStats", { enumerable: true, get: function () { return serverStatus_1.activate; } });
16
+ var tsconfig_1 = require("./features/tsconfig");
17
+ Object.defineProperty(exports, "activateTsConfigStatusItem", { enumerable: true, get: function () { return tsconfig_1.activate; } });
18
+ var showReferences_1 = require("./features/showReferences");
19
+ Object.defineProperty(exports, "activateShowReferences", { enumerable: true, get: function () { return showReferences_1.activate; } });
20
+ var serverSys_1 = require("./features/serverSys");
21
+ Object.defineProperty(exports, "activateServerSys", { enumerable: true, get: function () { return serverSys_1.activate; } });
22
+ var tsVersion_1 = require("./features/tsVersion");
23
+ Object.defineProperty(exports, "activateTsVersionStatusItem", { enumerable: true, get: function () { return tsVersion_1.activate; } });
24
+ Object.defineProperty(exports, "getTsdk", { enumerable: true, get: function () { return tsVersion_1.getTsdk; } });
25
+ function takeOverModeActive(context) {
26
+ if (vscode.workspace.getConfiguration('volar').get('takeOverMode.extension') === context.extension.id) {
27
+ return !vscode.extensions.getExtension('vscode.typescript-language-features');
28
+ }
29
+ return false;
30
+ }
31
+ exports.takeOverModeActive = takeOverModeActive;
32
+ //# sourceMappingURL=index.js.map
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@volar/vscode",
3
+ "version": "1.4.0-alpha.0",
4
+ "main": "out/index.js",
5
+ "license": "MIT",
6
+ "files": [
7
+ "out/**/*.js",
8
+ "out/**/*.d.ts"
9
+ ],
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/volarjs/volar.js.git",
13
+ "directory": "packages/vscode"
14
+ },
15
+ "dependencies": {
16
+ "@volar/language-server": "1.4.0-alpha.0",
17
+ "@volar/source-map": "1.4.0-alpha.0",
18
+ "typesafe-path": "^0.2.2",
19
+ "vscode-nls": "^5.2.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/vscode": "latest",
23
+ "vscode-languageclient": "latest"
24
+ },
25
+ "peerDependencies": {
26
+ "@types/vscode": "*",
27
+ "vscode-languageclient": "*"
28
+ },
29
+ "gitHead": "2607410cae341cf802b446062d446ad497be2057"
30
+ }