volar-service-typescript 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/index.d.ts +8 -7
- package/out/index.js +38 -31
- package/out/services/tsconfig.d.ts +1 -1
- package/out/services/tsconfig.js +1 -1
- package/out/shared.d.ts +1 -1
- package/out/types.d.ts +1 -1
- package/out/utils/typeConverters.d.ts +1 -1
- package/package.json +2 -5
package/out/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Service } from '@volar/language-service';
|
|
2
2
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export interface Provide {
|
|
5
|
+
'typescript/typescript': () => typeof import('typescript/lib/tsserverlibrary');
|
|
6
|
+
'typescript/sourceFile': (_: TextDocument) => ts.SourceFile | undefined;
|
|
7
|
+
'typescript/languageService': (_: TextDocument) => ts.LanguageService | undefined;
|
|
8
|
+
'typescript/languageServiceHost': (_: TextDocument) => ts.LanguageServiceHost | undefined;
|
|
9
|
+
'typescript/textDocument': (uri: string) => TextDocument | undefined;
|
|
10
|
+
}
|
|
10
11
|
declare const _default: () => Service;
|
|
11
12
|
export default _default;
|
package/out/index.js
CHANGED
|
@@ -23,8 +23,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.rulesInjectionKey = void 0;
|
|
27
|
-
const language_service_1 = require("@volar/language-service");
|
|
28
26
|
const semver = __importStar(require("semver"));
|
|
29
27
|
const vscode = __importStar(require("vscode-languageserver-protocol"));
|
|
30
28
|
const shared_1 = require("./shared");
|
|
@@ -55,7 +53,7 @@ const signatureHelp = __importStar(require("./services/signatureHelp"));
|
|
|
55
53
|
const typeDefinitions = __importStar(require("./services/typeDefinition"));
|
|
56
54
|
const workspaceSymbols = __importStar(require("./services/workspaceSymbol"));
|
|
57
55
|
const tsconfig = __importStar(require("./services/tsconfig"));
|
|
58
|
-
|
|
56
|
+
;
|
|
59
57
|
exports.default = () => (contextOrNull, modules) => {
|
|
60
58
|
const jsDocTriggerCharacter = '*';
|
|
61
59
|
const directiveCommentTriggerCharacter = '@';
|
|
@@ -116,6 +114,7 @@ exports.default = () => (contextOrNull, modules) => {
|
|
|
116
114
|
const callHierarchy = _callHierarchy.register(semanticCtx);
|
|
117
115
|
const tsconfigRequests = tsconfig.register(semanticCtx);
|
|
118
116
|
let syntacticHostCtx = {
|
|
117
|
+
document: undefined,
|
|
119
118
|
fileName: '',
|
|
120
119
|
fileVersion: 0,
|
|
121
120
|
snapshot: ts.ScriptSnapshot.fromString(''),
|
|
@@ -143,36 +142,35 @@ exports.default = () => (contextOrNull, modules) => {
|
|
|
143
142
|
const doFormatting = formatting.register(syntacticCtx);
|
|
144
143
|
const getFoldingRanges = foldingRanges.register(syntacticCtx);
|
|
145
144
|
return {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (sourceFile) {
|
|
154
|
-
return {
|
|
155
|
-
sourceFile,
|
|
156
|
-
languageService: syntacticCtx.typescript.languageService,
|
|
157
|
-
languageServiceHost: syntacticCtx.typescript.languageServiceHost,
|
|
158
|
-
getTextDocument: syntacticCtx.getTextDocument,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
const sourceFile = semanticCtx.typescript.languageService.getProgram()?.getSourceFile(context.env.uriToFileName(document.uri));
|
|
164
|
-
if (sourceFile) {
|
|
165
|
-
return {
|
|
166
|
-
sourceFile,
|
|
167
|
-
languageService: semanticCtx.typescript.languageService,
|
|
168
|
-
languageServiceHost: semanticCtx.typescript.languageServiceHost,
|
|
169
|
-
getTextDocument: semanticCtx.getTextDocument,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
145
|
+
provide: {
|
|
146
|
+
'typescript/typescript': () => ts,
|
|
147
|
+
'typescript/sourceFile': document => {
|
|
148
|
+
if ((0, shared_1.isTsDocument)(document)) {
|
|
149
|
+
const sourceFile = getSemanticServiceSourceFile(document.uri);
|
|
150
|
+
if (sourceFile) {
|
|
151
|
+
return sourceFile;
|
|
173
152
|
}
|
|
174
|
-
|
|
153
|
+
prepareSyntacticService(document);
|
|
154
|
+
return syntacticCtx.typescript.languageService.getProgram()?.getSourceFile(syntacticHostCtx.fileName);
|
|
155
|
+
}
|
|
175
156
|
},
|
|
157
|
+
'typescript/languageService': document => {
|
|
158
|
+
const sourceFile = getSemanticServiceSourceFile(document.uri);
|
|
159
|
+
if (sourceFile) {
|
|
160
|
+
return semanticCtx.typescript.languageService;
|
|
161
|
+
}
|
|
162
|
+
prepareSyntacticService(document);
|
|
163
|
+
return syntacticCtx.typescript.languageService;
|
|
164
|
+
},
|
|
165
|
+
'typescript/languageServiceHost': document => {
|
|
166
|
+
const sourceFile = getSemanticServiceSourceFile(document.uri);
|
|
167
|
+
if (sourceFile) {
|
|
168
|
+
return semanticCtx.typescript.languageServiceHost;
|
|
169
|
+
}
|
|
170
|
+
prepareSyntacticService(document);
|
|
171
|
+
return syntacticCtx.typescript.languageServiceHost;
|
|
172
|
+
},
|
|
173
|
+
'typescript/textDocument': semanticCtx.getTextDocument,
|
|
176
174
|
},
|
|
177
175
|
...triggerCharacters,
|
|
178
176
|
triggerCharacters: [
|
|
@@ -392,7 +390,16 @@ exports.default = () => (contextOrNull, modules) => {
|
|
|
392
390
|
return tsconfigRequests.resolve(link, token);
|
|
393
391
|
},
|
|
394
392
|
};
|
|
393
|
+
function getSemanticServiceSourceFile(uri) {
|
|
394
|
+
const sourceFile = semanticCtx.typescript.languageService.getProgram()?.getSourceFile(context.env.uriToFileName(uri));
|
|
395
|
+
if (sourceFile) {
|
|
396
|
+
return sourceFile;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
395
399
|
function prepareSyntacticService(document) {
|
|
400
|
+
if (syntacticHostCtx.document === document && syntacticHostCtx.fileVersion === document.version) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
396
403
|
syntacticHostCtx.fileName = context.env.uriToFileName(document.uri);
|
|
397
404
|
syntacticHostCtx.fileVersion = document.version;
|
|
398
405
|
if (context.documents.isVirtualFileUri(document.uri)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as vscode from '
|
|
1
|
+
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import { SharedContext } from '../types';
|
|
3
3
|
export declare function register(ctx: SharedContext): {
|
|
4
4
|
provideDocumentLinks: (document: vscode.TextDocument, _token: vscode.CancellationToken) => vscode.DocumentLink[];
|
package/out/services/tsconfig.js
CHANGED
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.register = void 0;
|
|
27
27
|
const jsonc = __importStar(require("jsonc-parser"));
|
|
28
28
|
const minimatch_1 = require("minimatch");
|
|
29
|
-
const vscode = __importStar(require("
|
|
29
|
+
const vscode = __importStar(require("vscode-languageserver-protocol"));
|
|
30
30
|
const vscode_uri_1 = require("vscode-uri");
|
|
31
31
|
function mapChildren(node, f) {
|
|
32
32
|
return node && node.type === 'array' && node.children
|
package/out/shared.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
1
|
+
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
2
2
|
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;
|
package/out/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServiceContext } from
|
|
1
|
+
import type { ServiceContext } from '@volar/language-service';
|
|
2
2
|
export type SharedContext = ServiceContext & {
|
|
3
3
|
typescript: NonNullable<ServiceContext['typescript']>;
|
|
4
4
|
ts: typeof import('typescript/lib/tsserverlibrary');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -24,8 +24,5 @@
|
|
|
24
24
|
"vscode-nls": "^5.2.0",
|
|
25
25
|
"vscode-uri": "^3.0.7"
|
|
26
26
|
},
|
|
27
|
-
"
|
|
28
|
-
"@volar/language-service": "*"
|
|
29
|
-
},
|
|
30
|
-
"gitHead": "5bf5152f076f25cb1ddbc7aa6978a8d1c7009fd6"
|
|
27
|
+
"gitHead": "28896539331e31b4ef1064b6839ea0924d5d28d0"
|
|
31
28
|
}
|