src/vs/editor/common/services/resolverService.ts
90 LOC · 86 covered · 4 uncovered · 1 ranges · 58 concepts · 1 introducers · 33 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.
/*---------------------------------------------------------------------------------------------
agentHostResourceService.ts ×28
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from '../../../base/common/event.js';
import { IMarkdownString } from '../../../base/common/htmlContent.js';
import { IDisposable, IReference } from '../../../base/common/lifecycle.js';
import { URI } from '../../../base/common/uri.js';
import { ITextModel, ITextSnapshot } from '../model.js';
import { IResolvableEditorModel } from '../../../platform/editor/common/editor.js';
import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';
export const ITextModelService = createDecorator<ITextModelService>('textModelService');
export interface ITextModelService {
readonly _serviceBrand: undefined;
/**
* Provided a resource URI, it will return a model reference
* which should be disposed once not needed anymore.
*/
createModelReference(resource: URI): Promise<IReference<IResolvedTextEditorModel>>;
/**
* Registers a specific `scheme` content provider.
*/
registerTextModelContentProvider(scheme: string, provider: ITextModelContentProvider): IDisposable;
/**
* Check if the given resource can be resolved to a text model.
*/
canHandleResource(resource: URI): boolean;
}
export interface ITextModelContentProvider {
/**
* Given a resource, return the content of the resource as `ITextModel`.
*/
provideTextContent(resource: URI): Promise<ITextModel | null> | null;
}
export interface ITextEditorModel extends IResolvableEditorModel {
/**
* Emitted when the text model is about to be disposed.
*/
readonly onWillDispose: Event<void>;
/**
* Provides access to the underlying `ITextModel`.
*/
readonly textEditorModel: ITextModel | null;
/**
* Creates a snapshot of the model's contents.
*/
createSnapshot(this: IResolvedTextEditorModel): ITextSnapshot;
createSnapshot(this: ITextEditorModel): ITextSnapshot | null;
/**
* Signals if this model is readonly or not.
*/
isReadonly(): boolean | IMarkdownString;
/**
* The language id of the text model if known.
*/
getLanguageId(): string | undefined;
/**
* Find out if this text model has been disposed.
*/
isDisposed(): boolean;
}
export interface IResolvedTextEditorModel extends ITextEditorModel {
/**
* Same as ITextEditorModel#textEditorModel, but never null.
*/
readonly textEditorModel: ITextModel;
}
export function isResolvedTextEditorModel(model: ITextEditorModel): model is IResolvedTextEditorModel {
const candidate = model as IResolvedTextEditorModel;
return !!candidate.textEditorModel;
}