UNPKG

cm-spyglass

Version:

A Codemirror extension that provides syntax highlighting, linting, and autocompletion for Minecraft datapacks using SpyglassMC

51 lines (43 loc) 945 B
export default class BundledDependency { /** * @return {string} * @abstract */ getIdentifier() { } /** * @return {import("@spyglassmc/core").ExternalFileSystem} * @abstract */ getFileSystem() { } /** * @return {string} */ getBaseUri() { return 'file:///'; } /** * @return {string} */ getMountPoint() { return `file:///${this.getIdentifier()}/`; } /** * @return {import("@spyglassmc/core").DependencyKey} */ getDependencyName() { // noinspection JSValidateTypes return `@${this.getIdentifier()}`; } /** * @return {Function} */ getInitializer() { return (ctx) => { ctx.meta.registerDependencyProvider(this.getDependencyName(), async () => { return {info: {startDepth: 0}, uri: this.getMountPoint()}; }); } } }