first commit
This commit is contained in:
21
web-app/node_modules/@volar/language-core/LICENSE
generated
vendored
Normal file
21
web-app/node_modules/@volar/language-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-present Johnson Chu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
9
web-app/node_modules/@volar/language-core/index.d.ts
generated
vendored
Normal file
9
web-app/node_modules/@volar/language-core/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export { Mapping, SourceMap } from '@volar/source-map';
|
||||
export * from './lib/editor';
|
||||
export * from './lib/linkedCodeMap';
|
||||
export * from './lib/types';
|
||||
export * from './lib/utils';
|
||||
import type { Language, LanguagePlugin, MapperFactory, SourceScript, VirtualCode } from './lib/types';
|
||||
export declare const defaultMapperFactory: MapperFactory;
|
||||
export declare function createLanguage<T>(plugins: LanguagePlugin<T>[], scriptRegistry: Map<T, SourceScript<T>>, sync: (id: T, includeFsFiles: boolean, shouldRegister: boolean) => void, onAssociationDirty?: (targetId: T) => void): Language<T>;
|
||||
export declare function forEachEmbeddedCode(virtualCode: VirtualCode): Generator<VirtualCode>;
|
||||
239
web-app/node_modules/@volar/language-core/index.js
generated
vendored
Normal file
239
web-app/node_modules/@volar/language-core/index.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultMapperFactory = exports.SourceMap = void 0;
|
||||
exports.createLanguage = createLanguage;
|
||||
exports.forEachEmbeddedCode = forEachEmbeddedCode;
|
||||
var source_map_1 = require("@volar/source-map");
|
||||
Object.defineProperty(exports, "SourceMap", { enumerable: true, get: function () { return source_map_1.SourceMap; } });
|
||||
__exportStar(require("./lib/editor"), exports);
|
||||
__exportStar(require("./lib/linkedCodeMap"), exports);
|
||||
__exportStar(require("./lib/types"), exports);
|
||||
__exportStar(require("./lib/utils"), exports);
|
||||
const source_map_2 = require("@volar/source-map");
|
||||
const linkedCodeMap_1 = require("./lib/linkedCodeMap");
|
||||
const defaultMapperFactory = mappings => new source_map_2.SourceMap(mappings);
|
||||
exports.defaultMapperFactory = defaultMapperFactory;
|
||||
function createLanguage(plugins, scriptRegistry, sync, onAssociationDirty) {
|
||||
const virtualCodeToSourceScriptMap = new WeakMap();
|
||||
const virtualCodeToSourceMap = new WeakMap();
|
||||
const virtualCodeToLinkedCodeMap = new WeakMap();
|
||||
const language = {
|
||||
mapperFactory: exports.defaultMapperFactory,
|
||||
plugins,
|
||||
scripts: {
|
||||
fromVirtualCode(virtualCode) {
|
||||
return virtualCodeToSourceScriptMap.get(virtualCode);
|
||||
},
|
||||
get(id, includeFsFiles = true, shouldRegister = false) {
|
||||
sync(id, includeFsFiles, shouldRegister);
|
||||
const result = scriptRegistry.get(id);
|
||||
// The sync function provider may not always call the set function due to caching, so it is necessary to explicitly check isAssociationDirty.
|
||||
if (result?.isAssociationDirty) {
|
||||
this.set(id, result.snapshot, result.languageId);
|
||||
}
|
||||
return scriptRegistry.get(id);
|
||||
},
|
||||
set(id, snapshot, languageId, _plugins = plugins) {
|
||||
if (!languageId) {
|
||||
for (const plugin of plugins) {
|
||||
languageId = plugin.getLanguageId?.(id);
|
||||
if (languageId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!languageId) {
|
||||
console.warn(`languageId not found for ${id}`);
|
||||
return;
|
||||
}
|
||||
let associatedOnly = false;
|
||||
for (const plugin of plugins) {
|
||||
if (plugin.isAssociatedFileOnly?.(id, languageId)) {
|
||||
associatedOnly = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (scriptRegistry.has(id)) {
|
||||
const sourceScript = scriptRegistry.get(id);
|
||||
if (sourceScript.languageId !== languageId || sourceScript.associatedOnly !== associatedOnly) {
|
||||
this.delete(id);
|
||||
triggerTargetsDirty(sourceScript);
|
||||
return this.set(id, snapshot, languageId);
|
||||
}
|
||||
else if (associatedOnly) {
|
||||
if (sourceScript.snapshot !== snapshot) {
|
||||
sourceScript.snapshot = snapshot;
|
||||
triggerTargetsDirty(sourceScript);
|
||||
}
|
||||
}
|
||||
else if (sourceScript.isAssociationDirty || sourceScript.snapshot !== snapshot) {
|
||||
if (sourceScript.snapshot !== snapshot) {
|
||||
sourceScript.snapshot = snapshot;
|
||||
triggerTargetsDirty(sourceScript);
|
||||
}
|
||||
const codegenCtx = prepareCreateVirtualCode(sourceScript);
|
||||
if (sourceScript.generated) {
|
||||
const { updateVirtualCode, createVirtualCode } = sourceScript.generated.languagePlugin;
|
||||
const newVirtualCode = updateVirtualCode
|
||||
? updateVirtualCode(id, sourceScript.generated.root, snapshot, codegenCtx)
|
||||
: createVirtualCode?.(id, languageId, snapshot, codegenCtx);
|
||||
if (newVirtualCode) {
|
||||
sourceScript.generated.root = newVirtualCode;
|
||||
sourceScript.generated.embeddedCodes.clear();
|
||||
for (const code of forEachEmbeddedCode(sourceScript.generated.root)) {
|
||||
virtualCodeToSourceScriptMap.set(code, sourceScript);
|
||||
sourceScript.generated.embeddedCodes.set(code.id, code);
|
||||
}
|
||||
return sourceScript;
|
||||
}
|
||||
else {
|
||||
this.delete(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// not changed
|
||||
return sourceScript;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// created
|
||||
const sourceScript = {
|
||||
id: id,
|
||||
languageId,
|
||||
snapshot,
|
||||
associatedIds: new Set(),
|
||||
targetIds: new Set(),
|
||||
associatedOnly
|
||||
};
|
||||
scriptRegistry.set(id, sourceScript);
|
||||
if (associatedOnly) {
|
||||
return sourceScript;
|
||||
}
|
||||
for (const languagePlugin of _plugins) {
|
||||
const virtualCode = languagePlugin.createVirtualCode?.(id, languageId, snapshot, prepareCreateVirtualCode(sourceScript));
|
||||
if (virtualCode) {
|
||||
sourceScript.generated = {
|
||||
root: virtualCode,
|
||||
languagePlugin,
|
||||
embeddedCodes: new Map(),
|
||||
};
|
||||
for (const code of forEachEmbeddedCode(virtualCode)) {
|
||||
virtualCodeToSourceScriptMap.set(code, sourceScript);
|
||||
sourceScript.generated.embeddedCodes.set(code.id, code);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sourceScript;
|
||||
}
|
||||
},
|
||||
delete(id) {
|
||||
const sourceScript = scriptRegistry.get(id);
|
||||
if (sourceScript) {
|
||||
sourceScript.generated?.languagePlugin.disposeVirtualCode?.(id, sourceScript.generated.root);
|
||||
scriptRegistry.delete(id);
|
||||
triggerTargetsDirty(sourceScript);
|
||||
}
|
||||
},
|
||||
},
|
||||
maps: {
|
||||
get(virtualCode, sourceScript) {
|
||||
let mapCache = virtualCodeToSourceMap.get(virtualCode.snapshot);
|
||||
if (!mapCache) {
|
||||
virtualCodeToSourceMap.set(virtualCode.snapshot, mapCache = new WeakMap());
|
||||
}
|
||||
if (!mapCache.has(sourceScript.snapshot)) {
|
||||
const mappings = virtualCode.associatedScriptMappings?.get(sourceScript.id) ?? virtualCode.mappings;
|
||||
mapCache.set(sourceScript.snapshot, language.mapperFactory(mappings));
|
||||
}
|
||||
return mapCache.get(sourceScript.snapshot);
|
||||
},
|
||||
*forEach(virtualCode) {
|
||||
const sourceScript = virtualCodeToSourceScriptMap.get(virtualCode);
|
||||
yield [
|
||||
sourceScript,
|
||||
this.get(virtualCode, sourceScript),
|
||||
];
|
||||
if (virtualCode.associatedScriptMappings) {
|
||||
for (const [relatedScriptId] of virtualCode.associatedScriptMappings) {
|
||||
const relatedSourceScript = scriptRegistry.get(relatedScriptId);
|
||||
if (relatedSourceScript) {
|
||||
yield [
|
||||
relatedSourceScript,
|
||||
this.get(virtualCode, relatedSourceScript),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
linkedCodeMaps: {
|
||||
get(virtualCode) {
|
||||
const sourceScript = virtualCodeToSourceScriptMap.get(virtualCode);
|
||||
let mapCache = virtualCodeToLinkedCodeMap.get(virtualCode.snapshot);
|
||||
if (mapCache?.[0] !== sourceScript.snapshot) {
|
||||
virtualCodeToLinkedCodeMap.set(virtualCode.snapshot, mapCache = [
|
||||
sourceScript.snapshot,
|
||||
virtualCode.linkedCodeMappings
|
||||
? new linkedCodeMap_1.LinkedCodeMap(virtualCode.linkedCodeMappings)
|
||||
: undefined,
|
||||
]);
|
||||
}
|
||||
return mapCache[1];
|
||||
},
|
||||
},
|
||||
};
|
||||
return language;
|
||||
function triggerTargetsDirty(sourceScript) {
|
||||
sourceScript.targetIds.forEach(id => {
|
||||
const sourceScript = scriptRegistry.get(id);
|
||||
if (sourceScript) {
|
||||
sourceScript.isAssociationDirty = true;
|
||||
onAssociationDirty?.(sourceScript.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
function prepareCreateVirtualCode(sourceScript) {
|
||||
for (const id of sourceScript.associatedIds) {
|
||||
scriptRegistry.get(id)?.targetIds.delete(sourceScript.id);
|
||||
}
|
||||
sourceScript.associatedIds.clear();
|
||||
sourceScript.isAssociationDirty = false;
|
||||
return {
|
||||
getAssociatedScript(id) {
|
||||
sync(id, true, true);
|
||||
const relatedSourceScript = scriptRegistry.get(id);
|
||||
if (relatedSourceScript) {
|
||||
relatedSourceScript.targetIds.add(sourceScript.id);
|
||||
sourceScript.associatedIds.add(relatedSourceScript.id);
|
||||
}
|
||||
return relatedSourceScript;
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
function* forEachEmbeddedCode(virtualCode) {
|
||||
yield virtualCode;
|
||||
if (virtualCode.embeddedCodes) {
|
||||
for (const embeddedCode of virtualCode.embeddedCodes) {
|
||||
yield* forEachEmbeddedCode(embeddedCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
34
web-app/node_modules/@volar/language-core/lib/editor.d.ts
generated
vendored
Normal file
34
web-app/node_modules/@volar/language-core/lib/editor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { CodeInformation, Mapper } from './types';
|
||||
export declare function isHoverEnabled(info: CodeInformation): boolean;
|
||||
export declare function isInlayHintsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCodeLensEnabled(info: CodeInformation): boolean;
|
||||
export declare function isMonikerEnabled(info: CodeInformation): boolean;
|
||||
export declare function isInlineValueEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSemanticTokensEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCallHierarchyEnabled(info: CodeInformation): boolean;
|
||||
export declare function isTypeHierarchyEnabled(info: CodeInformation): boolean;
|
||||
export declare function isRenameEnabled(info: CodeInformation): boolean;
|
||||
export declare function isDefinitionEnabled(info: CodeInformation): boolean;
|
||||
export declare function isTypeDefinitionEnabled(info: CodeInformation): boolean;
|
||||
export declare function isReferencesEnabled(info: CodeInformation): boolean;
|
||||
export declare function isImplementationEnabled(info: CodeInformation): boolean;
|
||||
export declare function isHighlightEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSymbolsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isFoldingRangesEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSelectionRangesEnabled(info: CodeInformation): boolean;
|
||||
export declare function isLinkedEditingEnabled(info: CodeInformation): boolean;
|
||||
export declare function isColorEnabled(info: CodeInformation): boolean;
|
||||
export declare function isDocumentLinkEnabled(info: CodeInformation): boolean;
|
||||
export declare function isDiagnosticsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCodeActionsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isFormattingEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCompletionEnabled(info: CodeInformation): boolean;
|
||||
export declare function isAutoInsertEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSignatureHelpEnabled(info: CodeInformation): boolean;
|
||||
export declare function shouldReportDiagnostics(info: CodeInformation, source: string | undefined, code: string | number | undefined): boolean;
|
||||
export declare function resolveRenameNewName(newName: string, info: CodeInformation): string;
|
||||
export declare function resolveRenameEditText(text: string, info: CodeInformation): string;
|
||||
export declare function findOverlapCodeRange(start: number, end: number, map: Mapper, filter: (data: CodeInformation) => boolean): {
|
||||
start: number;
|
||||
end: number;
|
||||
} | undefined;
|
||||
182
web-app/node_modules/@volar/language-core/lib/editor.js
generated
vendored
Normal file
182
web-app/node_modules/@volar/language-core/lib/editor.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isHoverEnabled = isHoverEnabled;
|
||||
exports.isInlayHintsEnabled = isInlayHintsEnabled;
|
||||
exports.isCodeLensEnabled = isCodeLensEnabled;
|
||||
exports.isMonikerEnabled = isMonikerEnabled;
|
||||
exports.isInlineValueEnabled = isInlineValueEnabled;
|
||||
exports.isSemanticTokensEnabled = isSemanticTokensEnabled;
|
||||
exports.isCallHierarchyEnabled = isCallHierarchyEnabled;
|
||||
exports.isTypeHierarchyEnabled = isTypeHierarchyEnabled;
|
||||
exports.isRenameEnabled = isRenameEnabled;
|
||||
exports.isDefinitionEnabled = isDefinitionEnabled;
|
||||
exports.isTypeDefinitionEnabled = isTypeDefinitionEnabled;
|
||||
exports.isReferencesEnabled = isReferencesEnabled;
|
||||
exports.isImplementationEnabled = isImplementationEnabled;
|
||||
exports.isHighlightEnabled = isHighlightEnabled;
|
||||
exports.isSymbolsEnabled = isSymbolsEnabled;
|
||||
exports.isFoldingRangesEnabled = isFoldingRangesEnabled;
|
||||
exports.isSelectionRangesEnabled = isSelectionRangesEnabled;
|
||||
exports.isLinkedEditingEnabled = isLinkedEditingEnabled;
|
||||
exports.isColorEnabled = isColorEnabled;
|
||||
exports.isDocumentLinkEnabled = isDocumentLinkEnabled;
|
||||
exports.isDiagnosticsEnabled = isDiagnosticsEnabled;
|
||||
exports.isCodeActionsEnabled = isCodeActionsEnabled;
|
||||
exports.isFormattingEnabled = isFormattingEnabled;
|
||||
exports.isCompletionEnabled = isCompletionEnabled;
|
||||
exports.isAutoInsertEnabled = isAutoInsertEnabled;
|
||||
exports.isSignatureHelpEnabled = isSignatureHelpEnabled;
|
||||
exports.shouldReportDiagnostics = shouldReportDiagnostics;
|
||||
exports.resolveRenameNewName = resolveRenameNewName;
|
||||
exports.resolveRenameEditText = resolveRenameEditText;
|
||||
exports.findOverlapCodeRange = findOverlapCodeRange;
|
||||
function isHoverEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isInlayHintsEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isCodeLensEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isMonikerEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isInlineValueEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isSemanticTokensEnabled(info) {
|
||||
return typeof info.semantic === 'object'
|
||||
? info.semantic.shouldHighlight?.() ?? true
|
||||
: !!info.semantic;
|
||||
}
|
||||
function isCallHierarchyEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isTypeHierarchyEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isRenameEnabled(info) {
|
||||
return typeof info.navigation === 'object'
|
||||
? info.navigation.shouldRename?.() ?? true
|
||||
: !!info.navigation;
|
||||
}
|
||||
function isDefinitionEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isTypeDefinitionEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isReferencesEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isImplementationEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isHighlightEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isSymbolsEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isFoldingRangesEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isSelectionRangesEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isLinkedEditingEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isColorEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isDocumentLinkEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isDiagnosticsEnabled(info) {
|
||||
return !!info.verification;
|
||||
}
|
||||
function isCodeActionsEnabled(info) {
|
||||
return !!info.verification;
|
||||
}
|
||||
function isFormattingEnabled(info) {
|
||||
return !!info.format;
|
||||
}
|
||||
function isCompletionEnabled(info) {
|
||||
return !!info.completion;
|
||||
}
|
||||
function isAutoInsertEnabled(info) {
|
||||
return !!info.completion;
|
||||
}
|
||||
function isSignatureHelpEnabled(info) {
|
||||
return !!info.completion;
|
||||
}
|
||||
// should...
|
||||
function shouldReportDiagnostics(info, source, code) {
|
||||
return typeof info.verification === 'object'
|
||||
? info.verification.shouldReport?.(source, code) ?? true
|
||||
: !!info.verification;
|
||||
}
|
||||
// resolve...
|
||||
function resolveRenameNewName(newName, info) {
|
||||
return typeof info.navigation === 'object'
|
||||
? info.navigation.resolveRenameNewName?.(newName) ?? newName
|
||||
: newName;
|
||||
}
|
||||
function resolveRenameEditText(text, info) {
|
||||
return typeof info.navigation === 'object'
|
||||
? info.navigation.resolveRenameEditText?.(text) ?? text
|
||||
: text;
|
||||
}
|
||||
function findOverlapCodeRange(start, end, map, filter) {
|
||||
let mappedStart;
|
||||
let mappedEnd;
|
||||
for (const [mapped, mapping] of map.toGeneratedLocation(start)) {
|
||||
if (filter(mapping.data)) {
|
||||
mappedStart = mapped;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const [mapped, mapping] of map.toGeneratedLocation(end)) {
|
||||
if (filter(mapping.data)) {
|
||||
mappedEnd = mapped;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mappedStart === undefined || mappedEnd === undefined) {
|
||||
for (const mapping of map.mappings) {
|
||||
if (filter(mapping.data)) {
|
||||
const mappingStart = mapping.sourceOffsets[0];
|
||||
const mappingEnd = mapping.sourceOffsets[mapping.sourceOffsets.length - 1] + mapping.lengths[mapping.lengths.length - 1];
|
||||
const overlap = getOverlapRange(start, end, mappingStart, mappingEnd);
|
||||
if (overlap) {
|
||||
const curMappedStart = (overlap.start - mappingStart) + mapping.generatedOffsets[0];
|
||||
const lastGeneratedLength = (mapping.generatedLengths ?? mapping.lengths)[mapping.generatedOffsets.length - 1];
|
||||
const curMappedEndOffset = Math.min(overlap.end - mapping.sourceOffsets[mapping.sourceOffsets.length - 1], lastGeneratedLength);
|
||||
const curMappedEnd = mapping.generatedOffsets[mapping.generatedOffsets.length - 1] + curMappedEndOffset;
|
||||
mappedStart = mappedStart === undefined ? curMappedStart : Math.min(mappedStart, curMappedStart);
|
||||
mappedEnd = mappedEnd === undefined ? curMappedEnd : Math.max(mappedEnd, curMappedEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mappedStart !== undefined && mappedEnd !== undefined) {
|
||||
return {
|
||||
start: mappedStart,
|
||||
end: mappedEnd,
|
||||
};
|
||||
}
|
||||
}
|
||||
function getOverlapRange(range1Start, range1End, range2Start, range2End) {
|
||||
const start = Math.max(range1Start, range2Start);
|
||||
const end = Math.min(range1End, range2End);
|
||||
if (start > end) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=editor.js.map
|
||||
28
web-app/node_modules/@volar/language-core/lib/editorFeatures.d.ts
generated
vendored
Normal file
28
web-app/node_modules/@volar/language-core/lib/editorFeatures.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { CodeInformation } from './types';
|
||||
export declare function isHoverEnabled(info: CodeInformation): boolean;
|
||||
export declare function isInlayHintsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCodeLensEnabled(info: CodeInformation): boolean;
|
||||
export declare function isMonikerEnabled(info: CodeInformation): boolean;
|
||||
export declare function isInlineValueEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSemanticTokensEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCallHierarchyEnabled(info: CodeInformation): boolean;
|
||||
export declare function isTypeHierarchyEnabled(info: CodeInformation): boolean;
|
||||
export declare function isRenameEnabled(info: CodeInformation): boolean;
|
||||
export declare function isDefinitionEnabled(info: CodeInformation): boolean;
|
||||
export declare function isTypeDefinitionEnabled(info: CodeInformation): boolean;
|
||||
export declare function isReferencesEnabled(info: CodeInformation): boolean;
|
||||
export declare function isImplementationEnabled(info: CodeInformation): boolean;
|
||||
export declare function isHighlightEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSymbolsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isFoldingRangesEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSelectionRangesEnabled(info: CodeInformation): boolean;
|
||||
export declare function isLinkedEditingEnabled(info: CodeInformation): boolean;
|
||||
export declare function isColorEnabled(info: CodeInformation): boolean;
|
||||
export declare function isDocumentLinkEnabled(info: CodeInformation): boolean;
|
||||
export declare function isDiagnosticsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCodeActionsEnabled(info: CodeInformation): boolean;
|
||||
export declare function isFormattingEnabled(info: CodeInformation): boolean;
|
||||
export declare function isCompletionEnabled(info: CodeInformation): boolean;
|
||||
export declare function isAutoInsertEnabled(info: CodeInformation): boolean;
|
||||
export declare function isSignatureHelpEnabled(info: CodeInformation): boolean;
|
||||
export declare function shouldReportDiagnostics(info: CodeInformation, source: string | undefined, code: string | number | undefined): boolean;
|
||||
118
web-app/node_modules/@volar/language-core/lib/editorFeatures.js
generated
vendored
Normal file
118
web-app/node_modules/@volar/language-core/lib/editorFeatures.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isHoverEnabled = isHoverEnabled;
|
||||
exports.isInlayHintsEnabled = isInlayHintsEnabled;
|
||||
exports.isCodeLensEnabled = isCodeLensEnabled;
|
||||
exports.isMonikerEnabled = isMonikerEnabled;
|
||||
exports.isInlineValueEnabled = isInlineValueEnabled;
|
||||
exports.isSemanticTokensEnabled = isSemanticTokensEnabled;
|
||||
exports.isCallHierarchyEnabled = isCallHierarchyEnabled;
|
||||
exports.isTypeHierarchyEnabled = isTypeHierarchyEnabled;
|
||||
exports.isRenameEnabled = isRenameEnabled;
|
||||
exports.isDefinitionEnabled = isDefinitionEnabled;
|
||||
exports.isTypeDefinitionEnabled = isTypeDefinitionEnabled;
|
||||
exports.isReferencesEnabled = isReferencesEnabled;
|
||||
exports.isImplementationEnabled = isImplementationEnabled;
|
||||
exports.isHighlightEnabled = isHighlightEnabled;
|
||||
exports.isSymbolsEnabled = isSymbolsEnabled;
|
||||
exports.isFoldingRangesEnabled = isFoldingRangesEnabled;
|
||||
exports.isSelectionRangesEnabled = isSelectionRangesEnabled;
|
||||
exports.isLinkedEditingEnabled = isLinkedEditingEnabled;
|
||||
exports.isColorEnabled = isColorEnabled;
|
||||
exports.isDocumentLinkEnabled = isDocumentLinkEnabled;
|
||||
exports.isDiagnosticsEnabled = isDiagnosticsEnabled;
|
||||
exports.isCodeActionsEnabled = isCodeActionsEnabled;
|
||||
exports.isFormattingEnabled = isFormattingEnabled;
|
||||
exports.isCompletionEnabled = isCompletionEnabled;
|
||||
exports.isAutoInsertEnabled = isAutoInsertEnabled;
|
||||
exports.isSignatureHelpEnabled = isSignatureHelpEnabled;
|
||||
exports.shouldReportDiagnostics = shouldReportDiagnostics;
|
||||
function isHoverEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isInlayHintsEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isCodeLensEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isMonikerEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isInlineValueEnabled(info) {
|
||||
return !!info.semantic;
|
||||
}
|
||||
function isSemanticTokensEnabled(info) {
|
||||
return typeof info.semantic === 'object'
|
||||
? info.semantic.shouldHighlight?.() ?? true
|
||||
: !!info.semantic;
|
||||
}
|
||||
function isCallHierarchyEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isTypeHierarchyEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isRenameEnabled(info) {
|
||||
return typeof info.navigation === 'object'
|
||||
? info.navigation.shouldRename?.() ?? true
|
||||
: !!info.navigation;
|
||||
}
|
||||
function isDefinitionEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isTypeDefinitionEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isReferencesEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isImplementationEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isHighlightEnabled(info) {
|
||||
return !!info.navigation;
|
||||
}
|
||||
function isSymbolsEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isFoldingRangesEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isSelectionRangesEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isLinkedEditingEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isColorEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isDocumentLinkEnabled(info) {
|
||||
return !!info.structure;
|
||||
}
|
||||
function isDiagnosticsEnabled(info) {
|
||||
return !!info.verification;
|
||||
}
|
||||
function isCodeActionsEnabled(info) {
|
||||
return !!info.verification;
|
||||
}
|
||||
function isFormattingEnabled(info) {
|
||||
return !!info.format;
|
||||
}
|
||||
function isCompletionEnabled(info) {
|
||||
return !!info.completion;
|
||||
}
|
||||
function isAutoInsertEnabled(info) {
|
||||
return !!info.completion;
|
||||
}
|
||||
function isSignatureHelpEnabled(info) {
|
||||
return !!info.completion;
|
||||
}
|
||||
// should...
|
||||
function shouldReportDiagnostics(info, source, code) {
|
||||
return typeof info.verification === 'object'
|
||||
? info.verification.shouldReport?.(source, code) ?? true
|
||||
: !!info.verification;
|
||||
}
|
||||
//# sourceMappingURL=editorFeatures.js.map
|
||||
4
web-app/node_modules/@volar/language-core/lib/linkedCodeMap.d.ts
generated
vendored
Normal file
4
web-app/node_modules/@volar/language-core/lib/linkedCodeMap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { SourceMap } from '@volar/source-map';
|
||||
export declare class LinkedCodeMap extends SourceMap<any> {
|
||||
getLinkedOffsets(start: number): Generator<number, void, unknown>;
|
||||
}
|
||||
16
web-app/node_modules/@volar/language-core/lib/linkedCodeMap.js
generated
vendored
Normal file
16
web-app/node_modules/@volar/language-core/lib/linkedCodeMap.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LinkedCodeMap = void 0;
|
||||
const source_map_1 = require("@volar/source-map");
|
||||
class LinkedCodeMap extends source_map_1.SourceMap {
|
||||
*getLinkedOffsets(start) {
|
||||
for (const mapped of this.toGeneratedLocation(start)) {
|
||||
yield mapped[0];
|
||||
}
|
||||
for (const mapped of this.toSourceLocation(start)) {
|
||||
yield mapped[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.LinkedCodeMap = LinkedCodeMap;
|
||||
//# sourceMappingURL=linkedCodeMap.js.map
|
||||
155
web-app/node_modules/@volar/language-core/lib/types.d.ts
generated
vendored
Normal file
155
web-app/node_modules/@volar/language-core/lib/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
import type { Mapping } from '@volar/source-map';
|
||||
import type { LinkedCodeMap } from './linkedCodeMap';
|
||||
export interface Mapper {
|
||||
mappings: Mapping<CodeInformation>[];
|
||||
toSourceRange(start: number, end: number, fallbackToAnyMatch: boolean, filter?: (data: CodeInformation) => boolean): Generator<readonly [number, number, Mapping<CodeInformation>, Mapping<CodeInformation>]>;
|
||||
toGeneratedRange(start: number, end: number, fallbackToAnyMatch: boolean, filter?: (data: CodeInformation) => boolean): Generator<readonly [number, number, Mapping<CodeInformation>, Mapping<CodeInformation>]>;
|
||||
toSourceLocation(generatedOffset: number, filter?: (data: CodeInformation) => boolean): Generator<readonly [number, Mapping<CodeInformation>]>;
|
||||
toGeneratedLocation(sourceOffset: number, filter?: (data: CodeInformation) => boolean): Generator<readonly [number, Mapping<CodeInformation>]>;
|
||||
}
|
||||
export type MapperFactory = (mappings: Mapping<CodeInformation>[]) => Mapper;
|
||||
export interface Language<T = unknown> {
|
||||
mapperFactory: MapperFactory;
|
||||
plugins: LanguagePlugin<T>[];
|
||||
scripts: {
|
||||
get(id: T, includeFsFiles?: boolean, shouldRegister?: boolean): SourceScript<T> | undefined;
|
||||
set(id: T, snapshot: IScriptSnapshot, languageId?: string, plugins?: LanguagePlugin<T>[]): SourceScript<T> | undefined;
|
||||
delete(id: T): void;
|
||||
fromVirtualCode(virtualCode: VirtualCode): SourceScript<T>;
|
||||
};
|
||||
maps: {
|
||||
get(virtualCode: VirtualCode, sourceScript: SourceScript<T>): Mapper;
|
||||
forEach(virtualCode: VirtualCode): Generator<[sourceScript: SourceScript<T>, map: Mapper]>;
|
||||
};
|
||||
linkedCodeMaps: {
|
||||
get(virtualCode: VirtualCode): LinkedCodeMap | undefined;
|
||||
};
|
||||
}
|
||||
export interface SourceScript<T = unknown> {
|
||||
id: T;
|
||||
languageId: string;
|
||||
snapshot: IScriptSnapshot;
|
||||
targetIds: Set<T>;
|
||||
associatedIds: Set<T>;
|
||||
associatedOnly: boolean;
|
||||
isAssociationDirty?: boolean;
|
||||
generated?: {
|
||||
root: VirtualCode;
|
||||
languagePlugin: LanguagePlugin<T>;
|
||||
embeddedCodes: Map<string, VirtualCode>;
|
||||
};
|
||||
}
|
||||
export type CodeMapping = Mapping<CodeInformation>;
|
||||
export interface VirtualCode {
|
||||
id: string;
|
||||
languageId: string;
|
||||
snapshot: IScriptSnapshot;
|
||||
mappings: CodeMapping[];
|
||||
associatedScriptMappings?: Map<unknown, CodeMapping[]>;
|
||||
embeddedCodes?: VirtualCode[];
|
||||
linkedCodeMappings?: Mapping[];
|
||||
}
|
||||
/**
|
||||
* CodeInformation is a configuration object attached to each CodeMapping (between source code and generated code,
|
||||
* e.g. between the template code in a .vue file and the type-checkable TS code generated from it) that
|
||||
* determines what code/language features are expected to be available for the mapping.
|
||||
*
|
||||
* Due to the dynamic nature of code generation and the fact that, for example, things like Code Actions
|
||||
* and auto-complete shouldn't be triggerable on certain "in-between" regions of generated code, we need
|
||||
* a way to shut off certain features in certain regions, while leaving them enabled in others.
|
||||
*/
|
||||
export interface CodeInformation {
|
||||
/** virtual code is expected to support verification, where verification includes:
|
||||
*
|
||||
* - diagnostics (syntactic, semantic, and others, such as those generated by the TypeScript language service on generated TS code)
|
||||
* - code actions (refactorings, quick fixes,etc.)
|
||||
*/
|
||||
verification?: boolean | {
|
||||
/**
|
||||
* when present, `shouldReport` callback is invoked to determine whether a diagnostic
|
||||
* raised in the generated code should be propagated back to the original source code.
|
||||
* Note that when this callback is present, diagnostic processing (e.g. typechecking) will
|
||||
* still be performed, but the results will not be reported back to the original source code. */
|
||||
shouldReport?(source: string | undefined, code: string | number | undefined): boolean;
|
||||
};
|
||||
/** virtual code is expected to support assisted completion */
|
||||
completion?: boolean | {
|
||||
isAdditional?: boolean;
|
||||
onlyImport?: boolean;
|
||||
};
|
||||
/** virtual code is expected correctly reflect semantic of the source code. Specifically this controls the following langauge features:
|
||||
*
|
||||
* - hover
|
||||
* - inlay hints
|
||||
* - code lens
|
||||
* - semantic tokens
|
||||
* - others
|
||||
*
|
||||
* Note that semantic diagnostics (e.g. TS type-checking) are covered by the `verification` property above.
|
||||
*/
|
||||
semantic?: boolean | {
|
||||
shouldHighlight?(): boolean;
|
||||
};
|
||||
/** virtual code is expected correctly reflect reference relationships of the source code */
|
||||
navigation?: boolean | {
|
||||
shouldRename?(): boolean;
|
||||
resolveRenameNewName?(newName: string): string;
|
||||
resolveRenameEditText?(newText: string): string;
|
||||
};
|
||||
/** virtual code is expected correctly reflect the structural information of the source code */
|
||||
structure?: boolean;
|
||||
/** virtual code is expected correctly reflect the format information of the source code */
|
||||
format?: boolean;
|
||||
}
|
||||
export interface LanguagePlugin<T = unknown, K extends VirtualCode = VirtualCode> {
|
||||
/**
|
||||
* For files that are not opened in the IDE, the language ID will not be synchronized to the language server, so a hook is needed to parse the language ID of files that are known extension but not opened in the IDE.
|
||||
*/
|
||||
getLanguageId(scriptId: T): string | undefined;
|
||||
/**
|
||||
* Generate a virtual code.
|
||||
*/
|
||||
createVirtualCode?(scriptId: T, languageId: string, snapshot: IScriptSnapshot, ctx: CodegenContext<T>): K | undefined;
|
||||
/**
|
||||
* Incremental update a virtual code. If not provide, call createVirtualCode again.
|
||||
*/
|
||||
updateVirtualCode?(scriptId: T, virtualCode: K, newSnapshot: IScriptSnapshot, ctx: CodegenContext<T>): K | undefined;
|
||||
/**
|
||||
* Cleanup a virtual code.
|
||||
*/
|
||||
disposeVirtualCode?(scriptId: T, virtualCode: K): void;
|
||||
/**
|
||||
* Some file types should not be parsed or processed as TypeScript files,
|
||||
* as they are used only as sources for generated files.
|
||||
*
|
||||
* This functionality is required only in TS plugin mode.
|
||||
*/
|
||||
isAssociatedFileOnly?(scriptId: T, languageId: string): boolean;
|
||||
}
|
||||
export interface CodegenContext<T = unknown> {
|
||||
getAssociatedScript(scriptId: T): SourceScript<T> | undefined;
|
||||
}
|
||||
export interface IScriptSnapshot {
|
||||
/** Gets a portion of the script snapshot specified by [start, end). */
|
||||
getText(start: number, end: number): string;
|
||||
/** Gets the length of this script snapshot. */
|
||||
getLength(): number;
|
||||
/**
|
||||
* Gets the TextChangeRange that describe how the text changed between this text and
|
||||
* an older version. This information is used by the incremental parser to determine
|
||||
* what sections of the script need to be re-parsed. 'undefined' can be returned if the
|
||||
* change range cannot be determined. However, in that case, incremental parsing will
|
||||
* not happen and the entire document will be re - parsed.
|
||||
*/
|
||||
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
|
||||
/** Releases all resources held by this script snapshot */
|
||||
dispose?(): void;
|
||||
}
|
||||
export interface TextChangeRange {
|
||||
span: TextSpan;
|
||||
newLength: number;
|
||||
}
|
||||
export interface TextSpan {
|
||||
start: number;
|
||||
length: number;
|
||||
}
|
||||
3
web-app/node_modules/@volar/language-core/lib/types.js
generated
vendored
Normal file
3
web-app/node_modules/@volar/language-core/lib/types.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
12
web-app/node_modules/@volar/language-core/lib/utils.d.ts
generated
vendored
Normal file
12
web-app/node_modules/@volar/language-core/lib/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export declare class FileMap<T> extends Map<string, T> {
|
||||
private caseSensitive;
|
||||
private originalFileNames;
|
||||
constructor(caseSensitive: boolean);
|
||||
keys(): IterableIterator<string>;
|
||||
get(key: string): T | undefined;
|
||||
has(key: string): boolean;
|
||||
set(key: string, value: T): this;
|
||||
delete(key: string): boolean;
|
||||
clear(): void;
|
||||
normalizeId(id: string): string;
|
||||
}
|
||||
36
web-app/node_modules/@volar/language-core/lib/utils.js
generated
vendored
Normal file
36
web-app/node_modules/@volar/language-core/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FileMap = void 0;
|
||||
class FileMap extends Map {
|
||||
constructor(caseSensitive) {
|
||||
super();
|
||||
this.caseSensitive = caseSensitive;
|
||||
this.originalFileNames = new Map();
|
||||
}
|
||||
keys() {
|
||||
return this.originalFileNames.values();
|
||||
}
|
||||
get(key) {
|
||||
return super.get(this.normalizeId(key));
|
||||
}
|
||||
has(key) {
|
||||
return super.has(this.normalizeId(key));
|
||||
}
|
||||
set(key, value) {
|
||||
this.originalFileNames.set(this.normalizeId(key), key);
|
||||
return super.set(this.normalizeId(key), value);
|
||||
}
|
||||
delete(key) {
|
||||
this.originalFileNames.delete(this.normalizeId(key));
|
||||
return super.delete(this.normalizeId(key));
|
||||
}
|
||||
clear() {
|
||||
this.originalFileNames.clear();
|
||||
return super.clear();
|
||||
}
|
||||
normalizeId(id) {
|
||||
return this.caseSensitive ? id : id.toLowerCase();
|
||||
}
|
||||
}
|
||||
exports.FileMap = FileMap;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
18
web-app/node_modules/@volar/language-core/package.json
generated
vendored
Normal file
18
web-app/node_modules/@volar/language-core/package.json
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@volar/language-core",
|
||||
"version": "2.4.15",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"**/*.js",
|
||||
"**/*.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/volarjs/volar.js.git",
|
||||
"directory": "packages/language-core"
|
||||
},
|
||||
"dependencies": {
|
||||
"@volar/source-map": "2.4.15"
|
||||
},
|
||||
"gitHead": "adcdcbc801b284cce3239fec231c7f4cebfd8688"
|
||||
}
|
||||
Reference in New Issue
Block a user