src/vs/editor/common/services/treeSitter/treeSitterLibraryService.ts
67 LOC · 67 covered · 0 uncovered · 1 ranges · 1708 concepts · 1 introducers · 861 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
/*---------------------------------------------------------------------------------------------
textModel.ts ×190
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { Language, Parser, Query } from '@vscode/tree-sitter-wasm';
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
import { IReader } from '../../../../base/common/observable.js';
export const ITreeSitterLibraryService = createDecorator<ITreeSitterLibraryService>('treeSitterLibraryService');
export interface ITreeSitterLibraryService {
readonly _serviceBrand: undefined;
/**
* Gets the tree sitter Parser constructor.
*/
getParserClass(): Promise<typeof Parser>;
/**
* Checks whether a language is supported and available based setting enablement.
* @param languageId The language identifier to check.
* @param reader Optional observable reader.
*/
supportsLanguage(languageId: string, reader: IReader | undefined): boolean;
/**
* Gets the tree sitter Language object synchronously.
* @param languageId The language identifier to retrieve.
* @param ignoreSupportsCheck Whether to ignore the supportsLanguage check.
* @param reader Optional observable reader.
*/
getLanguage(languageId: string, ignoreSupportsCheck: boolean, reader: IReader | undefined): Language | undefined;
/**
* Gets the language as a promise, as opposed to via observables. This ignores the automatic
* supportsLanguage check.
*
* Warning: This approach is generally not recommended as it's not reactive, but it's the only
* way to catch and handle import errors when the grammar fails to load.
* @param languageId The language identifier to retrieve.
*/
getLanguagePromise(languageId: string): Promise<Language | undefined>;
/**
* Gets the injection queries for a language. A return value of `null`
* indicates that there are no highlights queries for this language.
* @param languageId The language identifier to retrieve queries for.
* @param reader Optional observable reader.
*/
getInjectionQueries(languageId: string, reader: IReader | undefined): Query | null | undefined;
/**
* Gets the highlighting queries for a language. A return value of `null`
* indicates that there are no highlights queries for this language.
* @param languageId The language identifier to retrieve queries for.
* @param reader Optional observable reader.
*/
getHighlightingQueries(languageId: string, reader: IReader | undefined): Query | null | undefined;
/**
* Creates a one-off custom query for a language.
* @param language The Language to create the query for.
* @param querySource The query source string to compile.
*/
createQuery(language: Language, querySource: string): Promise<Query>;
}