@volar/language-core 2.4.30 → 3.0.0-alpha.0
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.d.ts +1 -1
- package/index.js +6 -3
- package/lib/editor.d.ts +28 -31
- package/lib/editor.js +64 -105
- package/lib/linkedCodeMap.d.ts +2 -2
- package/lib/linkedCodeMap.js +5 -5
- package/lib/types.d.ts +7 -66
- package/package.json +2 -2
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -14,18 +14,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.defaultMapperFactory = exports.
|
|
17
|
+
exports.defaultMapperFactory = exports.SpanMapKind = exports.SpanMapFidelity = exports.SpanMapFeature = exports.SpanMap = void 0;
|
|
18
18
|
exports.createLanguage = createLanguage;
|
|
19
19
|
exports.forEachEmbeddedCode = forEachEmbeddedCode;
|
|
20
20
|
var source_map_1 = require("@volar/source-map");
|
|
21
|
-
Object.defineProperty(exports, "
|
|
21
|
+
Object.defineProperty(exports, "SpanMap", { enumerable: true, get: function () { return source_map_1.SpanMap; } });
|
|
22
|
+
Object.defineProperty(exports, "SpanMapFeature", { enumerable: true, get: function () { return source_map_1.SpanMapFeature; } });
|
|
23
|
+
Object.defineProperty(exports, "SpanMapFidelity", { enumerable: true, get: function () { return source_map_1.SpanMapFidelity; } });
|
|
24
|
+
Object.defineProperty(exports, "SpanMapKind", { enumerable: true, get: function () { return source_map_1.SpanMapKind; } });
|
|
22
25
|
__exportStar(require("./lib/editor"), exports);
|
|
23
26
|
__exportStar(require("./lib/linkedCodeMap"), exports);
|
|
24
27
|
__exportStar(require("./lib/types"), exports);
|
|
25
28
|
__exportStar(require("./lib/utils"), exports);
|
|
26
29
|
const source_map_2 = require("@volar/source-map");
|
|
27
30
|
const linkedCodeMap_1 = require("./lib/linkedCodeMap");
|
|
28
|
-
const defaultMapperFactory =
|
|
31
|
+
const defaultMapperFactory = segments => new source_map_2.SpanMap(segments);
|
|
29
32
|
exports.defaultMapperFactory = defaultMapperFactory;
|
|
30
33
|
function createLanguage(plugins, scriptRegistry, sync, onAssociationDirty) {
|
|
31
34
|
const virtualCodeToSourceScriptMap = new WeakMap();
|
package/lib/editor.d.ts
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function isCodeActionsEnabled(
|
|
24
|
-
export declare function isFormattingEnabled(
|
|
25
|
-
export declare function isCompletionEnabled(
|
|
26
|
-
export declare function isAutoInsertEnabled(
|
|
27
|
-
export declare function isSignatureHelpEnabled(
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function resolveRenameNewName(newName: string, info: CodeInformation): string;
|
|
30
|
-
export declare function resolveRenameEditText(text: string, info: CodeInformation): string;
|
|
31
|
-
export declare function findOverlapCodeRange(start: number, end: number, map: Mapper, filter: (data: CodeInformation) => boolean): {
|
|
1
|
+
import { SpanMapFeature } from '@volar/source-map';
|
|
2
|
+
import type { Mapper } from './types';
|
|
3
|
+
export declare function isHoverEnabled(features: number): boolean;
|
|
4
|
+
export declare function isInlayHintsEnabled(features: number): boolean;
|
|
5
|
+
export declare function isCodeLensEnabled(features: number): boolean;
|
|
6
|
+
export declare function isMonikerEnabled(features: number): boolean;
|
|
7
|
+
export declare function isInlineValueEnabled(features: number): boolean;
|
|
8
|
+
export declare function isSemanticTokensEnabled(features: number): boolean;
|
|
9
|
+
export declare function isCallHierarchyEnabled(features: number): boolean;
|
|
10
|
+
export declare function isTypeHierarchyEnabled(features: number): boolean;
|
|
11
|
+
export declare function isRenameEnabled(features: number): boolean;
|
|
12
|
+
export declare function isDefinitionEnabled(features: number): boolean;
|
|
13
|
+
export declare function isTypeDefinitionEnabled(features: number): boolean;
|
|
14
|
+
export declare function isReferencesEnabled(features: number): boolean;
|
|
15
|
+
export declare function isImplementationEnabled(features: number): boolean;
|
|
16
|
+
export declare function isHighlightEnabled(features: number): boolean;
|
|
17
|
+
export declare function isSymbolsEnabled(features: number): boolean;
|
|
18
|
+
export declare function isFoldingRangesEnabled(features: number): boolean;
|
|
19
|
+
export declare function isSelectionRangesEnabled(features: number): boolean;
|
|
20
|
+
export declare function isLinkedEditingEnabled(features: number): boolean;
|
|
21
|
+
export declare function isColorEnabled(features: number): boolean;
|
|
22
|
+
export declare function isDocumentLinkEnabled(features: number): boolean;
|
|
23
|
+
export declare function isCodeActionsEnabled(features: number): boolean;
|
|
24
|
+
export declare function isFormattingEnabled(features: number): boolean;
|
|
25
|
+
export declare function isCompletionEnabled(features: number): boolean;
|
|
26
|
+
export declare function isAutoInsertEnabled(features: number): boolean;
|
|
27
|
+
export declare function isSignatureHelpEnabled(features: number): boolean;
|
|
28
|
+
export declare function findOverlapCodeRange(start: number, end: number, map: Mapper, feature: SpanMapFeature): {
|
|
32
29
|
start: number;
|
|
33
30
|
end: number;
|
|
34
31
|
} | undefined;
|
package/lib/editor.js
CHANGED
|
@@ -20,144 +20,103 @@ exports.isSelectionRangesEnabled = isSelectionRangesEnabled;
|
|
|
20
20
|
exports.isLinkedEditingEnabled = isLinkedEditingEnabled;
|
|
21
21
|
exports.isColorEnabled = isColorEnabled;
|
|
22
22
|
exports.isDocumentLinkEnabled = isDocumentLinkEnabled;
|
|
23
|
-
exports.isDiagnosticsEnabled = isDiagnosticsEnabled;
|
|
24
23
|
exports.isCodeActionsEnabled = isCodeActionsEnabled;
|
|
25
24
|
exports.isFormattingEnabled = isFormattingEnabled;
|
|
26
25
|
exports.isCompletionEnabled = isCompletionEnabled;
|
|
27
26
|
exports.isAutoInsertEnabled = isAutoInsertEnabled;
|
|
28
27
|
exports.isSignatureHelpEnabled = isSignatureHelpEnabled;
|
|
29
|
-
exports.shouldReportDiagnostics = shouldReportDiagnostics;
|
|
30
|
-
exports.resolveRenameNewName = resolveRenameNewName;
|
|
31
|
-
exports.resolveRenameEditText = resolveRenameEditText;
|
|
32
28
|
exports.findOverlapCodeRange = findOverlapCodeRange;
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const source_map_1 = require("@volar/source-map");
|
|
30
|
+
function isHoverEnabled(features) {
|
|
31
|
+
return !!(features & source_map_1.SpanMapFeature.Hover);
|
|
35
32
|
}
|
|
36
|
-
function isInlayHintsEnabled(
|
|
37
|
-
return !!
|
|
33
|
+
function isInlayHintsEnabled(features) {
|
|
34
|
+
return !!(features & source_map_1.SpanMapFeature.InlayHints);
|
|
38
35
|
}
|
|
39
|
-
function isCodeLensEnabled(
|
|
40
|
-
return !!
|
|
36
|
+
function isCodeLensEnabled(features) {
|
|
37
|
+
return !!(features & source_map_1.SpanMapFeature.CodeLens);
|
|
41
38
|
}
|
|
42
|
-
function isMonikerEnabled(
|
|
43
|
-
return !!
|
|
39
|
+
function isMonikerEnabled(features) {
|
|
40
|
+
return !!(features & source_map_1.SpanMapFeature.References);
|
|
44
41
|
}
|
|
45
|
-
function isInlineValueEnabled(
|
|
46
|
-
return !!
|
|
42
|
+
function isInlineValueEnabled(features) {
|
|
43
|
+
return !!(features & source_map_1.SpanMapFeature.Hover);
|
|
47
44
|
}
|
|
48
|
-
function isSemanticTokensEnabled(
|
|
49
|
-
return
|
|
50
|
-
? info.semantic.shouldHighlight?.() ?? true
|
|
51
|
-
: !!info.semantic;
|
|
45
|
+
function isSemanticTokensEnabled(features) {
|
|
46
|
+
return !!(features & source_map_1.SpanMapFeature.SemanticTokens);
|
|
52
47
|
}
|
|
53
|
-
function isCallHierarchyEnabled(
|
|
54
|
-
return !!
|
|
48
|
+
function isCallHierarchyEnabled(features) {
|
|
49
|
+
return !!(features & source_map_1.SpanMapFeature.CallHierarchy);
|
|
55
50
|
}
|
|
56
|
-
function isTypeHierarchyEnabled(
|
|
57
|
-
return !!
|
|
51
|
+
function isTypeHierarchyEnabled(features) {
|
|
52
|
+
return !!(features & source_map_1.SpanMapFeature.CallHierarchy);
|
|
58
53
|
}
|
|
59
|
-
function isRenameEnabled(
|
|
60
|
-
return
|
|
61
|
-
? info.navigation.shouldRename?.() ?? true
|
|
62
|
-
: !!info.navigation;
|
|
54
|
+
function isRenameEnabled(features) {
|
|
55
|
+
return !!(features & source_map_1.SpanMapFeature.Rename);
|
|
63
56
|
}
|
|
64
|
-
function isDefinitionEnabled(
|
|
65
|
-
return !!
|
|
57
|
+
function isDefinitionEnabled(features) {
|
|
58
|
+
return !!(features & source_map_1.SpanMapFeature.Definition);
|
|
66
59
|
}
|
|
67
|
-
function isTypeDefinitionEnabled(
|
|
68
|
-
return !!
|
|
60
|
+
function isTypeDefinitionEnabled(features) {
|
|
61
|
+
return !!(features & source_map_1.SpanMapFeature.TypeDefinition);
|
|
69
62
|
}
|
|
70
|
-
function isReferencesEnabled(
|
|
71
|
-
return !!
|
|
63
|
+
function isReferencesEnabled(features) {
|
|
64
|
+
return !!(features & source_map_1.SpanMapFeature.References);
|
|
72
65
|
}
|
|
73
|
-
function isImplementationEnabled(
|
|
74
|
-
return !!
|
|
66
|
+
function isImplementationEnabled(features) {
|
|
67
|
+
return !!(features & source_map_1.SpanMapFeature.Implementation);
|
|
75
68
|
}
|
|
76
|
-
function isHighlightEnabled(
|
|
77
|
-
return
|
|
78
|
-
? info.navigation.shouldHighlight?.() ?? true
|
|
79
|
-
: !!info.navigation;
|
|
69
|
+
function isHighlightEnabled(features) {
|
|
70
|
+
return !!(features & source_map_1.SpanMapFeature.DocumentHighlights);
|
|
80
71
|
}
|
|
81
|
-
function isSymbolsEnabled(
|
|
82
|
-
return !!
|
|
72
|
+
function isSymbolsEnabled(features) {
|
|
73
|
+
return !!(features & source_map_1.SpanMapFeature.DocumentSymbols);
|
|
83
74
|
}
|
|
84
|
-
function isFoldingRangesEnabled(
|
|
85
|
-
return !!
|
|
75
|
+
function isFoldingRangesEnabled(features) {
|
|
76
|
+
return !!(features & source_map_1.SpanMapFeature.FoldingRanges);
|
|
86
77
|
}
|
|
87
|
-
function isSelectionRangesEnabled(
|
|
88
|
-
return !!
|
|
78
|
+
function isSelectionRangesEnabled(features) {
|
|
79
|
+
return !!(features & source_map_1.SpanMapFeature.SelectionRanges);
|
|
89
80
|
}
|
|
90
|
-
function isLinkedEditingEnabled(
|
|
91
|
-
return !!
|
|
81
|
+
function isLinkedEditingEnabled(features) {
|
|
82
|
+
return !!(features & source_map_1.SpanMapFeature.LinkedEditing);
|
|
92
83
|
}
|
|
93
|
-
function isColorEnabled(
|
|
94
|
-
return !!
|
|
84
|
+
function isColorEnabled(features) {
|
|
85
|
+
return !!(features & source_map_1.SpanMapFeature.DocumentSymbols);
|
|
95
86
|
}
|
|
96
|
-
function isDocumentLinkEnabled(
|
|
97
|
-
return !!
|
|
87
|
+
function isDocumentLinkEnabled(features) {
|
|
88
|
+
return !!(features & source_map_1.SpanMapFeature.DocumentSymbols);
|
|
98
89
|
}
|
|
99
|
-
function
|
|
100
|
-
return !!
|
|
90
|
+
function isCodeActionsEnabled(features) {
|
|
91
|
+
return !!(features & source_map_1.SpanMapFeature.CodeActions);
|
|
101
92
|
}
|
|
102
|
-
function
|
|
103
|
-
return !!
|
|
93
|
+
function isFormattingEnabled(features) {
|
|
94
|
+
return !!(features & source_map_1.SpanMapFeature.Formatting);
|
|
104
95
|
}
|
|
105
|
-
function
|
|
106
|
-
return !!
|
|
96
|
+
function isCompletionEnabled(features) {
|
|
97
|
+
return !!(features & source_map_1.SpanMapFeature.Completion);
|
|
107
98
|
}
|
|
108
|
-
function
|
|
109
|
-
return !!
|
|
99
|
+
function isAutoInsertEnabled(features) {
|
|
100
|
+
return !!(features & source_map_1.SpanMapFeature.AutoInsert);
|
|
110
101
|
}
|
|
111
|
-
function
|
|
112
|
-
return !!
|
|
102
|
+
function isSignatureHelpEnabled(features) {
|
|
103
|
+
return !!(features & source_map_1.SpanMapFeature.SignatureHelp);
|
|
113
104
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// should...
|
|
118
|
-
function shouldReportDiagnostics(info, source, code) {
|
|
119
|
-
return typeof info.verification === 'object'
|
|
120
|
-
? info.verification.shouldReport?.(source, code) ?? true
|
|
121
|
-
: !!info.verification;
|
|
122
|
-
}
|
|
123
|
-
// resolve...
|
|
124
|
-
function resolveRenameNewName(newName, info) {
|
|
125
|
-
return typeof info.navigation === 'object'
|
|
126
|
-
? info.navigation.resolveRenameNewName?.(newName) ?? newName
|
|
127
|
-
: newName;
|
|
128
|
-
}
|
|
129
|
-
function resolveRenameEditText(text, info) {
|
|
130
|
-
return typeof info.navigation === 'object'
|
|
131
|
-
? info.navigation.resolveRenameEditText?.(text) ?? text
|
|
132
|
-
: text;
|
|
133
|
-
}
|
|
134
|
-
function findOverlapCodeRange(start, end, map, filter) {
|
|
135
|
-
let mappedStart;
|
|
136
|
-
let mappedEnd;
|
|
137
|
-
for (const [mapped, mapping] of map.toGeneratedLocation(start)) {
|
|
138
|
-
if (filter(mapping.data)) {
|
|
139
|
-
mappedStart = mapped;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
for (const [mapped, mapping] of map.toGeneratedLocation(end)) {
|
|
144
|
-
if (filter(mapping.data)) {
|
|
145
|
-
mappedEnd = mapped;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
105
|
+
function findOverlapCodeRange(start, end, map, feature) {
|
|
106
|
+
let mappedStart = map.originalToVirtualPositions(start, feature)[0]?.position;
|
|
107
|
+
let mappedEnd = map.originalToVirtualPositions(end, feature)[0]?.position;
|
|
149
108
|
if (mappedStart === undefined || mappedEnd === undefined) {
|
|
150
|
-
for (const
|
|
151
|
-
if (
|
|
152
|
-
const
|
|
153
|
-
const mappingEnd = mapping.sourceOffsets[mapping.sourceOffsets.length - 1]
|
|
154
|
-
+ mapping.lengths[mapping.lengths.length - 1];
|
|
155
|
-
const overlap = getOverlapRange(start, end, mappingStart, mappingEnd);
|
|
109
|
+
for (const segment of map.segments) {
|
|
110
|
+
if (segment.features & feature) {
|
|
111
|
+
const overlap = getOverlapRange(start, end, segment.originalStart, segment.originalEnd);
|
|
156
112
|
if (overlap) {
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
113
|
+
const verbatim = segment.kind === source_map_1.SpanMapKind.Verbatim;
|
|
114
|
+
const curMappedStart = verbatim
|
|
115
|
+
? overlap.start - segment.originalStart + segment.virtualStart
|
|
116
|
+
: segment.virtualStart;
|
|
117
|
+
const curMappedEnd = verbatim
|
|
118
|
+
? Math.min(overlap.end - segment.originalStart + segment.virtualStart, segment.virtualEnd)
|
|
119
|
+
: segment.virtualEnd;
|
|
161
120
|
mappedStart = mappedStart === undefined ? curMappedStart : Math.min(mappedStart, curMappedStart);
|
|
162
121
|
mappedEnd = mappedEnd === undefined ? curMappedEnd : Math.max(mappedEnd, curMappedEnd);
|
|
163
122
|
}
|
package/lib/linkedCodeMap.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class LinkedCodeMap extends
|
|
1
|
+
import { SpanMap } from '@volar/source-map';
|
|
2
|
+
export declare class LinkedCodeMap extends SpanMap {
|
|
3
3
|
getLinkedOffsets(start: number): Generator<number, void, unknown>;
|
|
4
4
|
}
|
package/lib/linkedCodeMap.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LinkedCodeMap = void 0;
|
|
4
4
|
const source_map_1 = require("@volar/source-map");
|
|
5
|
-
class LinkedCodeMap extends source_map_1.
|
|
5
|
+
class LinkedCodeMap extends source_map_1.SpanMap {
|
|
6
6
|
*getLinkedOffsets(start) {
|
|
7
|
-
for (const mapped of this.
|
|
8
|
-
yield mapped
|
|
7
|
+
for (const mapped of this.originalToVirtualPositions(start)) {
|
|
8
|
+
yield mapped.position;
|
|
9
9
|
}
|
|
10
|
-
for (const mapped of this.
|
|
11
|
-
yield mapped
|
|
10
|
+
for (const mapped of this.virtualToOriginalPositions(start)) {
|
|
11
|
+
yield mapped.position;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SpanMap, SpanMapSegment } from '@volar/source-map';
|
|
2
2
|
import type { LinkedCodeMap } from './linkedCodeMap';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
toGeneratedRange(start: number, end: number, fallbackToAnyMatch: boolean, filter?: (data: CodeInformation) => boolean): Generator<readonly [number, number, Mapping<CodeInformation>, Mapping<CodeInformation>]>;
|
|
7
|
-
toSourceLocation(generatedOffset: number, filter?: (data: CodeInformation) => boolean): Generator<readonly [number, Mapping<CodeInformation>]>;
|
|
8
|
-
toGeneratedLocation(sourceOffset: number, filter?: (data: CodeInformation) => boolean): Generator<readonly [number, Mapping<CodeInformation>]>;
|
|
9
|
-
}
|
|
10
|
-
export type MapperFactory = (mappings: Mapping<CodeInformation>[]) => Mapper;
|
|
3
|
+
export type { MappedPosition, MappedRange, NormalizedSpanMapSegment, SpanMapSegment } from '@volar/source-map';
|
|
4
|
+
export type Mapper = Pick<SpanMap, 'segments' | 'virtualToOriginalPositions' | 'originalToVirtualPositions' | 'virtualToOriginalSpans' | 'originalToVirtualSpans'>;
|
|
5
|
+
export type MapperFactory = (segments: readonly SpanMapSegment[]) => Mapper;
|
|
11
6
|
export interface Language<T = unknown> {
|
|
12
7
|
mapperFactory: MapperFactory;
|
|
13
8
|
plugins: LanguagePlugin<T>[];
|
|
@@ -39,68 +34,14 @@ export interface SourceScript<T = unknown> {
|
|
|
39
34
|
embeddedCodes: Map<string, VirtualCode>;
|
|
40
35
|
};
|
|
41
36
|
}
|
|
42
|
-
export type CodeMapping = Mapping<CodeInformation>;
|
|
43
37
|
export interface VirtualCode {
|
|
44
38
|
id: string;
|
|
45
39
|
languageId: string;
|
|
46
40
|
snapshot: IScriptSnapshot;
|
|
47
|
-
mappings:
|
|
48
|
-
associatedScriptMappings?: Map<unknown,
|
|
41
|
+
mappings: SpanMapSegment[];
|
|
42
|
+
associatedScriptMappings?: Map<unknown, SpanMapSegment[]>;
|
|
49
43
|
embeddedCodes?: VirtualCode[];
|
|
50
|
-
linkedCodeMappings?:
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* CodeInformation is a configuration object attached to each CodeMapping (between source code and generated code,
|
|
54
|
-
* e.g. between the template code in a .vue file and the type-checkable TS code generated from it) that
|
|
55
|
-
* determines what code/language features are expected to be available for the mapping.
|
|
56
|
-
*
|
|
57
|
-
* Due to the dynamic nature of code generation and the fact that, for example, things like Code Actions
|
|
58
|
-
* and auto-complete shouldn't be triggerable on certain "in-between" regions of generated code, we need
|
|
59
|
-
* a way to shut off certain features in certain regions, while leaving them enabled in others.
|
|
60
|
-
*/
|
|
61
|
-
export interface CodeInformation {
|
|
62
|
-
/** virtual code is expected to support verification, where verification includes:
|
|
63
|
-
*
|
|
64
|
-
* - diagnostics (syntactic, semantic, and others, such as those generated by the TypeScript language service on generated TS code)
|
|
65
|
-
* - code actions (refactorings, quick fixes,etc.)
|
|
66
|
-
*/
|
|
67
|
-
verification?: boolean | {
|
|
68
|
-
/**
|
|
69
|
-
* when present, `shouldReport` callback is invoked to determine whether a diagnostic
|
|
70
|
-
* raised in the generated code should be propagated back to the original source code.
|
|
71
|
-
* Note that when this callback is present, diagnostic processing (e.g. typechecking) will
|
|
72
|
-
* still be performed, but the results will not be reported back to the original source code. */
|
|
73
|
-
shouldReport?(source: string | undefined, code: string | number | undefined): boolean;
|
|
74
|
-
};
|
|
75
|
-
/** virtual code is expected to support assisted completion */
|
|
76
|
-
completion?: boolean | {
|
|
77
|
-
isAdditional?: boolean;
|
|
78
|
-
onlyImport?: boolean;
|
|
79
|
-
};
|
|
80
|
-
/** virtual code is expected correctly reflect semantic of the source code. Specifically this controls the following langauge features:
|
|
81
|
-
*
|
|
82
|
-
* - hover
|
|
83
|
-
* - inlay hints
|
|
84
|
-
* - code lens
|
|
85
|
-
* - semantic tokens
|
|
86
|
-
* - others
|
|
87
|
-
*
|
|
88
|
-
* Note that semantic diagnostics (e.g. TS type-checking) are covered by the `verification` property above.
|
|
89
|
-
*/
|
|
90
|
-
semantic?: boolean | {
|
|
91
|
-
shouldHighlight?(): boolean;
|
|
92
|
-
};
|
|
93
|
-
/** virtual code is expected correctly reflect reference relationships of the source code */
|
|
94
|
-
navigation?: boolean | {
|
|
95
|
-
shouldHighlight?(): boolean;
|
|
96
|
-
shouldRename?(): boolean;
|
|
97
|
-
resolveRenameNewName?(newName: string): string;
|
|
98
|
-
resolveRenameEditText?(newText: string): string;
|
|
99
|
-
};
|
|
100
|
-
/** virtual code is expected correctly reflect the structural information of the source code */
|
|
101
|
-
structure?: boolean;
|
|
102
|
-
/** virtual code is expected correctly reflect the format information of the source code */
|
|
103
|
-
format?: boolean;
|
|
44
|
+
linkedCodeMappings?: SpanMapSegment[];
|
|
104
45
|
}
|
|
105
46
|
export interface LanguagePlugin<T = unknown, K extends VirtualCode = VirtualCode> {
|
|
106
47
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
"directory": "packages/language-core"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/source-map": "
|
|
15
|
+
"@volar/source-map": "3.0.0-alpha.0"
|
|
16
16
|
}
|
|
17
17
|
}
|