ILanguageClient Interface

Definition

Interface representing a language client which connects to a language sever protocol based language server.

public interface class ILanguageClient
public interface ILanguageClient
type ILanguageClient = interface
Public Interface ILanguageClient

Remarks

A normal sequence of activation for the ILanguageClient follows this pattern:

  1. Visual Studio calls OnLoadedAsync(),
  2. The extension calls and awaits InvokeAsync<TEventArgs>(AsyncEventHandler<TEventArgs>, Object, TEventArgs) on the StartAsync event before returning from OnLoadedAsync(),
  3. Visual Studio calls and awaits ActivateAsync(CancellationToken) before returning from OnLoadedAsync(),
  4. The extension starts the LSP server and returns a Connection to Visual Studio,
  5. Visual Studio starts asynchronously initializing the server using the "initialize" and "initialized" LSP messages,
  6. Visual Studio completes the StartAsync event handling,
  7. The extension completes the OnLoadedAsync() execution,
  8. Visual Studio calls the OnServerInitializedAsync() method after the "initialize" and "initialized" LSP messages are exchanged (or the OnServerInitializeFailedAsync(ILanguageClientInitializationInfo) method in case of failure).

Properties

ConfigurationSections

Gets the configuration section names for the language client. This may be null if the language client does not provide settings.

FilesToWatch

Gets the list of file names to watch for changes. Changes will be sent to the server via 'workspace/didChangeWatchedFiles' message. The files to watch must be under the current active workspace. The file names can be specified as a relative paths to the exact file, or as glob patterns following the standard in .gitignore see https://www.kernel.org/pub/software/scm/git/docs/gitignore.html files.

InitializationOptions

Gets the initialization options object the client wants to send when 'initialize' message is sent. This may be null if the client does not need custom initialization options.

Name

Gets the name of the language client (displayed to the user).

ShowNotificationOnInitializeFailed

Gets a value indicating whether a notification bubble show be shown when the language server fails to initialize.

Methods

ActivateAsync(CancellationToken)

This method is called by Visual Studio to notify the extension that the LSP server should be started.

OnLoadedAsync()

This method is called by Visual Studio to notify the extension that the language client has been loaded. The extension can start the LSP server immediately, or wait for user action to start. To start the server call and await InvokeAsync<TEventArgs>(AsyncEventHandler<TEventArgs>, Object, TEventArgs) on the StartAsync event before returning from this method.

OnServerInitializedAsync()

This method is called by Visual Studio to notify the extension that the LSP server has been initialized: LSP "initialize" and "initialized" messages have been exchanged.

OnServerInitializeFailedAsync(Exception)

Signals the extension that the language server failed to initialize.

OnServerInitializeFailedAsync(ILanguageClientInitializationInfo)

This method is called by Visual Studio to notify the extension that the initialization of the LSP server has failed.

Events

StartAsync

Async event to indicate to Visual Studio that server should be started by calling ActivateAsync(CancellationToken). If the server is already started, this event will be ignored.

StopAsync

Async event to indicate to Visual Studio that the server should be stopped by sending an LSP "shutdown" request. If the server is not started, this event will be ignored.

Applies to