volar-service-typescript 0.0.21 → 0.0.23

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.
Files changed (83) hide show
  1. package/{out/index.js → index.js} +49 -42
  2. package/lib/protocol.d.ts +2 -0
  3. package/lib/protocol.js +3 -0
  4. package/lib/utils/previewer.d.ts +13 -0
  5. package/lib/utils/snippetForFunctionCall.d.ts +9 -0
  6. package/package.json +4 -5
  7. package/out/utils/previewer.d.ts +0 -14
  8. package/out/utils/snippetForFunctionCall.d.ts +0 -9
  9. /package/{out/index.d.ts → index.d.ts} +0 -0
  10. /package/{out → lib}/configs/getFormatCodeSettings.d.ts +0 -0
  11. /package/{out → lib}/configs/getFormatCodeSettings.js +0 -0
  12. /package/{out → lib}/configs/getUserPreferences.d.ts +0 -0
  13. /package/{out → lib}/configs/getUserPreferences.js +0 -0
  14. /package/{out → lib}/features/callHierarchy.d.ts +0 -0
  15. /package/{out → lib}/features/callHierarchy.js +0 -0
  16. /package/{out → lib}/features/codeAction.d.ts +0 -0
  17. /package/{out → lib}/features/codeAction.js +0 -0
  18. /package/{out → lib}/features/codeActionResolve.d.ts +0 -0
  19. /package/{out → lib}/features/codeActionResolve.js +0 -0
  20. /package/{out → lib}/features/completions/basic.d.ts +0 -0
  21. /package/{out → lib}/features/completions/basic.js +0 -0
  22. /package/{out → lib}/features/completions/directiveComment.d.ts +0 -0
  23. /package/{out → lib}/features/completions/directiveComment.js +0 -0
  24. /package/{out → lib}/features/completions/jsDoc.d.ts +0 -0
  25. /package/{out → lib}/features/completions/jsDoc.js +0 -0
  26. /package/{out → lib}/features/completions/resolve.d.ts +0 -0
  27. /package/{out → lib}/features/completions/resolve.js +0 -0
  28. /package/{out → lib}/features/definition.d.ts +0 -0
  29. /package/{out → lib}/features/definition.js +0 -0
  30. /package/{out → lib}/features/diagnostics.d.ts +0 -0
  31. /package/{out → lib}/features/diagnostics.js +0 -0
  32. /package/{out → lib}/features/documentHighlight.d.ts +0 -0
  33. /package/{out → lib}/features/documentHighlight.js +0 -0
  34. /package/{out → lib}/features/documentSymbol.d.ts +0 -0
  35. /package/{out → lib}/features/documentSymbol.js +0 -0
  36. /package/{out → lib}/features/fileReferences.d.ts +0 -0
  37. /package/{out → lib}/features/fileReferences.js +0 -0
  38. /package/{out → lib}/features/fileRename.d.ts +0 -0
  39. /package/{out → lib}/features/fileRename.js +0 -0
  40. /package/{out → lib}/features/foldingRanges.d.ts +0 -0
  41. /package/{out → lib}/features/foldingRanges.js +0 -0
  42. /package/{out → lib}/features/formatting.d.ts +0 -0
  43. /package/{out → lib}/features/formatting.js +0 -0
  44. /package/{out → lib}/features/hover.d.ts +0 -0
  45. /package/{out → lib}/features/hover.js +0 -0
  46. /package/{out → lib}/features/implementation.d.ts +0 -0
  47. /package/{out → lib}/features/implementation.js +0 -0
  48. /package/{out → lib}/features/inlayHints.d.ts +0 -0
  49. /package/{out → lib}/features/inlayHints.js +0 -0
  50. /package/{out → lib}/features/prepareRename.d.ts +0 -0
  51. /package/{out → lib}/features/prepareRename.js +0 -0
  52. /package/{out → lib}/features/references.d.ts +0 -0
  53. /package/{out → lib}/features/references.js +0 -0
  54. /package/{out → lib}/features/rename.d.ts +0 -0
  55. /package/{out → lib}/features/rename.js +0 -0
  56. /package/{out → lib}/features/selectionRanges.d.ts +0 -0
  57. /package/{out → lib}/features/selectionRanges.js +0 -0
  58. /package/{out → lib}/features/semanticTokens.d.ts +0 -0
  59. /package/{out → lib}/features/semanticTokens.js +0 -0
  60. /package/{out → lib}/features/signatureHelp.d.ts +0 -0
  61. /package/{out → lib}/features/signatureHelp.js +0 -0
  62. /package/{out → lib}/features/typeDefinition.d.ts +0 -0
  63. /package/{out → lib}/features/typeDefinition.js +0 -0
  64. /package/{out → lib}/features/workspaceSymbol.d.ts +0 -0
  65. /package/{out → lib}/features/workspaceSymbol.js +0 -0
  66. /package/{out → lib}/protocol.const.d.ts +0 -0
  67. /package/{out → lib}/protocol.const.js +0 -0
  68. /package/{out → lib}/shared.d.ts +0 -0
  69. /package/{out → lib}/shared.js +0 -0
  70. /package/{out → lib}/types.d.ts +0 -0
  71. /package/{out → lib}/types.js +0 -0
  72. /package/{out → lib}/utils/errorCodes.d.ts +0 -0
  73. /package/{out → lib}/utils/errorCodes.js +0 -0
  74. /package/{out → lib}/utils/fixNames.d.ts +0 -0
  75. /package/{out → lib}/utils/fixNames.js +0 -0
  76. /package/{out → lib}/utils/modifiers.d.ts +0 -0
  77. /package/{out → lib}/utils/modifiers.js +0 -0
  78. /package/{out → lib}/utils/previewer.js +0 -0
  79. /package/{out → lib}/utils/snippetForFunctionCall.js +0 -0
  80. /package/{out → lib}/utils/transforms.d.ts +0 -0
  81. /package/{out → lib}/utils/transforms.js +0 -0
  82. /package/{out → lib}/utils/typeConverters.d.ts +0 -0
  83. /package/{out → lib}/utils/typeConverters.js +0 -0
