volar-service-typescript 0.0.50 → 0.0.52
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.js +3 -5
- package/lib/configs/getFormatCodeSettings.js +1 -2
- package/lib/configs/getUserPreferences.js +1 -2
- package/lib/plugins/directiveComment.js +1 -2
- package/lib/plugins/docCommentTemplate.js +1 -2
- package/lib/plugins/semantic.js +8 -9
- package/lib/plugins/syntactic.js +2 -3
- package/lib/semanticFeatures/codeAction.js +1 -2
- package/lib/semanticFeatures/codeActionResolve.js +4 -5
- package/lib/semanticFeatures/semanticTokens.js +1 -2
- package/lib/shared.d.ts +0 -1
- package/lib/shared.js +4 -9
- package/lib/syntaxOnlyService.js +1 -2
- package/lib/utils/lspConverters.js +25 -27
- package/lib/utils/modifiers.js +1 -2
- package/lib/utils/previewer.js +4 -5
- package/lib/utils/snippetForFunctionCall.js +1 -2
- package/lib/utils/typeConverters.d.ts +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
4
|
-
var semantic_1 = require("./lib/plugins/semantic");
|
|
3
|
+
exports.create = create;
|
|
5
4
|
const directiveComment_1 = require("./lib/plugins/directiveComment");
|
|
6
5
|
const docCommentTemplate_1 = require("./lib/plugins/docCommentTemplate");
|
|
7
|
-
const
|
|
6
|
+
const semantic_1 = require("./lib/plugins/semantic");
|
|
8
7
|
const syntactic_1 = require("./lib/plugins/syntactic");
|
|
9
8
|
function create(ts, options) {
|
|
10
9
|
return [
|
|
11
|
-
(0,
|
|
10
|
+
(0, semantic_1.create)(ts, options),
|
|
12
11
|
(0, syntactic_1.create)(ts, options),
|
|
13
12
|
(0, docCommentTemplate_1.create)(ts),
|
|
14
13
|
(0, directiveComment_1.create)(),
|
|
15
14
|
];
|
|
16
15
|
}
|
|
17
|
-
exports.create = create;
|
|
18
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFormatCodeSettings =
|
|
3
|
+
exports.getFormatCodeSettings = getFormatCodeSettings;
|
|
4
4
|
const shared_1 = require("../shared");
|
|
5
5
|
async function getFormatCodeSettings(ctx, document, options) {
|
|
6
6
|
const config = await ctx.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.format') ?? {};
|
|
@@ -29,5 +29,4 @@ async function getFormatCodeSettings(ctx, document, options) {
|
|
|
29
29
|
semicolons: config.semicolons ?? 'ignore',
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
exports.getFormatCodeSettings = getFormatCodeSettings;
|
|
33
32
|
//# sourceMappingURL=getFormatCodeSettings.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUserPreferences =
|
|
3
|
+
exports.getUserPreferences = getUserPreferences;
|
|
4
4
|
const path = require("path-browserify");
|
|
5
5
|
const shared_1 = require("../shared");
|
|
6
6
|
const vscode_uri_1 = require("vscode-uri");
|
|
@@ -49,7 +49,6 @@ async function getUserPreferences(ctx, document) {
|
|
|
49
49
|
};
|
|
50
50
|
return preferences;
|
|
51
51
|
}
|
|
52
|
-
exports.getUserPreferences = getUserPreferences;
|
|
53
52
|
function getQuoteStylePreference(config) {
|
|
54
53
|
switch (config.quoteStyle) {
|
|
55
54
|
case 'single': return 'single';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const nls = require("vscode-nls");
|
|
5
5
|
const shared_1 = require("../shared");
|
|
6
6
|
const localize = nls.loadMessageBundle(); // TODO: not working
|
|
@@ -66,5 +66,4 @@ function create() {
|
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
exports.create = create;
|
|
70
69
|
//# sourceMappingURL=directiveComment.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const nls = require("vscode-nls");
|
|
5
5
|
const shared_1 = require("../shared");
|
|
6
6
|
const lspConverters_1 = require("../utils/lspConverters");
|
|
@@ -50,7 +50,6 @@ function create(ts) {
|
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
exports.create = create;
|
|
54
53
|
function createCompletionItem(document, position, insertText) {
|
|
55
54
|
const item = { label: '/** */' };
|
|
56
55
|
item.kind = 1;
|
package/lib/plugins/semantic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const path = require("path-browserify");
|
|
5
5
|
const semver = require("semver");
|
|
6
6
|
const tsWithImportCache = require("typescript-auto-import-cache");
|
|
@@ -55,7 +55,7 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
55
55
|
callHierarchyProvider: true,
|
|
56
56
|
definitionProvider: true,
|
|
57
57
|
typeDefinitionProvider: true,
|
|
58
|
-
diagnosticProvider:
|
|
58
|
+
diagnosticProvider: {},
|
|
59
59
|
hoverProvider: true,
|
|
60
60
|
implementationProvider: true,
|
|
61
61
|
referencesProvider: true,
|
|
@@ -514,10 +514,10 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
514
514
|
return entries.map(entry => (0, lspConverters_1.convertDocumentSpantoLocationLink)(entry, ctx));
|
|
515
515
|
});
|
|
516
516
|
},
|
|
517
|
-
|
|
517
|
+
provideDiagnostics(document, token) {
|
|
518
518
|
return provideDiagnosticsWorker(document, token, 'syntactic');
|
|
519
519
|
},
|
|
520
|
-
|
|
520
|
+
provideSemanticDiagnostics(document, token) {
|
|
521
521
|
return provideDiagnosticsWorker(document, token, 'semantic');
|
|
522
522
|
},
|
|
523
523
|
provideHover(document, position, token) {
|
|
@@ -633,7 +633,7 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
633
633
|
return items
|
|
634
634
|
.filter(item => item.containerName || item.kind !== 'alias')
|
|
635
635
|
.map(item => (0, lspConverters_1.convertNavigateToItem)(item, ctx.getTextDocument(ctx.fileNameToUri(item.fileName))))
|
|
636
|
-
.filter(
|
|
636
|
+
.filter(item => !!item);
|
|
637
637
|
});
|
|
638
638
|
},
|
|
639
639
|
provideFileRenameEdits(oldUri, newUri, token) {
|
|
@@ -668,7 +668,7 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
668
668
|
}
|
|
669
669
|
return (0, lspConverters_1.convertSelectionRange)(range, document);
|
|
670
670
|
})
|
|
671
|
-
.filter(
|
|
671
|
+
.filter(position => !!position);
|
|
672
672
|
});
|
|
673
673
|
},
|
|
674
674
|
provideSignatureHelp(document, position, context, token) {
|
|
@@ -756,7 +756,7 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
756
756
|
const suggestionDiagnostics = (0, shared_1.safeCall)(() => ctx.languageService.getSuggestionDiagnostics(fileName)) ?? [];
|
|
757
757
|
return [...syntacticDiagnostics, ...suggestionDiagnostics]
|
|
758
758
|
.map(diagnostic => (0, lspConverters_1.convertDiagnostic)(diagnostic, document, ctx.fileNameToUri, ctx.getTextDocument))
|
|
759
|
-
.filter(
|
|
759
|
+
.filter(diagnostic => !!diagnostic);
|
|
760
760
|
}
|
|
761
761
|
else if (mode === 'semantic') {
|
|
762
762
|
const semanticDiagnostics = (0, shared_1.safeCall)(() => program.getSemanticDiagnostics(sourceFile, token)) ?? [];
|
|
@@ -765,7 +765,7 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
765
765
|
: [];
|
|
766
766
|
return [...semanticDiagnostics, ...declarationDiagnostics]
|
|
767
767
|
.map(diagnostic => (0, lspConverters_1.convertDiagnostic)(diagnostic, document, ctx.fileNameToUri, ctx.getTextDocument))
|
|
768
|
-
.filter(
|
|
768
|
+
.filter(diagnostic => !!diagnostic);
|
|
769
769
|
}
|
|
770
770
|
});
|
|
771
771
|
}
|
|
@@ -822,7 +822,6 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
822
822
|
},
|
|
823
823
|
};
|
|
824
824
|
}
|
|
825
|
-
exports.create = create;
|
|
826
825
|
function getBasicTriggerCharacters(tsVersion) {
|
|
827
826
|
const triggerCharacters = ['.', '"', '\'', '`', '/', '<'];
|
|
828
827
|
// https://github.com/microsoft/vscode/blob/8e65ae28d5fb8b3c931135da1a41edb9c80ae46f/extensions/typescript-language-features/src/languageFeatures/completions.ts#L811-L833
|
package/lib/plugins/syntactic.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getLanguageServiceByDocument = getLanguageServiceByDocument;
|
|
4
|
+
exports.create = create;
|
|
4
5
|
const getFormatCodeSettings_1 = require("../configs/getFormatCodeSettings");
|
|
5
6
|
const shared_1 = require("../shared");
|
|
6
7
|
const lspConverters_1 = require("../utils/lspConverters");
|
|
@@ -29,7 +30,6 @@ function getLanguageServiceByDocument(ts, document) {
|
|
|
29
30
|
fileName: document.uri,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
|
-
exports.getLanguageServiceByDocument = getLanguageServiceByDocument;
|
|
33
33
|
function create(ts, { isFormattingEnabled = async (document, context) => {
|
|
34
34
|
return await context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.format.enable') ?? true;
|
|
35
35
|
}, } = {}) {
|
|
@@ -133,5 +133,4 @@ function create(ts, { isFormattingEnabled = async (document, context) => {
|
|
|
133
133
|
},
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
exports.create = create;
|
|
137
136
|
//# sourceMappingURL=syntactic.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const getFormatCodeSettings_1 = require("../configs/getFormatCodeSettings");
|
|
5
5
|
const getUserPreferences_1 = require("../configs/getUserPreferences");
|
|
6
6
|
const shared_1 = require("../shared");
|
|
@@ -260,5 +260,4 @@ function register(ctx) {
|
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
exports.register = register;
|
|
264
263
|
//# sourceMappingURL=codeAction.js.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.register = register;
|
|
4
|
+
exports.resolveFixAllCodeAction = resolveFixAllCodeAction;
|
|
5
|
+
exports.resolveRefactorCodeAction = resolveRefactorCodeAction;
|
|
6
|
+
exports.resolveOrganizeImportsCodeAction = resolveOrganizeImportsCodeAction;
|
|
4
7
|
const getFormatCodeSettings_1 = require("../configs/getFormatCodeSettings");
|
|
5
8
|
const getUserPreferences_1 = require("../configs/getUserPreferences");
|
|
6
9
|
const shared_1 = require("../shared");
|
|
@@ -26,13 +29,11 @@ function register(ctx) {
|
|
|
26
29
|
return codeAction;
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
|
-
exports.register = register;
|
|
30
32
|
function resolveFixAllCodeAction(ctx, codeAction, data, formatOptions, preferences) {
|
|
31
33
|
const fixes = data.fixIds.map(fixId => (0, shared_1.safeCall)(() => ctx.languageService.getCombinedCodeFix({ type: 'file', fileName: data.fileName }, fixId, formatOptions, preferences)));
|
|
32
34
|
const changes = fixes.map(fix => fix?.changes ?? []).flat();
|
|
33
35
|
codeAction.edit = (0, lspConverters_1.convertFileTextChanges)(changes, ctx.fileNameToUri, ctx.getTextDocument);
|
|
34
36
|
}
|
|
35
|
-
exports.resolveFixAllCodeAction = resolveFixAllCodeAction;
|
|
36
37
|
function resolveRefactorCodeAction(ctx, codeAction, data, document, formatOptions, preferences) {
|
|
37
38
|
const editInfo = (0, shared_1.safeCall)(() => ctx.languageService.getEditsForRefactor(data.fileName, formatOptions, data.range, data.refactorName, data.actionName, preferences));
|
|
38
39
|
if (!editInfo) {
|
|
@@ -43,10 +44,8 @@ function resolveRefactorCodeAction(ctx, codeAction, data, document, formatOption
|
|
|
43
44
|
codeAction.command = ctx.commands.rename.create(document.uri, document.positionAt(editInfo.renameLocation));
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
exports.resolveRefactorCodeAction = resolveRefactorCodeAction;
|
|
47
47
|
function resolveOrganizeImportsCodeAction(ctx, codeAction, data, formatOptions, preferences) {
|
|
48
48
|
const changes = (0, shared_1.safeCall)(() => ctx.languageService.organizeImports({ type: 'file', fileName: data.fileName }, formatOptions, preferences));
|
|
49
49
|
codeAction.edit = (0, lspConverters_1.convertFileTextChanges)(changes ?? [], ctx.fileNameToUri, ctx.getTextDocument);
|
|
50
50
|
}
|
|
51
|
-
exports.resolveOrganizeImportsCodeAction = resolveOrganizeImportsCodeAction;
|
|
52
51
|
//# sourceMappingURL=codeActionResolve.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const shared_1 = require("../shared");
|
|
5
5
|
function register(ts, ctx) {
|
|
6
6
|
return (uri, document, range, legend) => {
|
|
@@ -66,7 +66,6 @@ function register(ts, ctx) {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
exports.register = register;
|
|
70
69
|
function docLineLength(document, line) {
|
|
71
70
|
const currentLineOffset = document.offsetAt({ line, character: 0 });
|
|
72
71
|
const nextLineOffset = document.offsetAt({ line: line + 1, character: 0 });
|
package/lib/shared.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ export declare function getConfigTitle(document: TextDocument): string;
|
|
|
3
3
|
export declare function isTsDocument(document: TextDocument): boolean;
|
|
4
4
|
export declare function isJsonDocument(document: TextDocument): boolean;
|
|
5
5
|
export declare function safeCall<T>(cb: () => T): T | undefined;
|
|
6
|
-
export declare function notEmpty(value: any): value is NonNullable<typeof value>;
|
|
7
6
|
//# sourceMappingURL=shared.d.ts.map
|
package/lib/shared.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getConfigTitle = getConfigTitle;
|
|
4
|
+
exports.isTsDocument = isTsDocument;
|
|
5
|
+
exports.isJsonDocument = isJsonDocument;
|
|
6
|
+
exports.safeCall = safeCall;
|
|
4
7
|
function getConfigTitle(document) {
|
|
5
8
|
if (document.languageId === 'javascriptreact') {
|
|
6
9
|
return 'javascript';
|
|
@@ -10,28 +13,20 @@ function getConfigTitle(document) {
|
|
|
10
13
|
}
|
|
11
14
|
return document.languageId;
|
|
12
15
|
}
|
|
13
|
-
exports.getConfigTitle = getConfigTitle;
|
|
14
16
|
function isTsDocument(document) {
|
|
15
17
|
return document.languageId === 'javascript' ||
|
|
16
18
|
document.languageId === 'typescript' ||
|
|
17
19
|
document.languageId === 'javascriptreact' ||
|
|
18
20
|
document.languageId === 'typescriptreact';
|
|
19
21
|
}
|
|
20
|
-
exports.isTsDocument = isTsDocument;
|
|
21
22
|
function isJsonDocument(document) {
|
|
22
23
|
return document.languageId === 'json' ||
|
|
23
24
|
document.languageId === 'jsonc';
|
|
24
25
|
}
|
|
25
|
-
exports.isJsonDocument = isJsonDocument;
|
|
26
26
|
function safeCall(cb) {
|
|
27
27
|
try {
|
|
28
28
|
return cb();
|
|
29
29
|
}
|
|
30
30
|
catch { }
|
|
31
31
|
}
|
|
32
|
-
exports.safeCall = safeCall;
|
|
33
|
-
function notEmpty(value) {
|
|
34
|
-
return value !== null && value !== undefined;
|
|
35
|
-
}
|
|
36
|
-
exports.notEmpty = notEmpty;
|
|
37
32
|
//# sourceMappingURL=shared.js.map
|
package/lib/syntaxOnlyService.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSyntaxOnlyService =
|
|
3
|
+
exports.createSyntaxOnlyService = createSyntaxOnlyService;
|
|
4
4
|
function createSyntaxOnlyService(ts, syntaxOnly) {
|
|
5
5
|
let currentProjectVersion = -1;
|
|
6
6
|
let fileNames = [];
|
|
@@ -41,5 +41,4 @@ function createSyntaxOnlyService(ts, syntaxOnly) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
exports.createSyntaxOnlyService = createSyntaxOnlyService;
|
|
45
44
|
//# sourceMappingURL=syntaxOnlyService.js.map
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.convertDiagnostic = convertDiagnostic;
|
|
4
|
+
exports.applyCompletionEntryDetails = applyCompletionEntryDetails;
|
|
5
|
+
exports.convertCompletionInfo = convertCompletionInfo;
|
|
6
|
+
exports.getLineText = getLineText;
|
|
7
|
+
exports.convertNavigateToItem = convertNavigateToItem;
|
|
8
|
+
exports.convertInlayHint = convertInlayHint;
|
|
9
|
+
exports.convertHighlightSpan = convertHighlightSpan;
|
|
10
|
+
exports.convertSelectionRange = convertSelectionRange;
|
|
11
|
+
exports.convertFileTextChanges = convertFileTextChanges;
|
|
12
|
+
exports.convertRenameLocations = convertRenameLocations;
|
|
13
|
+
exports.convertQuickInfo = convertQuickInfo;
|
|
14
|
+
exports.convertNavTree = convertNavTree;
|
|
15
|
+
exports.convertOutliningSpan = convertOutliningSpan;
|
|
16
|
+
exports.convertOutliningSpanKind = convertOutliningSpanKind;
|
|
17
|
+
exports.convertTextChange = convertTextChange;
|
|
18
|
+
exports.convertCallHierarchyIncomingCall = convertCallHierarchyIncomingCall;
|
|
19
|
+
exports.convertCallHierarchyOutgoingCall = convertCallHierarchyOutgoingCall;
|
|
20
|
+
exports.convertCallHierarchyItem = convertCallHierarchyItem;
|
|
21
|
+
exports.convertDocumentSpanToLocation = convertDocumentSpanToLocation;
|
|
22
|
+
exports.convertDefinitionInfoAndBoundSpan = convertDefinitionInfoAndBoundSpan;
|
|
23
|
+
exports.convertDocumentSpantoLocationLink = convertDocumentSpantoLocationLink;
|
|
24
|
+
exports.convertTextSpan = convertTextSpan;
|
|
4
25
|
const path = require("path-browserify");
|
|
5
26
|
const semver = require("semver");
|
|
6
27
|
const PConst = require("../protocol.const");
|
|
7
|
-
const shared_1 = require("../shared");
|
|
8
28
|
const modifiers_1 = require("../utils/modifiers");
|
|
9
29
|
const previewer = require("../utils/previewer");
|
|
10
30
|
const typeConverters = require("../utils/typeConverters");
|
|
@@ -45,7 +65,6 @@ function convertDiagnostic(diag, document, fileNameToUri, getTextDocument) {
|
|
|
45
65
|
}
|
|
46
66
|
return diagnostic;
|
|
47
67
|
}
|
|
48
|
-
exports.convertDiagnostic = convertDiagnostic;
|
|
49
68
|
function convertDiagnosticRelatedInformation(diag, fileNameToUri, getTextDocument) {
|
|
50
69
|
if (diag.start === undefined) {
|
|
51
70
|
return;
|
|
@@ -130,7 +149,6 @@ function applyCompletionEntryDetails(ts, item, data, document, fileNameToUri, ge
|
|
|
130
149
|
handleKindModifiers(item, data);
|
|
131
150
|
}
|
|
132
151
|
}
|
|
133
|
-
exports.applyCompletionEntryDetails = applyCompletionEntryDetails;
|
|
134
152
|
// completion
|
|
135
153
|
function convertCompletionInfo(ts, completionContext, document, position, createData) {
|
|
136
154
|
const lt_320 = semver.lt(ts.version, '3.2.0');
|
|
@@ -330,7 +348,6 @@ function convertCompletionInfo(ts, completionContext, document, position, create
|
|
|
330
348
|
return true;
|
|
331
349
|
}
|
|
332
350
|
}
|
|
333
|
-
exports.convertCompletionInfo = convertCompletionInfo;
|
|
334
351
|
function convertCompletionItemKind(kind) {
|
|
335
352
|
switch (kind) {
|
|
336
353
|
case PConst.Kind.primitiveType:
|
|
@@ -426,7 +443,6 @@ function getLineText(document, line) {
|
|
|
426
443
|
});
|
|
427
444
|
return text;
|
|
428
445
|
}
|
|
429
|
-
exports.getLineText = getLineText;
|
|
430
446
|
// workspaceSymbol
|
|
431
447
|
function convertNavigateToItem(item, document) {
|
|
432
448
|
const info = {
|
|
@@ -443,7 +459,6 @@ function convertNavigateToItem(item, document) {
|
|
|
443
459
|
}
|
|
444
460
|
return info;
|
|
445
461
|
}
|
|
446
|
-
exports.convertNavigateToItem = convertNavigateToItem;
|
|
447
462
|
function getLabel(item) {
|
|
448
463
|
const label = item.name;
|
|
449
464
|
if (item.kind === 'method' || item.kind === 'function') {
|
|
@@ -480,7 +495,6 @@ function convertInlayHint(hint, document) {
|
|
|
480
495
|
result.paddingRight = hint.whitespaceAfter;
|
|
481
496
|
return result;
|
|
482
497
|
}
|
|
483
|
-
exports.convertInlayHint = convertInlayHint;
|
|
484
498
|
// documentHighlight
|
|
485
499
|
function convertHighlightSpan(span, document) {
|
|
486
500
|
return {
|
|
@@ -490,7 +504,6 @@ function convertHighlightSpan(span, document) {
|
|
|
490
504
|
range: convertTextSpan(span.textSpan, document),
|
|
491
505
|
};
|
|
492
506
|
}
|
|
493
|
-
exports.convertHighlightSpan = convertHighlightSpan;
|
|
494
507
|
// selectionRanges
|
|
495
508
|
function convertSelectionRange(range, document) {
|
|
496
509
|
return {
|
|
@@ -500,7 +513,6 @@ function convertSelectionRange(range, document) {
|
|
|
500
513
|
range: convertTextSpan(range.textSpan, document),
|
|
501
514
|
};
|
|
502
515
|
}
|
|
503
|
-
exports.convertSelectionRange = convertSelectionRange;
|
|
504
516
|
// rename
|
|
505
517
|
function convertFileTextChanges(changes, fileNameToUri, getTextDocument) {
|
|
506
518
|
const workspaceEdit = {};
|
|
@@ -538,7 +550,6 @@ function convertFileTextChanges(changes, fileNameToUri, getTextDocument) {
|
|
|
538
550
|
}
|
|
539
551
|
return workspaceEdit;
|
|
540
552
|
}
|
|
541
|
-
exports.convertFileTextChanges = convertFileTextChanges;
|
|
542
553
|
// rename file
|
|
543
554
|
function convertRenameLocations(newText, locations, fileNameToUri, getTextDocument) {
|
|
544
555
|
const workspaceEdit = {};
|
|
@@ -565,7 +576,6 @@ function convertRenameLocations(newText, locations, fileNameToUri, getTextDocume
|
|
|
565
576
|
}
|
|
566
577
|
return workspaceEdit;
|
|
567
578
|
}
|
|
568
|
-
exports.convertRenameLocations = convertRenameLocations;
|
|
569
579
|
// hover
|
|
570
580
|
function convertQuickInfo(ts, info, document, fileNameToUri, getTextDocument) {
|
|
571
581
|
const parts = [];
|
|
@@ -586,7 +596,6 @@ function convertQuickInfo(ts, info, document, fileNameToUri, getTextDocument) {
|
|
|
586
596
|
range: convertTextSpan(info.textSpan, document),
|
|
587
597
|
};
|
|
588
598
|
}
|
|
589
|
-
exports.convertQuickInfo = convertQuickInfo;
|
|
590
599
|
// documentSymbol
|
|
591
600
|
function convertNavTree(item, document) {
|
|
592
601
|
if (!shouldIncludeEntry(item)) {
|
|
@@ -630,7 +639,6 @@ function convertNavTree(item, document) {
|
|
|
630
639
|
return symbol;
|
|
631
640
|
});
|
|
632
641
|
}
|
|
633
|
-
exports.convertNavTree = convertNavTree;
|
|
634
642
|
const getSymbolKind = (kind) => {
|
|
635
643
|
switch (kind) {
|
|
636
644
|
case PConst.Kind.module: return 2;
|
|
@@ -669,7 +677,6 @@ function convertOutliningSpan(outliningSpan, document) {
|
|
|
669
677
|
kind: convertOutliningSpanKind(outliningSpan.kind),
|
|
670
678
|
};
|
|
671
679
|
}
|
|
672
|
-
exports.convertOutliningSpan = convertOutliningSpan;
|
|
673
680
|
function convertOutliningSpanKind(kind) {
|
|
674
681
|
switch (kind) {
|
|
675
682
|
case 'comment': return 'comment';
|
|
@@ -679,7 +686,6 @@ function convertOutliningSpanKind(kind) {
|
|
|
679
686
|
default: return undefined;
|
|
680
687
|
}
|
|
681
688
|
}
|
|
682
|
-
exports.convertOutliningSpanKind = convertOutliningSpanKind;
|
|
683
689
|
const foldEndPairCharacters = ['}', ']', ')', '`'];
|
|
684
690
|
// https://github.com/microsoft/vscode/blob/bed61166fb604e519e82e4d1d1ed839bc45d65f8/extensions/typescript-language-features/src/languageFeatures/folding.ts#L61-L73
|
|
685
691
|
function adjustFoldingEnd(start, end, document) {
|
|
@@ -703,7 +709,6 @@ function convertTextChange(edit, document) {
|
|
|
703
709
|
newText: edit.newText,
|
|
704
710
|
};
|
|
705
711
|
}
|
|
706
|
-
exports.convertTextChange = convertTextChange;
|
|
707
712
|
// callHierarchy
|
|
708
713
|
function convertCallHierarchyIncomingCall(item, ctx) {
|
|
709
714
|
const uri = ctx.fileNameToUri(item.from.file);
|
|
@@ -712,19 +717,17 @@ function convertCallHierarchyIncomingCall(item, ctx) {
|
|
|
712
717
|
from: convertCallHierarchyItem(item.from, ctx),
|
|
713
718
|
fromRanges: item.fromSpans
|
|
714
719
|
.map(span => convertTextSpan(span, document))
|
|
715
|
-
.filter(
|
|
720
|
+
.filter(span => !!span),
|
|
716
721
|
};
|
|
717
722
|
}
|
|
718
|
-
exports.convertCallHierarchyIncomingCall = convertCallHierarchyIncomingCall;
|
|
719
723
|
function convertCallHierarchyOutgoingCall(item, fromDocument, ctx) {
|
|
720
724
|
return {
|
|
721
725
|
to: convertCallHierarchyItem(item.to, ctx),
|
|
722
726
|
fromRanges: item.fromSpans
|
|
723
727
|
.map(span => convertTextSpan(span, fromDocument))
|
|
724
|
-
.filter(
|
|
728
|
+
.filter(span => !!span),
|
|
725
729
|
};
|
|
726
730
|
}
|
|
727
|
-
exports.convertCallHierarchyOutgoingCall = convertCallHierarchyOutgoingCall;
|
|
728
731
|
function convertCallHierarchyItem(item, ctx) {
|
|
729
732
|
const rootPath = ctx.languageService.getProgram()?.getCompilerOptions().rootDir ?? '';
|
|
730
733
|
const uri = ctx.fileNameToUri(item.file);
|
|
@@ -746,7 +749,6 @@ function convertCallHierarchyItem(item, ctx) {
|
|
|
746
749
|
}
|
|
747
750
|
return result;
|
|
748
751
|
}
|
|
749
|
-
exports.convertCallHierarchyItem = convertCallHierarchyItem;
|
|
750
752
|
function isSourceFileItem(item) {
|
|
751
753
|
return item.kind === PConst.Kind.script || item.kind === PConst.Kind.module && item.selectionSpan.start === 0;
|
|
752
754
|
}
|
|
@@ -760,7 +762,6 @@ function convertDocumentSpanToLocation(documentSpan, ctx) {
|
|
|
760
762
|
range,
|
|
761
763
|
};
|
|
762
764
|
}
|
|
763
|
-
exports.convertDocumentSpanToLocation = convertDocumentSpanToLocation;
|
|
764
765
|
function convertDefinitionInfoAndBoundSpan(info, document, ctx) {
|
|
765
766
|
if (!info.definitions) {
|
|
766
767
|
return [];
|
|
@@ -774,9 +775,8 @@ function convertDefinitionInfoAndBoundSpan(info, document, ctx) {
|
|
|
774
775
|
return link;
|
|
775
776
|
}
|
|
776
777
|
})
|
|
777
|
-
.filter(
|
|
778
|
+
.filter(entry => !!entry);
|
|
778
779
|
}
|
|
779
|
-
exports.convertDefinitionInfoAndBoundSpan = convertDefinitionInfoAndBoundSpan;
|
|
780
780
|
function convertDocumentSpantoLocationLink(documentSpan, ctx) {
|
|
781
781
|
const targetUri = ctx.fileNameToUri(documentSpan.fileName);
|
|
782
782
|
const document = ctx.getTextDocument(targetUri);
|
|
@@ -794,7 +794,6 @@ function convertDocumentSpantoLocationLink(documentSpan, ctx) {
|
|
|
794
794
|
originSelectionRange,
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
|
-
exports.convertDocumentSpantoLocationLink = convertDocumentSpantoLocationLink;
|
|
798
797
|
function convertTextSpan(textSpan, document) {
|
|
799
798
|
if (!document) {
|
|
800
799
|
return {
|
|
@@ -807,5 +806,4 @@ function convertTextSpan(textSpan, document) {
|
|
|
807
806
|
end: document.positionAt(textSpan.start + textSpan.length),
|
|
808
807
|
};
|
|
809
808
|
}
|
|
810
|
-
exports.convertTextSpan = convertTextSpan;
|
|
811
809
|
//# sourceMappingURL=lspConverters.js.map
|
package/lib/utils/modifiers.js
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.parseKindModifier =
|
|
7
|
+
exports.parseKindModifier = parseKindModifier;
|
|
8
8
|
function parseKindModifier(kindModifiers) {
|
|
9
9
|
return new Set(kindModifiers.split(/,|\s+/g));
|
|
10
10
|
}
|
|
11
|
-
exports.parseKindModifier = parseKindModifier;
|
|
12
11
|
//# sourceMappingURL=modifiers.js.map
|
package/lib/utils/previewer.js
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.plainWithLinks = plainWithLinks;
|
|
8
|
+
exports.tagsMarkdownPreview = tagsMarkdownPreview;
|
|
9
|
+
exports.markdownDocumentation = markdownDocumentation;
|
|
10
|
+
exports.addMarkdownDocumentation = addMarkdownDocumentation;
|
|
8
11
|
function replaceLinks(text) {
|
|
9
12
|
return text
|
|
10
13
|
// Http(s) links
|
|
@@ -84,7 +87,6 @@ function getTagDocumentation(tag, fileNameToUri, getTextDocument) {
|
|
|
84
87
|
function plainWithLinks(parts, fileNameToUri, getTextDocument) {
|
|
85
88
|
return processInlineTags(convertLinkTags(parts, fileNameToUri, getTextDocument));
|
|
86
89
|
}
|
|
87
|
-
exports.plainWithLinks = plainWithLinks;
|
|
88
90
|
/**
|
|
89
91
|
* Convert `@link` inline tags to markdown links
|
|
90
92
|
*/
|
|
@@ -171,11 +173,9 @@ function convertLinkTags(parts, fileNameToUri, getTextDocument) {
|
|
|
171
173
|
function tagsMarkdownPreview(tags, fileNameToUri, getTextDocument) {
|
|
172
174
|
return tags.map(tag => getTagDocumentation(tag, fileNameToUri, getTextDocument)).join(' \n\n');
|
|
173
175
|
}
|
|
174
|
-
exports.tagsMarkdownPreview = tagsMarkdownPreview;
|
|
175
176
|
function markdownDocumentation(documentation, tags, fileNameToUri, getTextDocument) {
|
|
176
177
|
return addMarkdownDocumentation('', documentation, tags, fileNameToUri, getTextDocument);
|
|
177
178
|
}
|
|
178
|
-
exports.markdownDocumentation = markdownDocumentation;
|
|
179
179
|
function addMarkdownDocumentation(out, documentation, tags, fileNameToUri, getTextDocument) {
|
|
180
180
|
if (documentation) {
|
|
181
181
|
out += plainWithLinks(documentation, fileNameToUri, getTextDocument);
|
|
@@ -188,5 +188,4 @@ function addMarkdownDocumentation(out, documentation, tags, fileNameToUri, getTe
|
|
|
188
188
|
}
|
|
189
189
|
return out;
|
|
190
190
|
}
|
|
191
|
-
exports.addMarkdownDocumentation = addMarkdownDocumentation;
|
|
192
191
|
//# sourceMappingURL=previewer.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.snippetForFunctionCall =
|
|
3
|
+
exports.snippetForFunctionCall = snippetForFunctionCall;
|
|
4
4
|
const PConst = require("../protocol.const");
|
|
5
5
|
function snippetForFunctionCall(item, displayParts) {
|
|
6
6
|
if (item.insertText && typeof item.insertText !== 'string') {
|
|
@@ -28,7 +28,6 @@ function snippetForFunctionCall(item, displayParts) {
|
|
|
28
28
|
return snippet;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
exports.snippetForFunctionCall = snippetForFunctionCall;
|
|
32
31
|
function getParameterListParts(displayParts) {
|
|
33
32
|
const parts = [];
|
|
34
33
|
let isInMethod = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
2
|
export declare namespace SymbolKind {
|
|
3
|
-
function fromProtocolScriptElementKind(kind: ts.ScriptElementKind): 2 | 5 |
|
|
3
|
+
function fromProtocolScriptElementKind(kind: ts.ScriptElementKind): 2 | 5 | 10 | 22 | 11 | 6 | 7 | 13 | 12 | 9 | 26 | 15;
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=typeConverters.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"description": "Integrate TypeScript into Volar",
|
|
5
5
|
"homepage": "https://github.com/volarjs/services/tree/master/packages/typescript",
|
|
6
6
|
"bugs": "https://github.com/volarjs/services/issues",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"path-browserify": "^1.0.1",
|
|
32
32
|
"semver": "^7.5.4",
|
|
33
|
-
"typescript-auto-import-cache": "^0.3.
|
|
33
|
+
"typescript-auto-import-cache": "^0.3.3",
|
|
34
34
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
35
35
|
"vscode-nls": "^5.2.0",
|
|
36
36
|
"vscode-uri": "^3.0.8"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@volar/language-service": "~2.3.
|
|
39
|
+
"@volar/language-service": "~2.3.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@volar/language-service": {
|
|
43
43
|
"optional": true
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "0038413c252e98b7d6b4e57eabdcb337d272d771"
|
|
47
47
|
}
|