import { Position } from 'vscode-languageserver/node'; import { URI as Uri } from 'vscode-uri'; import { Config } from '.'; import { IdentityNode } from '../nodes'; import { DatapackLanguageService } from '../services/DatapackLanguageService'; import { IndexMapping } from './IndexMapping'; import { ParserSuggestion } from './ParserSuggestion'; import { TextRange } from './TextRange'; export declare const CacheVersion = 11; export declare const DefaultCacheFile: { cache: {}; advancements: {}; tags: { functions: {}; }; files: {}; version: number; }; export interface CacheFile { cache: ClientCache; files: { [uri: string]: number | undefined; }; version: number; } export declare const WorldgenFileTypes: readonly ["worldgen/biome", "worldgen/configured_carver", "worldgen/configured_decorator", "worldgen/configured_feature", "worldgen/configured_structure_feature", "worldgen/configured_surface_builder", "worldgen/density_function", "worldgen/flat_level_generator_preset", "worldgen/noise", "worldgen/noise_settings", "worldgen/placed_feature", "worldgen/processor_list", "worldgen/structure", "worldgen/structure_set", "worldgen/template_pool", "worldgen/world_preset"]; export declare const TagFileTypes: readonly ["tag/block", "tag/damage_type", "tag/entity_type", "tag/fluid", "tag/function", "tag/game_event", "tag/item", "tag/worldgen/biome", "tag/worldgen/configured_carver", "tag/worldgen/configured_decorator", "tag/worldgen/configured_feature", "tag/worldgen/configured_structure_feature", "tag/worldgen/configured_surface_builder", "tag/worldgen/density_function", "tag/worldgen/noise", "tag/worldgen/noise_settings", "tag/worldgen/placed_feature", "tag/worldgen/processor_list", "tag/worldgen/structure", "tag/worldgen/structure_set", "tag/worldgen/template_pool"]; export declare const FileTypes: readonly ["advancement", "damage_type", "dimension", "dimension_type", "function", "item_modifier", "loot_table", "predicate", "recipe", "structure", "tag/block", "tag/damage_type", "tag/entity_type", "tag/fluid", "tag/function", "tag/game_event", "tag/item", "tag/worldgen/biome", "tag/worldgen/configured_carver", "tag/worldgen/configured_decorator", "tag/worldgen/configured_feature", "tag/worldgen/configured_structure_feature", "tag/worldgen/configured_surface_builder", "tag/worldgen/density_function", "tag/worldgen/noise", "tag/worldgen/noise_settings", "tag/worldgen/placed_feature", "tag/worldgen/processor_list", "tag/worldgen/structure", "tag/worldgen/structure_set", "tag/worldgen/template_pool", "worldgen/biome", "worldgen/configured_carver", "worldgen/configured_decorator", "worldgen/configured_feature", "worldgen/configured_structure_feature", "worldgen/configured_surface_builder", "worldgen/density_function", "worldgen/flat_level_generator_preset", "worldgen/noise", "worldgen/noise_settings", "worldgen/placed_feature", "worldgen/processor_list", "worldgen/structure", "worldgen/structure_set", "worldgen/template_pool", "worldgen/world_preset"]; export declare const AliasTypes: readonly ["alias/entity", "alias/uuid", "alias/vector"]; export declare const InternalTypes: readonly ["color", "alias/entity", "alias/uuid", "alias/vector"]; export declare const MiscTypes: readonly ["bossbar", "entity", "objective", "score_holder", "storage", "tag", "team", "sequence"]; export declare const DeclarableTypes: readonly ["advancement", "damage_type", "dimension", "dimension_type", "function", "item_modifier", "loot_table", "predicate", "recipe", "structure", "tag/block", "tag/damage_type", "tag/entity_type", "tag/fluid", "tag/function", "tag/game_event", "tag/item", "tag/worldgen/biome", "tag/worldgen/configured_carver", "tag/worldgen/configured_decorator", "tag/worldgen/configured_feature", "tag/worldgen/configured_structure_feature", "tag/worldgen/configured_surface_builder", "tag/worldgen/density_function", "tag/worldgen/noise", "tag/worldgen/noise_settings", "tag/worldgen/placed_feature", "tag/worldgen/processor_list", "tag/worldgen/structure", "tag/worldgen/structure_set", "tag/worldgen/template_pool", "worldgen/biome", "worldgen/configured_carver", "worldgen/configured_decorator", "worldgen/configured_feature", "worldgen/configured_structure_feature", "worldgen/configured_surface_builder", "worldgen/density_function", "worldgen/flat_level_generator_preset", "worldgen/noise", "worldgen/noise_settings", "worldgen/placed_feature", "worldgen/processor_list", "worldgen/structure", "worldgen/structure_set", "worldgen/template_pool", "worldgen/world_preset", "bossbar", "entity", "objective", "score_holder", "storage", "tag", "team", "sequence"]; export declare const CacheTypes: ("function" | "advancement" | "damage_type" | "dimension" | "dimension_type" | "item_modifier" | "loot_table" | "predicate" | "recipe" | "structure" | "tag/block" | "tag/damage_type" | "tag/entity_type" | "tag/fluid" | "tag/function" | "tag/game_event" | "tag/item" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_decorator" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/density_function" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/structure" | "tag/worldgen/structure_set" | "tag/worldgen/template_pool" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_decorator" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/density_function" | "worldgen/flat_level_generator_preset" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/structure" | "worldgen/structure_set" | "worldgen/template_pool" | "worldgen/world_preset" | "entity" | "objective" | "tag" | "team" | "bossbar" | "score_holder" | "storage" | "sequence" | "color" | "alias/entity" | "alias/uuid" | "alias/vector")[]; export declare const NamespacedTypes: readonly ["advancement", "damage_type", "dimension", "dimension_type", "function", "item_modifier", "loot_table", "predicate", "recipe", "structure", "tag/block", "tag/damage_type", "tag/entity_type", "tag/fluid", "tag/function", "tag/game_event", "tag/item", "tag/worldgen/biome", "tag/worldgen/configured_carver", "tag/worldgen/configured_decorator", "tag/worldgen/configured_feature", "tag/worldgen/configured_structure_feature", "tag/worldgen/configured_surface_builder", "tag/worldgen/density_function", "tag/worldgen/noise", "tag/worldgen/noise_settings", "tag/worldgen/placed_feature", "tag/worldgen/processor_list", "tag/worldgen/structure", "tag/worldgen/structure_set", "tag/worldgen/template_pool", "worldgen/biome", "worldgen/configured_carver", "worldgen/configured_decorator", "worldgen/configured_feature", "worldgen/configured_structure_feature", "worldgen/configured_surface_builder", "worldgen/density_function", "worldgen/flat_level_generator_preset", "worldgen/noise", "worldgen/noise_settings", "worldgen/placed_feature", "worldgen/processor_list", "worldgen/structure", "worldgen/structure_set", "worldgen/template_pool", "worldgen/world_preset", "bossbar", "storage"]; export declare type TagFileType = typeof TagFileTypes[number]; export declare type WorldgenFileType = typeof WorldgenFileTypes[number]; export declare type FileType = typeof FileTypes[number]; export declare type MiscType = typeof MiscTypes[number]; export declare type DeclarableType = typeof DeclarableTypes[number]; export declare type AliasType = typeof AliasTypes[number]; export declare type InternalType = typeof InternalTypes[number]; export declare type CacheType = typeof CacheTypes[number]; export declare type NamespacedType = typeof NamespacedTypes[number]; /** * Represent a cache which is used to accelerate renaming and computing completions. */ export declare type ClientCache = Partial>; export declare function isTagFileType(value: string): value is TagFileType; export declare function isWorldgenRegistryFileType(value: string): value is WorldgenFileType; export declare function isFileType(value: string): value is FileType; export declare function isMiscType(value: CacheType): value is MiscType; export declare function isDeclarableType(value: string): value is DeclarableType; export declare function isAliasType(value: string): value is AliasType; export declare function isInternalType(value: string): value is InternalType; export declare function isCacheType(value: string): value is CacheType; export declare function isNamespacedType(value: string): value is NamespacedType; /** * A category in `ClientCache`. */ export declare type CacheCategory = { /** * The unit regarding this id. */ [id: string]: CacheUnit | undefined; }; export declare type CacheUnitPositionType = 'dcl' | 'def' | 'ref'; export declare const CacheUnitPositionTypes: CacheUnitPositionType[]; export declare function isCacheUnitPositionType(value: string): value is CacheUnitPositionType; /** * An unit in `CacheCategory`. */ export declare type CacheUnit = { /** * The user-defined documentation for the unit. */ doc?: string; /** * Additional value for this unit. Currently it's only used by aliases. */ foo?: any; } & { [key in CacheUnitPositionType]?: CachePosition[]; }; export declare type CacheVisibility = { pattern: string; type: FileType | '*'; }; /** * An element in `CacheUnit`. */ export interface CachePosition extends TextRange { uri?: string; /** * An array of identities describing the visibility of this element. */ visibility?: CacheVisibility[]; startLine?: number; startChar?: number; endLine?: number; endChar?: number; } export declare function getCacheFromOffset(cache: ClientCache, offset: number): { type: "function" | "advancement" | "damage_type" | "dimension" | "dimension_type" | "item_modifier" | "loot_table" | "predicate" | "recipe" | "structure" | "tag/block" | "tag/damage_type" | "tag/entity_type" | "tag/fluid" | "tag/function" | "tag/game_event" | "tag/item" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_decorator" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/density_function" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/structure" | "tag/worldgen/structure_set" | "tag/worldgen/template_pool" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_decorator" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/density_function" | "worldgen/flat_level_generator_preset" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/structure" | "worldgen/structure_set" | "worldgen/template_pool" | "worldgen/world_preset" | "entity" | "objective" | "tag" | "team" | "bossbar" | "score_holder" | "storage" | "sequence" | "color" | "alias/entity" | "alias/uuid" | "alias/vector"; id: string; start: number; end: number; } | undefined; export declare function remapCachePosition(cache: ClientCache, mapping: IndexMapping): void; export declare function removeCachePosition(cache: ClientCache, uri: Uri): void; export declare function removeCacheUnit(cache: ClientCache, type: CacheType, id: string): void; /** * Combine base cache with overriding cache. * @param base Base cache. * @param override Overriding cache. */ export declare function combineCache(base?: ClientCache, override?: ClientCache, addition?: { uri: Uri; getPosition: (offset: number) => Position; }): Partial>; export declare function getFileTypeFromCategory(category: string): FileType; export declare function trimCache(cache: ClientCache): void; export declare function getCacheVisibilities(visibility: 'private' | 'internal' | 'public', definitionType: FileType, definitionID: IdentityNode): CacheVisibility[]; export declare function testID(service: DatapackLanguageService, visibility: CacheVisibility | CacheVisibility[] | null | undefined, forType: FileType, forID: IdentityNode, definitionUri: string | undefined, config: Config): boolean; /** * Pure function. */ export declare function getCacheForID(service: DatapackLanguageService, forType: FileType, forID: IdentityNode, config: Config): Partial>; export declare function getSafeCategory(cache: ClientCache | undefined, type: CacheType): CacheCategory; export declare function setUpUnit(cache: ClientCache | undefined, type: CacheType, id: IdentityNode, defaultValue?: CacheUnit): CacheUnit; export declare function getCompletions(cache: ClientCache, type: CacheType, start: number, end: number): ParserSuggestion[];