@volar/language-core 2.4.0-alpha.9 → 2.4.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 +3 -3
- package/lib/editorFeatures.d.ts +3 -0
- package/lib/editorFeatures.js +12 -0
- package/lib/types.d.ts +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export * from './lib/types';
|
|
|
5
5
|
export * from './lib/utils';
|
|
6
6
|
import type { Language, LanguagePlugin, MapperFactory, SourceScript, VirtualCode } from './lib/types';
|
|
7
7
|
export declare const defaultMapperFactory: MapperFactory;
|
|
8
|
-
export declare function createLanguage<T>(plugins: LanguagePlugin<T>[], scriptRegistry: Map<T, SourceScript<T>>, sync: (id: T) => void): Language<T>;
|
|
8
|
+
export declare function createLanguage<T>(plugins: LanguagePlugin<T>[], scriptRegistry: Map<T, SourceScript<T>>, sync: (id: T, includeFsFiles: boolean) => void): Language<T>;
|
|
9
9
|
export declare function forEachEmbeddedCode(virtualCode: VirtualCode): Generator<VirtualCode>;
|
package/index.js
CHANGED
|
@@ -38,8 +38,8 @@ function createLanguage(plugins, scriptRegistry, sync) {
|
|
|
38
38
|
fromVirtualCode(virtualCode) {
|
|
39
39
|
return virtualCodeToSourceScriptMap.get(virtualCode);
|
|
40
40
|
},
|
|
41
|
-
get(id) {
|
|
42
|
-
sync(id);
|
|
41
|
+
get(id, includeFsFiles = true) {
|
|
42
|
+
sync(id, includeFsFiles);
|
|
43
43
|
const result = scriptRegistry.get(id);
|
|
44
44
|
// The sync function provider may not always call the set function due to caching, so it is necessary to explicitly check isAssociationDirty.
|
|
45
45
|
if (result?.isAssociationDirty) {
|
|
@@ -211,7 +211,7 @@ function createLanguage(plugins, scriptRegistry, sync) {
|
|
|
211
211
|
sourceScript.isAssociationDirty = false;
|
|
212
212
|
return {
|
|
213
213
|
getAssociatedScript(id) {
|
|
214
|
-
sync(id);
|
|
214
|
+
sync(id, true);
|
|
215
215
|
const relatedSourceScript = scriptRegistry.get(id);
|
|
216
216
|
if (relatedSourceScript) {
|
|
217
217
|
relatedSourceScript.targetIds.add(sourceScript.id);
|
package/lib/editorFeatures.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ import type { CodeInformation } from './types';
|
|
|
2
2
|
export declare function isHoverEnabled(info: CodeInformation): boolean;
|
|
3
3
|
export declare function isInlayHintsEnabled(info: CodeInformation): boolean;
|
|
4
4
|
export declare function isCodeLensEnabled(info: CodeInformation): boolean;
|
|
5
|
+
export declare function isMonikerEnabled(info: CodeInformation): boolean;
|
|
6
|
+
export declare function isInlineValueEnabled(info: CodeInformation): boolean;
|
|
5
7
|
export declare function isSemanticTokensEnabled(info: CodeInformation): boolean;
|
|
6
8
|
export declare function isCallHierarchyEnabled(info: CodeInformation): boolean;
|
|
9
|
+
export declare function isTypeHierarchyEnabled(info: CodeInformation): boolean;
|
|
7
10
|
export declare function isRenameEnabled(info: CodeInformation): boolean;
|
|
8
11
|
export declare function isDefinitionEnabled(info: CodeInformation): boolean;
|
|
9
12
|
export declare function isTypeDefinitionEnabled(info: CodeInformation): boolean;
|
package/lib/editorFeatures.js
CHANGED
|
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isHoverEnabled = isHoverEnabled;
|
|
4
4
|
exports.isInlayHintsEnabled = isInlayHintsEnabled;
|
|
5
5
|
exports.isCodeLensEnabled = isCodeLensEnabled;
|
|
6
|
+
exports.isMonikerEnabled = isMonikerEnabled;
|
|
7
|
+
exports.isInlineValueEnabled = isInlineValueEnabled;
|
|
6
8
|
exports.isSemanticTokensEnabled = isSemanticTokensEnabled;
|
|
7
9
|
exports.isCallHierarchyEnabled = isCallHierarchyEnabled;
|
|
10
|
+
exports.isTypeHierarchyEnabled = isTypeHierarchyEnabled;
|
|
8
11
|
exports.isRenameEnabled = isRenameEnabled;
|
|
9
12
|
exports.isDefinitionEnabled = isDefinitionEnabled;
|
|
10
13
|
exports.isTypeDefinitionEnabled = isTypeDefinitionEnabled;
|
|
@@ -35,6 +38,12 @@ function isInlayHintsEnabled(info) {
|
|
|
35
38
|
function isCodeLensEnabled(info) {
|
|
36
39
|
return !!info.semantic;
|
|
37
40
|
}
|
|
41
|
+
function isMonikerEnabled(info) {
|
|
42
|
+
return !!info.semantic;
|
|
43
|
+
}
|
|
44
|
+
function isInlineValueEnabled(info) {
|
|
45
|
+
return !!info.semantic;
|
|
46
|
+
}
|
|
38
47
|
function isSemanticTokensEnabled(info) {
|
|
39
48
|
return typeof info.semantic === 'object'
|
|
40
49
|
? info.semantic.shouldHighlight?.() ?? true
|
|
@@ -43,6 +52,9 @@ function isSemanticTokensEnabled(info) {
|
|
|
43
52
|
function isCallHierarchyEnabled(info) {
|
|
44
53
|
return !!info.navigation;
|
|
45
54
|
}
|
|
55
|
+
function isTypeHierarchyEnabled(info) {
|
|
56
|
+
return !!info.navigation;
|
|
57
|
+
}
|
|
46
58
|
function isRenameEnabled(info) {
|
|
47
59
|
return typeof info.navigation === 'object'
|
|
48
60
|
? info.navigation.shouldRename?.() ?? true
|
package/lib/types.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface Language<T = unknown> {
|
|
|
12
12
|
mapperFactory: MapperFactory;
|
|
13
13
|
plugins: LanguagePlugin<T>[];
|
|
14
14
|
scripts: {
|
|
15
|
-
get(id: T): SourceScript<T> | undefined;
|
|
15
|
+
get(id: T, includeFsFiles?: boolean): SourceScript<T> | undefined;
|
|
16
16
|
set(id: T, snapshot: IScriptSnapshot, languageId?: string, plugins?: LanguagePlugin<T>[]): SourceScript<T> | undefined;
|
|
17
17
|
delete(id: T): void;
|
|
18
18
|
fromVirtualCode(virtualCode: VirtualCode): SourceScript<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-core",
|
|
3
|
-
"version": "2.4.0
|
|
3
|
+
"version": "2.4.0",
|
|
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.4.0
|
|
15
|
+
"@volar/source-map": "2.4.0"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "7e98885cfe284451e655cf1c3954786b51aea2f8"
|
|
18
18
|
}
|