volar-service-typescript 0.0.2 → 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 CHANGED
@@ -1,12 +1,12 @@
1
- import { InjectionKey, Service } from '@volar/language-service';
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 declare const injectionKeys: {
5
- typescript: InjectionKey<[], typeof import('typescript/lib/tsserverlibrary')>;
6
- sourceFile: InjectionKey<[TextDocument], ts.SourceFile>;
7
- languageService: InjectionKey<[TextDocument], ts.LanguageService>;
8
- languageServiceHost: InjectionKey<[TextDocument], ts.LanguageServiceHost>;
9
- textDocument: InjectionKey<[uri: string], TextDocument>;
10
- };
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
+ }
11
11
  declare const _default: () => Service;
12
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.injectionKeys = 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,13 +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
- exports.injectionKeys = {
59
- typescript: 'typescript/typescript',
60
- sourceFile: 'typescript/sourceFile',
61
- languageService: 'typescript/languageService',
62
- languageServiceHost: 'typescript/languageServiceHost',
63
- textDocument: 'typescript/textDocument',
64
- };
56
+ ;
65
57
  exports.default = () => (contextOrNull, modules) => {
66
58
  const jsDocTriggerCharacter = '*';
67
59
  const directiveCommentTriggerCharacter = '@';
@@ -151,8 +143,8 @@ exports.default = () => (contextOrNull, modules) => {
151
143
  const getFoldingRanges = foldingRanges.register(syntacticCtx);
152
144
  return {
153
145
  provide: {
154
- ...(0, language_service_1.defineProvide)(exports.injectionKeys.typescript, () => ts),
155
- ...(0, language_service_1.defineProvide)(exports.injectionKeys.sourceFile, document => {
146
+ 'typescript/typescript': () => ts,
147
+ 'typescript/sourceFile': document => {
156
148
  if ((0, shared_1.isTsDocument)(document)) {
157
149
  const sourceFile = getSemanticServiceSourceFile(document.uri);
158
150
  if (sourceFile) {
@@ -161,24 +153,24 @@ exports.default = () => (contextOrNull, modules) => {
161
153
  prepareSyntacticService(document);
162
154
  return syntacticCtx.typescript.languageService.getProgram()?.getSourceFile(syntacticHostCtx.fileName);
163
155
  }
164
- }),
165
- ...(0, language_service_1.defineProvide)(exports.injectionKeys.languageService, document => {
156
+ },
157
+ 'typescript/languageService': document => {
166
158
  const sourceFile = getSemanticServiceSourceFile(document.uri);
167
159
  if (sourceFile) {
168
160
  return semanticCtx.typescript.languageService;
169
161
  }
170
162
  prepareSyntacticService(document);
171
163
  return syntacticCtx.typescript.languageService;
172
- }),
173
- ...(0, language_service_1.defineProvide)(exports.injectionKeys.languageServiceHost, document => {
164
+ },
165
+ 'typescript/languageServiceHost': document => {
174
166
  const sourceFile = getSemanticServiceSourceFile(document.uri);
175
167
  if (sourceFile) {
176
168
  return semanticCtx.typescript.languageServiceHost;
177
169
  }
178
170
  prepareSyntacticService(document);
179
171
  return syntacticCtx.typescript.languageServiceHost;
180
- }),
181
- ...(0, language_service_1.defineProvide)(exports.injectionKeys.textDocument, semanticCtx.getTextDocument),
172
+ },
173
+ 'typescript/textDocument': semanticCtx.getTextDocument,
182
174
  },
183
175
  ...triggerCharacters,
184
176
  triggerCharacters: [
@@ -1,4 +1,4 @@
1
- import * as vscode from '@volar/language-service';
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[];
@@ -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("@volar/language-service"));
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 "@volar/language-service";
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-typescript",
3
- "version": "0.0.2",
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
- "peerDependencies": {
28
- "@volar/language-service": "*"
29
- },
30
- "gitHead": "19482084693c7349f461dc75ec52ee6917739c51"
27
+ "gitHead": "28896539331e31b4ef1064b6839ea0924d5d28d0"
31
28
  }