@@ -17,35 +17,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.create = void 0;
18
18
  const semver = require("semver");
19
19
  const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
20
- const shared_1 = require("./shared");
20
+ const shared_1 = require("./lib/shared");
21
21
  const typescript_1 = require("@volar/typescript");
22
22
  const tsFaster = require("typescript-auto-import-cache");
23
- const _callHierarchy = require("./features/callHierarchy");
24
- const codeActions = require("./features/codeAction");
25
- const codeActionResolve = require("./features/codeActionResolve");
26
- const completions = require("./features/completions/basic");
27
- const directiveCommentCompletions = require("./features/completions/directiveComment");
28
- const jsDocCompletions = require("./features/completions/jsDoc");
29
- const completionResolve = require("./features/completions/resolve");
30
- const definitions = require("./features/definition");
31
- const diagnostics = require("./features/diagnostics");
32
- const documentHighlight = require("./features/documentHighlight");
33
- const documentSymbol = require("./features/documentSymbol");
34
- const fileReferences = require("./features/fileReferences");
35
- const fileRename = require("./features/fileRename");
36
- const foldingRanges = require("./features/foldingRanges");
37
- const formatting = require("./features/formatting");
38
- const hover = require("./features/hover");
39
- const implementation = require("./features/implementation");
40
- const inlayHints = require("./features/inlayHints");
41
- const prepareRename = require("./features/prepareRename");
42
- const references = require("./features/references");
43
- const rename = require("./features/rename");
44
- const selectionRanges = require("./features/selectionRanges");
45
- const semanticTokens = require("./features/semanticTokens");
46
- const signatureHelp = require("./features/signatureHelp");
47
- const typeDefinitions = require("./features/typeDefinition");
48
- const workspaceSymbols = require("./features/workspaceSymbol");
23
+ const _callHierarchy = require("./lib/features/callHierarchy");
24
+ const codeActions = require("./lib/features/codeAction");
25
+ const codeActionResolve = require("./lib/features/codeActionResolve");
26
+ const completions = require("./lib/features/completions/basic");
27
+ const directiveCommentCompletions = require("./lib/features/completions/directiveComment");
28
+ const jsDocCompletions = require("./lib/features/completions/jsDoc");
29
+ const completionResolve = require("./lib/features/completions/resolve");
30
+ const definitions = require("./lib/features/definition");
31
+ const diagnostics = require("./lib/features/diagnostics");
32
+ const documentHighlight = require("./lib/features/documentHighlight");
33
+ const documentSymbol = require("./lib/features/documentSymbol");
34
+ const fileReferences = require("./lib/features/fileReferences");
35
+ const fileRename = require("./lib/features/fileRename");
36
+ const foldingRanges = require("./lib/features/foldingRanges");
37
+ const formatting = require("./lib/features/formatting");
38
+ const hover = require("./lib/features/hover");
39
+ const implementation = require("./lib/features/implementation");
40
+ const inlayHints = require("./lib/features/inlayHints");
41
+ const prepareRename = require("./lib/features/prepareRename");
42
+ const references = require("./lib/features/references");
43
+ const rename = require("./lib/features/rename");
44
+ const selectionRanges = require("./lib/features/selectionRanges");
45
+ const semanticTokens = require("./lib/features/semanticTokens");
46
+ const signatureHelp = require("./lib/features/signatureHelp");
47
+ const typeDefinitions = require("./lib/features/typeDefinition");
48
+ const workspaceSymbols = require("./lib/features/workspaceSymbol");
49
49
  __exportStar(require("@volar/typescript"), exports);
