/****************************************************************************** * Copyright 2023 TypeFox GmbH * This program and the accompanying materials are made available under the * terms of the MIT License, which is available in the project root. ******************************************************************************/ import type { LangiumDocument, MaybePromise } from 'langium'; import type { Position } from 'vscode-languageserver'; import type { DocumentHighlight, DocumentHighlightParams } from 'vscode-languageserver'; import type { LangiumSprottyServices } from './sprotty-services.js'; import { DefaultDocumentHighlightProvider } from 'langium/lsp'; /** * This service provides access to the user's current cursor position. */ export interface PositionTracker { firePositionChanged(document: LangiumDocument, position: Position): void; onPositionChanged(listener: PositionChangeListener): void; removePositionChangeListener(listener: PositionChangeListener): void; getOffset(document: LangiumDocument): number | undefined; } export type PositionChangeListener = (document: LangiumDocument, position: Position) => void; export declare class DefaultPositionTracker { protected readonly positionMap: Map; protected readonly positionChangeListeners: PositionChangeListener[]; constructor(services: LangiumSprottyServices); firePositionChanged(document: LangiumDocument, position: Position): void; onPositionChanged(listener: PositionChangeListener): void; removePositionChangeListener(listener: PositionChangeListener): void; getOffset(document: LangiumDocument): number | undefined; } /** * Exploit the client's document highlight requests to track cursor positions. * Known limitation: document highlight requests are not sent when the cursor is surrounded by whitespace. */ export declare class TrackingDocumentHighlightProvider extends DefaultDocumentHighlightProvider { private readonly positionTracker; constructor(services: LangiumSprottyServices); getDocumentHighlight(document: LangiumDocument, params: DocumentHighlightParams): MaybePromise; } //# sourceMappingURL=position-tracker.d.ts.map