@shopify/theme-language-server-common
Version:
<h1 align="center" style="position: relative;" > <br> <img src="https://github.com/Shopify/theme-check-vscode/blob/main/images/shopify_glyph.png?raw=true" alt="logo" width="141" height="160"> <br> Theme Language Server </h1>
39 lines (38 loc) • 1.76 kB
TypeScript
import { AbstractFileSystem, SourceCode, SourceCodeType } from '@shopify/theme-check-common';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { URI } from 'vscode-languageserver-types';
export type AugmentedSourceCode<SCT extends SourceCodeType = SourceCodeType> = SourceCode<SCT> & {
textDocument: TextDocument;
uri: URI;
};
export type AugmentedLiquidSourceCode = AugmentedSourceCode<SourceCodeType.LiquidHtml>;
export type AugmentedJsonSourceCode = AugmentedSourceCode<SourceCodeType.JSON>;
export declare class DocumentManager {
/**
* The sourceCodes map is a map of URIs to SourceCodes. It is used to keep
* track of all the open documents in the workspace as well as caching the ASTs
* of the documents.
*
* Files that are opened in the editor have a defined version, while files that
* are preloaded have a version of `undefined`.
*/
private sourceCodes;
private readonly fs;
constructor(fs?: AbstractFileSystem);
open(uri: URI, source: string, version: number | undefined): void;
change(uri: URI, source: string, version: number | undefined): void;
close(uri: URI): boolean;
delete(uri: URI): boolean;
theme(root: URI, includeFilesFromDisk?: boolean): AugmentedSourceCode[];
get openDocuments(): AugmentedSourceCode[];
get(uri: URI): AugmentedSourceCode<SourceCodeType> | undefined;
private set;
/**
* The preload method is used to pre-load and pre-parse all the files in the
* theme. It is smart and only will load files that are not already in the
* DocumentManager.
*
* Files that are loaded from the AbstractFileSystem will have a version of `undefined`.
*/
preload(rootUri: URI): Promise<void>;
}