@volar/language-core 2.2.0-alpha.1 → 2.2.0-alpha.10

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 CHANGED
@@ -142,6 +142,12 @@ function createLanguage(plugins, caseSensitive, sync) {
142
142
  exports.createLanguage = createLanguage;
143
143
  function updateVirtualCodeMapOfMap(virtualCode, mapOfMap, getSourceSnapshot) {
144
144
  const sources = new Set();
145
+ if (!virtualCode.mappings.length) {
146
+ const source = getSourceSnapshot(undefined);
147
+ if (source) {
148
+ mapOfMap.set(source[0], [source[1], new source_map_1.SourceMap([])]);
149
+ }
150
+ }
145
151
  for (const mapping of virtualCode.mappings) {
146
152
  if (sources.has(mapping.source)) {
147
153
  continue;
@@ -16,7 +16,7 @@ exports.isCodeLensEnabled = isCodeLensEnabled;
16
16
  function isSemanticTokensEnabled(info) {
17
17
  return typeof info.semantic === 'object'
18
18
  ? info.semantic.shouldHighlight?.() ?? true
19
- : info.semantic;
19
+ : !!info.semantic;
20
20
  }
21
21
  exports.isSemanticTokensEnabled = isSemanticTokensEnabled;
22
22
  function isCallHierarchyEnabled(info) {
@@ -48,27 +48,27 @@ function isHighlightEnabled(info) {
48
48
  }
49
49
  exports.isHighlightEnabled = isHighlightEnabled;
50
50
  function isSymbolsEnabled(info) {
51
- return info.structure;
51
+ return !!info.structure;
52
52
  }
53
53
  exports.isSymbolsEnabled = isSymbolsEnabled;
54
54
  function isFoldingRangesEnabled(info) {
55
- return info.structure;
55
+ return !!info.structure;
56
56
  }
57
57
  exports.isFoldingRangesEnabled = isFoldingRangesEnabled;
58
58
  function isSelectionRangesEnabled(info) {
59
- return info.structure;
59
+ return !!info.structure;
60
60
  }
61
61
  exports.isSelectionRangesEnabled = isSelectionRangesEnabled;
62
62
  function isLinkedEditingEnabled(info) {
63
- return info.structure;
63
+ return !!info.structure;
64
64
  }
65
65
  exports.isLinkedEditingEnabled = isLinkedEditingEnabled;
66
66
  function isColorEnabled(info) {
67
- return info.structure;
67
+ return !!info.structure;
68
68
  }
69
69
  exports.isColorEnabled = isColorEnabled;
70
70
  function isDocumentLinkEnabled(info) {
71
- return info.structure;
71
+ return !!info.structure;
72
72
  }
73
73
  exports.isDocumentLinkEnabled = isDocumentLinkEnabled;
74
74
  function isDiagnosticsEnabled(info) {
@@ -80,7 +80,7 @@ function isCodeActionsEnabled(info) {
80
80
  }
81
81
  exports.isCodeActionsEnabled = isCodeActionsEnabled;
82
82
  function isFormattingEnabled(info) {
83
- return info.format;
83
+ return !!info.format;
84
84
  }
85
85
  exports.isFormattingEnabled = isFormattingEnabled;
86
86
  function isCompletionEnabled(info) {
@@ -99,7 +99,7 @@ exports.isSignatureHelpEnabled = isSignatureHelpEnabled;
99
99
  function shouldReportDiagnostics(info) {
100
100
  return typeof info.verification === 'object'
101
101
  ? info.verification.shouldReport?.() ?? true
102
- : info.verification;
102
+ : !!info.verification;
103
103
  }
104
104
  exports.shouldReportDiagnostics = shouldReportDiagnostics;
105
105
  // resolve...
package/lib/types.d.ts CHANGED
@@ -46,28 +46,28 @@ export interface VirtualCode {
46
46
  }
47
47
  export interface CodeInformation {
48
48
  /** virtual code is expected to support verification */
49
- verification: boolean | {
49
+ verification?: boolean | {
50
50
  shouldReport?(): boolean;
51
51
  };
52
52
  /** virtual code is expected to support assisted completion */
53
- completion: boolean | {
53
+ completion?: boolean | {
54
54
  isAdditional?: boolean;
55
55
  onlyImport?: boolean;
56
56
  };
57
57
  /** virtual code is expected correctly reflect semantic of the source code */
58
- semantic: boolean | {
58
+ semantic?: boolean | {
59
59
  shouldHighlight?(): boolean;
60
60
  };
61
61
  /** virtual code is expected correctly reflect reference relationships of the source code */
62
- navigation: boolean | {
62
+ navigation?: boolean | {
63
63
  shouldRename?(): boolean;
64
64
  resolveRenameNewName?(newName: string): string;
65
65
  resolveRenameEditText?(newText: string): string;
66
66
  };
67
67
  /** virtual code is expected correctly reflect the structural information of the source code */
68
- structure: boolean;
68
+ structure?: boolean;
69
69
  /** virtual code is expected correctly reflect the format information of the source code */
70
- format: boolean;
70
+ format?: boolean;
71
71
  }
72
72
  export interface ServiceScript {
73
73
  code: VirtualCode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-core",
3
- "version": "2.2.0-alpha.1",
3
+ "version": "2.2.0-alpha.10",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/language-core"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/source-map": "2.2.0-alpha.1"
15
+ "@volar/source-map": "2.2.0-alpha.10"
16
16
  },
17
- "gitHead": "e6dcb83ecadcfcc9e22083eea61e1ee817a9d483"
17
+ "gitHead": "aedd2230883c457f703be93ed150917a3efde75c"
18
18
  }