vscode-languageserver
- Version 9.0.1
- Published
- 196 kB
- 1 dependency
- MIT license
Install
npm i vscode-languageserver
yarn add vscode-languageserver
pnpm add vscode-languageserver
Overview
Language server implementation for node
Index
Functions
Classes
Interfaces
Type Aliases
Namespaces
Functions
function combineClientFeatures
combineClientFeatures: <O, T>( one: ClientFeature<O>, two: ClientFeature<T>) => ClientFeature<O & T>;
function combineConsoleFeatures
combineConsoleFeatures: <O, T>( one: ConsoleFeature<O>, two: ConsoleFeature<T>) => ConsoleFeature<O & T>;
function combineFeatures
combineFeatures: < OConsole, OTracer, OTelemetry, OClient, OWindow, OWorkspace, OLanguages, ONotebooks, TConsole, TTracer, TTelemetry, TClient, TWindow, TWorkspace, TLanguages, TNotebooks>( one: Features< OConsole, OTracer, OTelemetry, OClient, OWindow, OWorkspace, OLanguages, ONotebooks >, two: Features< TConsole, TTracer, TTelemetry, TClient, TWindow, TWorkspace, TLanguages, TNotebooks >) => Features< OConsole & TConsole, OTracer & TTracer, OTelemetry & TTelemetry, OClient & TClient, OWindow & TWindow, OWorkspace & TWorkspace, OLanguages & TLanguages, ONotebooks & TNotebooks>;
function combineLanguagesFeatures
combineLanguagesFeatures: <O, T>( one: LanguagesFeature<O>, two: LanguagesFeature<T>) => LanguagesFeature<O & T>;
function combineNotebooksFeatures
combineNotebooksFeatures: <O, T>( one: NotebooksFeature<O>, two: NotebooksFeature<T>) => NotebooksFeature<O & T>;
function combineTelemetryFeatures
combineTelemetryFeatures: <O, T>( one: TelemetryFeature<O>, two: TelemetryFeature<T>) => TelemetryFeature<O & T>;
function combineTracerFeatures
combineTracerFeatures: <O, T>( one: TracerFeature<O>, two: TracerFeature<T>) => TracerFeature<O & T>;
function combineWindowFeatures
combineWindowFeatures: <O, T>( one: WindowFeature<O>, two: WindowFeature<T>) => WindowFeature<O & T>;
function combineWorkspaceFeatures
combineWorkspaceFeatures: <O, T>( one: WorkspaceFeature<O>, two: WorkspaceFeature<T>) => WorkspaceFeature<O & T>;
function createConnection
createConnection: < PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _, PNotebooks = _>( connectionFactory: (logger: Logger) => ProtocolConnection, watchDog: WatchDog, factories?: Features< PConsole, PTracer, PTelemetry, PClient, PWindow, PWorkspace, PLanguages, PNotebooks >) => _Connection< PConsole, PTracer, PTelemetry, PClient, PWindow, PWorkspace, PLanguages, PNotebooks>;
Classes
class ErrorMessageTracker
class ErrorMessageTracker {}
Helps tracking error message. Equal occurrences of the same message are only stored once. This class is for example useful if text documents are validated in a loop and equal error message should be folded into one.
constructor
constructor();
method add
add: (message: string) => void;
Add a message to the tracker.
Parameter message
The message to add.
method sendErrors
sendErrors: (connection: { window: RemoteWindow }) => void;
Send all tracked messages to the connection's window.
Parameter connection
The connection established between client and server.
class NotebookDocuments
class NotebookDocuments< T extends { uri: DocumentUri; }> {}
constructor
constructor( configurationOrTextDocuments: | TextDocumentsConfiguration<T> | TextDocuments<T>);
property cellTextDocuments
readonly cellTextDocuments: TextDocuments<T>;
property onDidChange
readonly onDidChange: Event<NotebookDocumentChangeEvent>;
property onDidClose
readonly onDidClose: Event<NotebookDocument>;
property onDidOpen
readonly onDidOpen: Event<NotebookDocument>;
property onDidSave
readonly onDidSave: Event<NotebookDocument>;
method findNotebookDocumentForCell
findNotebookDocumentForCell: ( cell: DocumentUri | NotebookCell) => NotebookDocument | undefined;
method getCellTextDocument
getCellTextDocument: (cell: NotebookCell) => T | undefined;
method getNotebookCell
getNotebookCell: (uri: DocumentUri) => NotebookCell | undefined;
method getNotebookDocument
getNotebookDocument: (uri: URI) => NotebookDocument | undefined;
method listen
listen: (connection: Connection) => Disposable;
Listens for
low level
notification on the given connection to update the notebook documents managed by this instance.Please note that the connection only provides handlers not an event model. Therefore listening on a connection will overwrite the following handlers on a connection:
onDidOpenNotebookDocument
,onDidChangeNotebookDocument
,onDidSaveNotebookDocument
, andonDidCloseNotebookDocument
.Parameter connection
The connection to listen on.
class SemanticTokensBuilder
class SemanticTokensBuilder {}
constructor
constructor();
property id
readonly id: string;
method build
build: () => SemanticTokens;
method buildEdits
buildEdits: () => SemanticTokens | SemanticTokensDelta;
method canBuildEdits
canBuildEdits: () => boolean;
method previousResult
previousResult: (id: string) => void;
method push
push: ( line: number, char: number, length: number, tokenType: number, tokenModifiers: number) => void;
class TextDocuments
class TextDocuments< T extends { uri: DocumentUri; }> {}
A manager for simple text documents. The manager requires at a minimum that the server registered for the following text document sync events in the initialize handler or via dynamic registration:
- open and close events. - change events.
Registering for save and will save events is optional.
constructor
constructor(configuration: TextDocumentsConfiguration<T>);
Create a new text document manager.
property onDidChangeContent
readonly onDidChangeContent: Event<TextDocumentChangeEvent<T>>;
An event that fires when a text document managed by this manager has been opened or the content changes.
property onDidClose
readonly onDidClose: Event<TextDocumentChangeEvent<T>>;
An event that fires when a text document managed by this manager has been closed.
property onDidOpen
readonly onDidOpen: Event<TextDocumentChangeEvent<T>>;
An event that fires when a text document managed by this manager has been opened.
property onDidSave
readonly onDidSave: Event<TextDocumentChangeEvent<T>>;
An event that fires when a text document managed by this manager has been saved.
property onWillSave
readonly onWillSave: Event<TextDocumentWillSaveEvent<T>>;
An event that fires when a text document managed by this manager will be saved.
method all
all: () => T[];
Returns all text documents managed by this instance.
all text documents.
method get
get: (uri: string) => T | undefined;
Returns the document for the given URI. Returns undefined if the document is not managed by this instance.
Parameter uri
The text document's URI to retrieve. the text document or
undefined
.
method keys
keys: () => string[];
Returns the URIs of all text documents managed by this instance.
the URI's of all text documents.
method listen
listen: (connection: TextDocumentConnection) => Disposable;
Listens for
low level
notification on the given connection to update the text documents managed by this instance.Please note that the connection only provides handlers not an event model. Therefore listening on a connection will overwrite the following handlers on a connection:
onDidOpenTextDocument
,onDidChangeTextDocument
,onDidCloseTextDocument
,onWillSaveTextDocument
,onWillSaveTextDocumentWaitUntil
andonDidSaveTextDocument
.Use the corresponding events on the TextDocuments instance instead.
Parameter connection
The connection to listen on.
method onWillSaveWaitUntil
onWillSaveWaitUntil: ( handler: RequestHandler<TextDocumentWillSaveEvent<T>, TextEdit[], void>) => void;
Sets a handler that will be called if a participant wants to provide edits during a text document save.
Interfaces
interface BulkRegistration
interface BulkRegistration {}
A bulk registration manages n single registration to be able to register for n notifications or requests using one register request.
method add
add: { <RO>(type: ProtocolNotificationType0<RO>, registerParams: RO): void; <P, RO>(type: ProtocolNotificationType<P, RO>, registerParams: RO): void; <R, PR, E, RO>( type: ProtocolRequestType0<R, PR, E, RO>, registerParams: RO ): void; <P, PR, R, E, RO>( type: ProtocolRequestType<P, PR, R, E, RO>, registerParams: RO ): void; <RO>(type: RegistrationType<RO>, registerParams: RO): void;};
Adds a single registration.
Parameter type
the notification type to register for.
Parameter registerParams
special registration parameters.
Adds a single registration.
Parameter type
the request type to register for.
Parameter registerParams
special registration parameters.
interface BulkUnregistration
interface BulkUnregistration extends Disposable {}
A
BulkUnregistration
manages n unregistrations.
method disposeSingle
disposeSingle: (arg: string | MessageSignature) => boolean;
Disposes a single registration. It will be removed from the
BulkUnregistration
.
interface Connection
interface Connection extends _Connection {}
interface Feature
interface Feature<B extends FeatureBase, P> {}
call signature
(Base: new () => B): new () => B & P;
interface FeatureBase
interface FeatureBase {}
method fillServerCapabilities
fillServerCapabilities: (capabilities: ServerCapabilities) => void;
Called to fill in the server capabilities this feature implements.
Parameter capabilities
The server capabilities to fill.
method initialize
initialize: (capabilities: ClientCapabilities) => void;
Called to initialize the remote with the given client capabilities
Parameter capabilities
The client capabilities
interface Features
interface Features< PConsole = _, PTracer = _, PTelemetry = _, PClient = _, PWindow = _, PWorkspace = _, PLanguages = _, PNotebooks = _> {}
property client
client?: ClientFeature<PClient>;
property console
console?: ConsoleFeature<PConsole>;
property languages
languages?: LanguagesFeature<PLanguages>;
property notebooks
notebooks?: NotebooksFeature<PNotebooks>;
property telemetry
telemetry?: TelemetryFeature<PTelemetry>;
property tracer
tracer?: TracerFeature<PTracer>;
property window
window?: WindowFeature<PWindow>;
property workspace
workspace?: WorkspaceFeature<PWorkspace>;
interface RemoteClient
interface RemoteClient extends FeatureBase {}
Interface to register and unregister
listeners
on the client / tools side.
property connection
connection: Connection;
The connection this remote is attached to.
method register
register: { <P, RO>( type: ProtocolNotificationType<P, RO>, registerParams?: RO ): Promise<Disposable>; <RO>( type: ProtocolNotificationType0<RO>, registerParams?: RO ): Promise<Disposable>; <P, RO>( unregisteration: BulkUnregistration, type: ProtocolNotificationType<P, RO>, registerParams?: RO ): Promise<Disposable>; <RO>( unregisteration: BulkUnregistration, type: ProtocolNotificationType0<RO>, registerParams?: RO ): Promise<Disposable>; <P, R, PR, E, RO>( type: ProtocolRequestType<P, R, PR, E, RO>, registerParams?: RO ): Promise<Disposable>; <R, PR, E, RO>( type: ProtocolRequestType0<R, PR, E, RO>, registerParams?: RO ): Promise<Disposable>; <P, R, PR, E, RO>( unregisteration: BulkUnregistration, type: ProtocolRequestType<P, R, PR, E, RO>, registerParams?: RO ): Promise<Disposable>; <R, PR, E, RO>( unregisteration: BulkUnregistration, type: ProtocolRequestType0<R, PR, E, RO>, registerParams?: RO ): Promise<Disposable>; <RO>(type: RegistrationType<RO>, registerParams?: RO): Promise<Disposable>; <RO>( unregisteration: BulkUnregistration, type: RegistrationType<RO>, registerParams?: RO ): Promise<Disposable>; (registrations: BulkRegistration): Promise<BulkUnregistration>;};
Registers a listener for the given request.
Parameter type
the request type to register for.
Parameter registerParams
special registration parameters. a
Disposable
to unregister the listener again.Registers a listener for the given request.
Parameter unregisteration
the unregistration to add a corresponding unregister action to.
Parameter type
the request type to register for.
Parameter registerParams
special registration parameters. the updated unregistration.
Registers a listener for the given registration type.
Parameter type
the registration type.
Parameter registerParams
special registration parameters. a
Disposable
to unregister the listener again.Registers a listener for the given registration type.
Parameter unregisteration
the unregistration to add a corresponding unregister action to.
Parameter type
the registration type.
Parameter registerParams
special registration parameters. the updated unregistration.
Registers a set of listeners.
Parameter registrations
the bulk registration a
Disposable
to unregister the listeners again.
interface RemoteConsole
interface RemoteConsole extends FeatureBase {}
The RemoteConsole interface contains all functions to interact with the tools / clients console or log system. Internally it used
window/logMessage
notifications.
property connection
connection: Connection;
The connection this remote is attached to.
method debug
debug: (message: string) => void;
Log a debug message.
Parameter message
The message to log.
3.18.0
method error
error: (message: string) => void;
Show an error message.
Parameter message
The message to show.
method info
info: (message: string) => void;
Show an information message.
Parameter message
The message to show.
method log
log: (message: string) => void;
Log a message.
Parameter message
The message to log.
method warn
warn: (message: string) => void;
Show a warning message.
Parameter message
The message to show.
interface RemoteTracer
interface RemoteTracer extends FeatureBase {}
Interface to log traces to the client. The events are sent to the client and the client needs to log the trace events.
property connection
connection: Connection;
The connection this remote is attached to.
method log
log: (message: string, verbose?: string) => void;
Log the given data to the trace Log
interface ResultProgressReporter
interface ResultProgressReporter<R> {}
method report
report: (data: R) => void;
interface ServerRequestHandler
interface ServerRequestHandler<P, R, PR, E> {}
call signature
( params: P, token: CancellationToken, workDoneProgress: WorkDoneProgressReporter, resultProgress?: ResultProgressReporter<PR>): HandlerResult<R, E>;
interface Telemetry
interface Telemetry extends FeatureBase {}
Interface to log telemetry events. The events are actually send to the client and the client needs to feed the event into a proper telemetry system.
property connection
connection: Connection;
The connection this remote is attached to.
method logEvent
logEvent: (data: any) => void;
Log the given data to telemetry.
Parameter data
The data to log. Must be a JSON serializable object.
interface TextDocumentChangeEvent
interface TextDocumentChangeEvent<T> {}
Event to signal changes to a text document.
property document
document: T;
The document that has changed.
interface TextDocumentsConfiguration
interface TextDocumentsConfiguration< T extends { uri: DocumentUri; }> {}
interface TextDocumentWillSaveEvent
interface TextDocumentWillSaveEvent<T> {}
Event to signal that a document will be saved.
interface WatchDog
interface WatchDog {}
property shutdownReceived
shutdownReceived: boolean;
method exit
exit: (code: number) => void;
method initialize
initialize: (params: InitializeParams) => void;
interface WorkDoneProgressReporter
interface WorkDoneProgressReporter {}
interface WorkDoneProgressServerReporter
interface WorkDoneProgressServerReporter extends WorkDoneProgressReporter {}
property token
readonly token: CancellationToken;
Type Aliases
type ClientFeature
type ClientFeature<P> = Feature<RemoteClient, P>;
type ConsoleFeature
type ConsoleFeature<P> = Feature<RemoteConsole, P>;
type Languages
type Languages = _Languages & CallHierarchy & SemanticTokensFeatureShape & LinkedEditingRangeFeatureShape & TypeHierarchyFeatureShape & InlineValueFeatureShape & InlayHintFeatureShape & DiagnosticFeatureShape & MonikerFeatureShape & FoldingRangeFeatureShape;
type LanguagesFeature
type LanguagesFeature<P> = Feature<_Languages, P>;
type Notebooks
type Notebooks = _Notebooks & NotebookSyncFeatureShape;
type NotebooksFeature
type NotebooksFeature<P> = Feature<_Notebooks, P>;
type RemoteWindow
type RemoteWindow = _RemoteWindow & WindowProgress & ShowDocumentFeatureShape;
type RemoteWorkspace
type RemoteWorkspace = _RemoteWorkspace & Configuration & WorkspaceFolders & FileOperationsFeatureShape;
type TelemetryFeature
type TelemetryFeature<P> = Feature<Telemetry, P>;
type TracerFeature
type TracerFeature<P> = Feature<RemoteTracer, P>;
type WindowFeature
type WindowFeature<P> = Feature<_RemoteWindow, P>;
type WorkspaceFeature
type WorkspaceFeature<P> = Feature<_RemoteWorkspace, P>;
Namespaces
namespace BulkRegistration
namespace BulkRegistration {}
function create
create: () => BulkRegistration;
Creates a new bulk registration. an empty bulk registration.
namespace BulkUnregistration
namespace BulkUnregistration {}
function create
create: () => BulkUnregistration;
namespace ProposedFeatures
namespace ProposedFeatures {}
variable all
const all: Features<_, _, _, _, _, _, ic.InlineCompletionFeatureShape, _>;
type Connection
type Connection = _Connection<_, _, _, _, _, _, ic.InlineCompletionFeatureShape, _>;
Package Files (6)
Dependencies (1)
Dev Dependencies (1)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/vscode-languageserver
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/vscode-languageserver)
- HTML<a href="https://www.jsdocs.io/package/vscode-languageserver"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3525 ms. - Missing or incorrect documentation? Open an issue for this package.