volar-service-typescript 0.0.41 → 0.0.43-patch.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/lib/plugins/semantic.js +0 -1
- package/lib/semanticFeatures/types.d.ts +1 -1
- package/lib/syntaxOnlyService.js +1 -1
- package/lib/utils/lspConverters.d.ts +7 -7
- package/lib/utils/lspConverters.js +6 -0
- package/lib/utils/previewer.d.ts +4 -4
- package/lib/utils/previewer.js +28 -13
- package/lib/utils/typeConverters.d.ts +1 -1
- package/package.json +3 -4
package/lib/plugins/semantic.js
CHANGED
|
@@ -126,7 +126,6 @@ function create(ts, { isValidationEnabled = async (document, context) => {
|
|
|
126
126
|
return context.documents.get(uri, sourceFile.languageId, sourceFile.snapshot);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
throw new Error(`getTextDocument: uri not found: ${uri}`);
|
|
130
129
|
},
|
|
131
130
|
};
|
|
132
131
|
const getCodeActions = codeActions.register(ctx);
|
|
@@ -4,7 +4,7 @@ import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
|
4
4
|
export type SharedContext = ServiceContext & {
|
|
5
5
|
languageServiceHost: ts.LanguageServiceHost;
|
|
6
6
|
languageService: ts.LanguageService;
|
|
7
|
-
getTextDocument: (uri: string) => TextDocument;
|
|
7
|
+
getTextDocument: (uri: string) => TextDocument | undefined;
|
|
8
8
|
uriToFileName: (uri: string) => string;
|
|
9
9
|
fileNameToUri: (fileName: string) => string;
|
|
10
10
|
};
|
package/lib/syntaxOnlyService.js
CHANGED
|
@@ -8,9 +8,9 @@ function createSyntaxOnlyService(ts, syntaxOnly) {
|
|
|
8
8
|
const host = {
|
|
9
9
|
getProjectVersion: () => currentProjectVersion.toString(),
|
|
10
10
|
getScriptFileNames: () => fileNames,
|
|
11
|
-
getScriptVersion: () => currentProjectVersion.toString(),
|
|
12
11
|
getScriptSnapshot: fileName => scriptInfos.get(fileName).snapshot,
|
|
13
12
|
getScriptKind: fileName => scriptInfos.get(fileName).kind,
|
|
13
|
+
getScriptVersion: fileName => scriptInfos.get(fileName).version.toString(),
|
|
14
14
|
getCompilationSettings: () => ({}),
|
|
15
15
|
getCurrentDirectory: () => '',
|
|
16
16
|
getDefaultLibFileName: () => '',
|
|
@@ -2,26 +2,26 @@ import type * as vscode from '@volar/language-service';
|
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
import type { SharedContext } from '../semanticFeatures/types';
|
|
5
|
-
export declare function convertDiagnostic(diag: ts.Diagnostic, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.Diagnostic | undefined;
|
|
6
|
-
export declare function applyCompletionEntryDetails(ts: typeof import('typescript'), item: vscode.CompletionItem, data: ts.CompletionEntryDetails, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): void;
|
|
5
|
+
export declare function convertDiagnostic(diag: ts.Diagnostic, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.Diagnostic | undefined;
|
|
6
|
+
export declare function applyCompletionEntryDetails(ts: typeof import('typescript'), item: vscode.CompletionItem, data: ts.CompletionEntryDetails, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): void;
|
|
7
7
|
export declare function convertCompletionInfo<T>(ts: typeof import('typescript'), completionContext: ts.CompletionInfo, document: TextDocument, position: vscode.Position, createData: (tsEntry: ts.CompletionEntry) => T): vscode.CompletionList;
|
|
8
8
|
export declare function getLineText(document: TextDocument, line: number): string;
|
|
9
9
|
export declare function convertNavigateToItem(item: ts.NavigateToItem, document: TextDocument): vscode.WorkspaceSymbol;
|
|
10
10
|
export declare function convertInlayHint(hint: ts.InlayHint, document: TextDocument): vscode.InlayHint;
|
|
11
11
|
export declare function convertHighlightSpan(span: ts.HighlightSpan, document: TextDocument): vscode.DocumentHighlight;
|
|
12
12
|
export declare function convertSelectionRange(range: ts.SelectionRange, document: TextDocument): vscode.SelectionRange;
|
|
13
|
-
export declare function convertFileTextChanges(changes: readonly ts.FileTextChanges[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.WorkspaceEdit;
|
|
14
|
-
export declare function convertRenameLocations(newText: string, locations: readonly ts.RenameLocation[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.WorkspaceEdit;
|
|
15
|
-
export declare function convertQuickInfo(ts: typeof import('typescript'), info: ts.QuickInfo, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.Hover;
|
|
13
|
+
export declare function convertFileTextChanges(changes: readonly ts.FileTextChanges[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.WorkspaceEdit;
|
|
14
|
+
export declare function convertRenameLocations(newText: string, locations: readonly ts.RenameLocation[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.WorkspaceEdit;
|
|
15
|
+
export declare function convertQuickInfo(ts: typeof import('typescript'), info: ts.QuickInfo, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.Hover;
|
|
16
16
|
export declare function convertNavTree(item: ts.NavigationTree, document: TextDocument): vscode.DocumentSymbol[];
|
|
17
17
|
export declare function convertOutliningSpan(outliningSpan: ts.OutliningSpan, document: TextDocument): vscode.FoldingRange;
|
|
18
18
|
export declare function convertOutliningSpanKind(kind: ts.OutliningSpanKind): vscode.FoldingRangeKind | undefined;
|
|
19
|
-
export declare function convertTextChange(edit: ts.TextChange, document: TextDocument): vscode.TextEdit;
|
|
19
|
+
export declare function convertTextChange(edit: ts.TextChange, document: TextDocument | undefined): vscode.TextEdit;
|
|
20
20
|
export declare function convertCallHierarchyIncomingCall(item: ts.CallHierarchyIncomingCall, ctx: SharedContext): vscode.CallHierarchyIncomingCall;
|
|
21
21
|
export declare function convertCallHierarchyOutgoingCall(item: ts.CallHierarchyOutgoingCall, fromDocument: TextDocument, ctx: SharedContext): vscode.CallHierarchyOutgoingCall;
|
|
22
22
|
export declare function convertCallHierarchyItem(item: ts.CallHierarchyItem, ctx: SharedContext): vscode.CallHierarchyItem;
|
|
23
23
|
export declare function convertDocumentSpanToLocation(documentSpan: ts.DocumentSpan, ctx: SharedContext): vscode.Location;
|
|
24
24
|
export declare function convertDefinitionInfoAndBoundSpan(info: ts.DefinitionInfoAndBoundSpan, document: TextDocument, ctx: SharedContext): vscode.LocationLink[];
|
|
25
25
|
export declare function convertDocumentSpantoLocationLink(documentSpan: ts.DocumentSpan, ctx: SharedContext): vscode.LocationLink;
|
|
26
|
-
export declare function convertTextSpan(textSpan: ts.TextSpan, document: TextDocument): vscode.Range;
|
|
26
|
+
export declare function convertTextSpan(textSpan: ts.TextSpan, document: TextDocument | undefined): vscode.Range;
|
|
27
27
|
//# sourceMappingURL=lspConverters.d.ts.map
|
|
@@ -781,6 +781,12 @@ function convertDocumentSpantoLocationLink(documentSpan, ctx) {
|
|
|
781
781
|
}
|
|
782
782
|
exports.convertDocumentSpantoLocationLink = convertDocumentSpantoLocationLink;
|
|
783
783
|
function convertTextSpan(textSpan, document) {
|
|
784
|
+
if (!document) {
|
|
785
|
+
return {
|
|
786
|
+
start: { line: 0, character: 0 },
|
|
787
|
+
end: { line: 0, character: 0 },
|
|
788
|
+
};
|
|
789
|
+
}
|
|
784
790
|
return {
|
|
785
791
|
start: document.positionAt(textSpan.start),
|
|
786
792
|
end: document.positionAt(textSpan.start + textSpan.length),
|
package/lib/utils/previewer.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
2
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
export declare function plainWithLinks(parts: readonly ts.server.protocol.SymbolDisplayPart[] | string, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string;
|
|
4
|
-
export declare function tagsMarkdownPreview(tags: readonly ts.JSDocTagInfo[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string;
|
|
5
|
-
export declare function markdownDocumentation(documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string;
|
|
6
|
-
export declare function addMarkdownDocumentation(out: string, documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string;
|
|
3
|
+
export declare function plainWithLinks(parts: readonly ts.server.protocol.SymbolDisplayPart[] | string, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string;
|
|
4
|
+
export declare function tagsMarkdownPreview(tags: readonly ts.JSDocTagInfo[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string;
|
|
5
|
+
export declare function markdownDocumentation(documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string;
|
|
6
|
+
export declare function addMarkdownDocumentation(out: string, documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string;
|
|
7
7
|
//# sourceMappingURL=previewer.d.ts.map
|
package/lib/utils/previewer.js
CHANGED
|
@@ -106,19 +106,34 @@ function convertLinkTags(parts, fileNameToUri, getTextDocument) {
|
|
|
106
106
|
if (typeof currentLink.target === 'object' && 'fileName' in currentLink.target) {
|
|
107
107
|
const _target = currentLink.target;
|
|
108
108
|
const fileDoc = getTextDocument(fileNameToUri(_target.fileName));
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
109
|
+
if (fileDoc) {
|
|
110
|
+
const start = fileDoc.positionAt(_target.textSpan.start);
|
|
111
|
+
const end = fileDoc.positionAt(_target.textSpan.start + _target.textSpan.length);
|
|
112
|
+
target = {
|
|
113
|
+
file: _target.fileName,
|
|
114
|
+
start: {
|
|
115
|
+
line: start.line + 1,
|
|
116
|
+
offset: start.character + 1,
|
|
117
|
+
},
|
|
118
|
+
end: {
|
|
119
|
+
line: end.line + 1,
|
|
120
|
+
offset: end.character + 1,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
target = {
|
|
126
|
+
file: _target.fileName,
|
|
127
|
+
start: {
|
|
128
|
+
line: 1,
|
|
129
|
+
offset: 1,
|
|
130
|
+
},
|
|
131
|
+
end: {
|
|
132
|
+
line: 1,
|
|
133
|
+
offset: 1,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
122
137
|
}
|
|
123
138
|
if (target) {
|
|
124
139
|
const link = fileNameToUri(target.file) + '#' + `L${target.start.line},${target.start.offset}`;
|
|
@@ -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.43-patch.1",
|
|
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",
|
|
@@ -35,12 +35,11 @@
|
|
|
35
35
|
"vscode-nls": "^5.2.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@volar/language-service": "~2.2.0
|
|
38
|
+
"@volar/language-service": "~2.2.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@volar/language-service": {
|
|
42
42
|
"optional": true
|
|
43
43
|
}
|
|
44
|
-
}
|
|
45
|
-
"gitHead": "431484e404a9696a8e4dbae5db8588d9828f78ac"
|
|
44
|
+
}
|
|
46
45
|
}
|