50
50
  ;
51
51
  function create(ts) {
@@ -117,8 +117,7 @@ function create(ts) {
117
117
  provideAutoInsertionEdit(document, position, lastChange) {
118
118
  if ((document.languageId === 'javascriptreact' || document.languageId === 'typescriptreact')
119
119
  && lastChange.text.endsWith('>')) {
120
- const configName = document.languageId === 'javascriptreact' ? 'javascript.autoClosingTags' : 'typescript.autoClosingTags';
121
- const config = context.env.getConfiguration?.(configName) ?? true;
120
+ const config = context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.autoClosingTags') ?? true;
122
121
  if (config) {
123
122
  prepareSyntacticService(document);
124
123
  const close = syntacticCtx.typescript.languageService.getJsxClosingTagAtPosition(context.env.uriToFileName(document.uri), document.offsetAt(position));
@@ -143,8 +142,8 @@ function create(ts) {
143
142
  async provideDocumentFormattingEdits(document, range, options_2) {
144
143
  if (!(0, shared_1.isTsDocument)(document))
145
144
  return;
146
- const enable = await context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.format.enable');
147
- if (enable === false) {
145
+ const enable = await context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.format.enable') ?? true;
146
+ if (!enable) {
148
147
  return;
149
148
  }
150
149
  prepareSyntacticService(document);
@@ -153,8 +152,8 @@ function create(ts) {
153
152
  async provideOnTypeFormattingEdits(document, position, key, options_2) {
154
153
  if (!(0, shared_1.isTsDocument)(document))
155
154
  return;
156
- const enable = await context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.format.enable');
157
- if (enable === false) {
155
+ const enable = await context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.format.enable') ?? true;
156
+ if (!enable) {
158
157
  return;
159
158
  }
160
159
  prepareSyntacticService(document);
@@ -291,31 +290,35 @@ function create(ts) {
291
290
  dispose() {
292
291
  languageService.dispose();
293
292
  },
294
- provideCompletionItems(document, position, context, token) {
293
+ async provideCompletionItems(document, position, completeContext, token) {
295
294
  if (!(0, shared_1.isTsDocument)(document))
296
295
  return;
297
- return worker(token, async () => {
296
+ const enable = await context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.suggest.enabled') ?? true;
297
+ if (!enable) {
298
+ return;
299
+ }
300
+ return await worker(token, async () => {
298
301
  let result = {
299
302
  isIncomplete: false,
300
303
  items: [],
301
304
  };
302
- if (!context || context.triggerKind !== 2 || (context.triggerCharacter && basicTriggerCharacters.includes(context.triggerCharacter))) {
305
+ if (!completeContext || completeContext.triggerKind !== 2 || (completeContext.triggerCharacter && basicTriggerCharacters.includes(completeContext.triggerCharacter))) {
303
306
  const completeOptions = {
304
- triggerCharacter: context.triggerCharacter,
305
- triggerKind: context.triggerKind,
307
+ triggerCharacter: completeContext.triggerCharacter,
308
+ triggerKind: completeContext.triggerKind,
306
309
  };
307
310
  const basicResult = await doComplete(document.uri, position, completeOptions);
308
311
  if (basicResult) {
309
312
  result = basicResult;
310
313
  }
311
314
  }
312
- if (!context || context.triggerKind !== 2 || context.triggerCharacter === jsDocTriggerCharacter) {
315
+ if (!completeContext || completeContext.triggerKind !== 2 || completeContext.triggerCharacter === jsDocTriggerCharacter) {
313
316
  const jsdocResult = await doJsDocComplete(document.uri, position);
314
317
  if (jsdocResult) {
315
318
  result.items.push(jsdocResult);
316
319
  }
317
320
  }
318
- if (!context || context.triggerKind !== 2 || context.triggerCharacter === directiveCommentTriggerCharacter) {
321
+ if (!completeContext || completeContext.triggerKind !== 2 || completeContext.triggerCharacter === directiveCommentTriggerCharacter) {
319
322
  const directiveCommentResult = await doDirectiveCommentComplete(document.uri, position);
320
323
  if (directiveCommentResult) {
321
324
  result.items = result.items.concat(directiveCommentResult);
@@ -393,10 +396,14 @@ function create(ts) {
393
396
  return findTypeDefinition(document.uri, position);
394
397
  });
395
398
  },
396
- provideDiagnostics(document, token) {
399
+ async provideDiagnostics(document, token) {
397
400
  if (!(0, shared_1.isTsDocument)(document))
398
401
  return;
399
- return worker(token, () => {
402
+ const enable = await context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.validate.enable') ?? true;
403
+ if (!enable) {
404
+ return;
405
+ }
406
+ return await worker(token, () => {
400
407
  return doValidation(document.uri, { syntactic: true, suggestion: true });
401
408
  });
402
409
  },
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1,13 @@
1
+ import type * as ts from 'typescript/lib/tsserverlibrary';
2
+ import type { SharedContext } from '../types';
3
+ export interface IFilePathToResourceConverter {
4
+ /**
5
+ * Convert a typescript filepath to a VS Code resource.
6
+ */
7
+ toResource(filepath: string): string;
8
+ }
9
+ export declare function plainWithLinks(parts: readonly ts.server.protocol.SymbolDisplayPart[] | string, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext): string;
10
+ export declare function tagsMarkdownPreview(tags: readonly ts.JSDocTagInfo[], filePathConverter: IFilePathToResourceConverter, ctx: SharedContext): string;
11
+ export declare function markdownDocumentation(documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext): string;
12
+ export declare function addMarkdownDocumentation(out: string, documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, converter: IFilePathToResourceConverter, ctx: SharedContext): string;
13
+ //# sourceMappingURL=previewer.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type * as ts from 'typescript/lib/tsserverlibrary';
2
+ export declare function snippetForFunctionCall(item: {
3
+ insertText?: string;
4
+ label: string;
5
+ }, displayParts: ReadonlyArray<ts.server.protocol.SymbolDisplayPart>): {
6
+ snippet: string;
7
+ parameterCount: number;
8
+ };
9
+ //# sourceMappingURL=snippetForFunctionCall.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-typescript",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
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",
@@ -8,11 +8,10 @@
8
8
  "keywords": [
9
9
  "volar-service"
10
10
  ],
11
- "main": "out/index.js",
12
11
  "license": "MIT",
13
12
  "files": [
14
- "out/**/*.js",
15
- "out/**/*.d.ts"
13
+ "**/*.js",
14
+ "**/*.d.ts"
16
15
  ],
17
16
  "repository": {
18
17
  "type": "git",
@@ -46,5 +45,5 @@
46
45
  "optional": true
47
46
  }
48
47
  },
49
- "gitHead": "d4023ed503951199b1a9a4b7efe82f4edba42141"
48
+ "gitHead": "0090e6286c521d185e52e0f02c8eeb237ea4e54d"
50
49
  }
@@ -1,14 +0,0 @@
1
- import type * as ts from 'typescript/lib/tsserverlibrary';
2
- import type * as Proto from '../protocol';
3
- import type { SharedContext } from '../types';
4
- export interface IFilePathToResourceConverter {
5
- /**
6
- * Convert a typescript filepath to a VS Code resource.
7
- */
8
- toResource(filepath: string): string;
9
- }
10
- export declare function plainWithLinks(parts: readonly Proto.SymbolDisplayPart[] | string, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext): string;
11
- export declare function tagsMarkdownPreview(tags: readonly ts.JSDocTagInfo[], filePathConverter: IFilePathToResourceConverter, ctx: SharedContext): string;
12
- export declare function markdownDocumentation(documentation: Proto.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext): string;
13
- export declare function addMarkdownDocumentation(out: string, documentation: Proto.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, converter: IFilePathToResourceConverter, ctx: SharedContext): string;
14
- //# sourceMappingURL=previewer.d.ts.map
@@ -1,9 +0,0 @@
1
- import type * as Proto from '../protocol';
2
- export declare function snippetForFunctionCall(item: {
3
- insertText?: string;
4
- label: string;
5
- }, displayParts: ReadonlyArray<Proto.SymbolDisplayPart>): {
6
- snippet: string;
7
- parameterCount: number;
8
- };
9
- //# sourceMappingURL=snippetForFunctionCall.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes