atom-languageclient
- Version 1.16.1
- Published
- 1.08 MB
- 7 dependencies
- MIT license
Install
npm i atom-languageclient
yarn add atom-languageclient
pnpm add atom-languageclient
Overview
Integrate Language Servers with Atom
Index
Functions
Classes
AutoLanguageClient
- activate()
- autoComplete
- busySignalService
- callHierarchy
- consumeBusySignal()
- consumeConsole()
- consumeDatatip()
- consumeLinterV2()
- consumeSignatureHelp()
- datatip
- deactivate()
- definitions
- determineProjectPath()
- filterChangeWatchedFiles()
- filterCodeActions()
- findReferences
- getAutocompleteDisabledScopes()
- getCodeActions()
- getCodeFormat()
- getCodeHighlight()
- getConnectionForEditor()
- getConnectionType()
- getDatatip()
- getDefinition()
- getFileCodeFormat()
- getGrammarScopes()
- getIncomingCallHierarchy()
- getInitializeParams()
- getLanguageIdFromEditor()
- getLanguageName()
- getLogger()
- getOnTypeCodeFormat()
- getOutgoingCallHierarchy()
- getOutline()
- getRangeCodeFormat()
- getReferences()
- getRename()
- getRootConfigurationKey()
- getServerName()
- getSuggestionDetailsOnSelect()
- getSuggestions()
- handleServerStderr()
- isFileInProject()
- logger
- mapConfigurationObject()
- name
- onApplyCodeActions()
- onDidConvertAutocomplete()
- onDidInsertSuggestion()
- onSpawnClose()
- onSpawnDisconnect()
- onSpawnError()
- onSpawnExit()
- onSpawnStdErrData()
- outlineView
- postInitialization()
- preInitialization()
- processStdErr
- provideAutocomplete()
- provideCallHierarchy()
- provideCodeActions()
- provideCodeFormat()
- provideCodeHighlight()
- provideDefinitions()
- provideFileCodeFormat()
- provideFindReferences()
- provideOnSaveCodeFormat()
- provideOnTypeCodeFormat()
- provideOutlines()
- provideRangeCodeFormat()
- provideRefactor()
- reportBusyWhile
- reportBusyWhileDefault
- restartAllServers()
- shouldStartForEditor()
- shouldSyncForEditor()
- shutdownGracefully
- socket
- spawn()
- spawnChildNode()
- startServerProcess()
Convert
- atomFileEventToLSFileEvents()
- atomIdeDiagnosticToLSDiagnostic()
- atomRangeToLSRange()
- convertLsTextEdit()
- convertLsTextEdits()
- diagnosticTypeToLSSeverity()
- editorToTextDocumentIdentifier()
- editorToTextDocumentPositionParams()
- encodeHTMLAttribute()
- grammarScopesToTextEditorScopes()
- lsRangeToAtomRange()
- pathToUri()
- pointToPosition()
- positionToPoint()
- uriToPath()
LanguageClientConnection
- callHierarchyIncomingCalls()
- callHierarchyOutgoingCalls()
- codeAction()
- codeActionResolve()
- codeLens()
- codeLensResolve()
- completion()
- completionItemResolve()
- didChangeConfiguration()
- didChangeTextDocument()
- didChangeWatchedFiles()
- didChangeWorkspaceFolders()
- didCloseTextDocument()
- didOpenTextDocument()
- didSaveTextDocument()
- dispose()
- documentFormatting()
- documentHighlight()
- documentLink()
- documentLinkResolve()
- documentOnTypeFormatting()
- documentRangeFormatting()
- documentSymbol()
- executeCommand()
- exit()
- findReferences()
- gotoDefinition()
- hover()
- initialize()
- initialized()
- isConnected
- onApplyEdit()
- onCustom()
- onCustomNotification()
- onCustomRequest()
- onLogMessage()
- onPublishDiagnostics()
- onShowDocument()
- onShowMessage()
- onShowMessageRequest()
- onTelemetryEvent()
- onWorkspaceFolders()
- prepareCallHierarchy()
- rename()
- sendCustomNotification()
- sendCustomRequest()
- shutdown()
- signatureHelp()
- willSaveTextDocument()
- willSaveWaitUntilTextDocument()
- workspaceSymbol()
Interfaces
Type Aliases
Namespaces
Functions
function DownloadFile
DownloadFile: ( sourceUrl: string, targetFile: string, progressCallback?: ByteProgressCallback | undefined, length?: number | undefined) => Promise<void>;
function getExePath
getExePath: ( exeName: string, rootPath?: string, exeExtention?: string) => string;
Finds an exe file in the package assuming it is placed under
rootPath/platform-arch/exe
. If the exe file did not exist, the given name is returned. For example on Windows x64, if theexeName
isserve-d
, it returns the absolute path to./bin/win32-x64/exeName.exe
, and if the file did not exist,serve-d
is returned.Parameter exeName
Name of the exe file
Parameter rootPath
The path of the folder of the exe file. Defaults to 'join("bin",
${process.platform}-${process.arch}
)'Parameter exeExtention
The extention of the exe file. Defaults to
process.platform === "win32" ? ".exe" : ""
Classes
class AutoLanguageClient
class AutoLanguageClient {}
Public: AutoLanguageClient provides a simple way to have all the supported Atom-IDE services wired up entirely for you by just subclassing it and implementing at least
-
startServerProcess
-getGrammarScopes
-getLanguageName
-getServerName
property autoComplete
protected autoComplete?: AutocompleteAdapter;
property busySignalService
protected busySignalService?: atomIde.BusySignalService;
Available if consumeBusySignal is setup
property callHierarchy
protected callHierarchy?: typeof CallHierarchyAdapter;
property datatip
protected datatip?: DatatipAdapter;
property definitions
protected definitions?: DefinitionAdapter;
property findReferences
protected findReferences?: FindReferencesAdapter;
property logger
protected logger: Logger;
property name
protected name: string;
property outlineView
protected outlineView?: OutlineViewAdapter;
property processStdErr
protected processStdErr: string;
property reportBusyWhile
protected reportBusyWhile: Utils.ReportBusyWhile;
property reportBusyWhileDefault
protected reportBusyWhileDefault: Utils.ReportBusyWhile;
property shutdownGracefully
protected shutdownGracefully: boolean;
If this is set to
true
(the default value), the servers will shut down gracefully. If it is set tofalse
, the servers will be killed without awaiting shutdown response.
property socket
protected socket: Socket;
method activate
activate: () => void;
Activate does very little for perf reasons - hooks in via ServerManager for later 'activation'
method consumeBusySignal
consumeBusySignal: (service: atomIde.BusySignalService) => Disposable;
method consumeConsole
consumeConsole: (createConsole: atomIde.ConsoleService) => Disposable;
method consumeDatatip
consumeDatatip: (service: atomIde.DatatipService) => void;
method consumeLinterV2
consumeLinterV2: ( registerIndie: (params: { name: string }) => linter.IndieDelegate) => void;
method consumeSignatureHelp
consumeSignatureHelp: (registry: atomIde.SignatureHelpRegistry) => Disposable;
method deactivate
deactivate: () => Promise<any>;
Deactivate disposes the resources we're using
method determineProjectPath
protected determineProjectPath: (textEditor: TextEditor) => string | null;
(Optional) Finds the project path. If there is a custom logic for finding projects override this method.
method filterChangeWatchedFiles
protected filterChangeWatchedFiles: (_filePath: string) => boolean;
didChangeWatchedFiles
message filtering, override for custom logic.Parameter filePath
Path of a file that has changed in the project path
Returns
false
=> message will not be sent to the language server
method filterCodeActions
protected filterCodeActions: ( actions: (ls.Command | ls.CodeAction)[] | null) => (ls.Command | ls.CodeAction)[] | null;
Optionally filter code action before they're displayed
method getAutocompleteDisabledScopes
protected getAutocompleteDisabledScopes: () => Array<string>;
A method to override to return an array of grammar scopes that should not be used for autocompletion.
Usually that's used for disabling autocomplete inside comments,
Example 1
If the grammar scopes are [ '.source.js' ],
getAutocompleteDisabledScopes
may return [ '.source.js .comment' ].
method getCodeActions
protected getCodeActions: ( editor: TextEditor, range: Range, diagnostics: atomIde.Diagnostic[]) => Promise<atomIde.CodeAction[] | null>;
method getCodeFormat
protected getCodeFormat: ( editor: TextEditor, range: Range) => Promise<atomIde.TextEdit[]>;
method getCodeHighlight
protected getCodeHighlight: ( editor: TextEditor, position: Point) => Promise<Range[] | null>;
method getConnectionForEditor
protected getConnectionForEditor: ( editor: TextEditor) => Promise<LanguageClientConnection | null>;
Gets a LanguageClientConnection for a given TextEditor
method getConnectionType
protected getConnectionType: () => ConnectionType;
(Optional) Determine whether to use ipc, stdio or socket to connect to the server
method getDatatip
protected getDatatip: ( editor: TextEditor, point: Point) => Promise<atomIde.Datatip | null>;
method getDefinition
protected getDefinition: ( editor: TextEditor, point: Point) => Promise<atomIde.DefinitionQueryResult | null>;
method getFileCodeFormat
protected getFileCodeFormat: (editor: TextEditor) => Promise<atomIde.TextEdit[]>;
method getGrammarScopes
protected getGrammarScopes: () => string[];
Return an array of the grammar scopes you handle, e.g. [ 'source.js' ]
method getIncomingCallHierarchy
protected getIncomingCallHierarchy: ( editor: TextEditor, point: Point) => Promise<atomIde.CallHierarchy<'incoming'> | null>;
method getInitializeParams
protected getInitializeParams: ( projectPath: string, lsProcess: LanguageServerProcess) => ls.InitializeParams;
(Optional) Return the parameters used to initialize a client - you may want to extend capabilities
method getLanguageIdFromEditor
protected getLanguageIdFromEditor: (editor: TextEditor) => string;
(Optional) Determines the
languageId
string used fortextDocument/didOpen
notification. The default is to use the grammar name.You can override this like this:
class MyLanguageClient extends AutoLanguageClient { getLanguageIdFromEditor(editor: TextEditor) { if (editor.getGrammar().scopeName === "source.myLanguage") { return "myCustumLanguageId" } return super.getLanguageIdFromEditor(editor) } }
Parameter editor
A {TextEditor} which is opened.
Returns
A {string} of
languageId
used fortextDocument/didOpen
notification.
method getLanguageName
protected getLanguageName: () => string;
Return the name of the language you support, e.g. 'JavaScript'
method getLogger
protected getLogger: () => Logger;
LSP logging is only set for warnings & errors by default unless you turn on the core.debugLSP setting
method getOnTypeCodeFormat
protected getOnTypeCodeFormat: ( editor: TextEditor, point: Point, character: string) => Promise<atomIde.TextEdit[]>;
method getOutgoingCallHierarchy
protected getOutgoingCallHierarchy: ( editor: TextEditor, point: Point) => Promise<atomIde.CallHierarchy<'outgoing'> | null>;
method getOutline
protected getOutline: (editor: TextEditor) => Promise<atomIde.Outline | null>;
method getRangeCodeFormat
protected getRangeCodeFormat: ( editor: TextEditor, range: Range) => Promise<atomIde.TextEdit[]>;
method getReferences
protected getReferences: ( editor: TextEditor, point: Point) => Promise<atomIde.FindReferencesReturn | null>;
method getRename
protected getRename: ( editor: TextEditor, position: Point, newName: string) => Promise<Map<string, atomIde.TextEdit[]> | null>;
method getRootConfigurationKey
protected getRootConfigurationKey: () => string;
(Optional) Return the name of your root configuration key
method getServerName
protected getServerName: () => string;
Return the name of your server, e.g. 'Eclipse JDT'
method getSuggestionDetailsOnSelect
protected getSuggestionDetailsOnSelect: ( suggestion: ac.AnySuggestion) => Promise<ac.AnySuggestion | null>;
method getSuggestions
protected getSuggestions: ( request: ac.SuggestionsRequestedEvent) => Promise<ac.AnySuggestion[]>;
method handleServerStderr
protected handleServerStderr: (stderr: string, _projectPath: string) => void;
Called on language server stderr output.
Parameter stderr
A chunk of stderr from a language server instance
method isFileInProject
protected isFileInProject: (editor: TextEditor, projectPath: string) => boolean;
method mapConfigurationObject
protected mapConfigurationObject: (configuration: any) => any;
(Optional) Transform the configuration object before it is sent to the server
method onApplyCodeActions
protected onApplyCodeActions: ( _action: ls.Command | ls.CodeAction) => Promise<boolean>;
Optionally handle a code action before default handling. Return
false
to prevent default handling,true
to continue with default handling.
method onDidConvertAutocomplete
protected onDidConvertAutocomplete: ( _completionItem: ls.CompletionItem, _suggestion: ac.AnySuggestion, _request: ac.SuggestionsRequestedEvent) => void;
method onDidInsertSuggestion
protected onDidInsertSuggestion: (_arg: ac.SuggestionInsertedEvent) => void;
method onSpawnClose
protected onSpawnClose: ( code: number | null, signal: NodeJS.Signals | null) => void;
The function called whenever the spawned server
close
s. Extend (call super.onSpawnClose) or override this if you need custom close handling
method onSpawnDisconnect
protected onSpawnDisconnect: () => void;
The function called whenever the spawned server
disconnect
s. Extend (call super.onSpawnDisconnect) or override this if you need custom disconnect handling
method onSpawnError
protected onSpawnError: (err: Error) => void;
The function called whenever the spawned server
error
s. Extend (call super.onSpawnError) or override this if you need custom error handling
method onSpawnExit
protected onSpawnExit: ( code: number | null, signal: NodeJS.Signals | null) => void;
The function called whenever the spawned server
exit
s. Extend (call super.onSpawnExit) or override this if you need custom exit handling
method onSpawnStdErrData
protected onSpawnStdErrData: (chunk: Buffer, projectPath: string) => void;
The function called whenever the spawned server returns
data
instderr
Extend (call super.onSpawnStdErrData) or override this if you need custom stderr data handling
method postInitialization
protected postInitialization: (_server: ActiveServer) => void;
(Optional) Late wire-up of listeners after initialize method has been sent
method preInitialization
protected preInitialization: (_connection: LanguageClientConnection) => void;
(Optional) Early wire-up of listeners before initialize method is sent
method provideAutocomplete
provideAutocomplete: () => ac.AutocompleteProvider;
method provideCallHierarchy
provideCallHierarchy: () => atomIde.CallHierarchyProvider;
method provideCodeActions
provideCodeActions: () => atomIde.CodeActionProvider;
method provideCodeFormat
provideCodeFormat: () => atomIde.RangeCodeFormatProvider;
method provideCodeHighlight
provideCodeHighlight: () => atomIde.CodeHighlightProvider;
method provideDefinitions
provideDefinitions: () => atomIde.DefinitionProvider;
method provideFileCodeFormat
provideFileCodeFormat: () => atomIde.FileCodeFormatProvider;
method provideFindReferences
provideFindReferences: () => atomIde.FindReferencesProvider;
method provideOnSaveCodeFormat
provideOnSaveCodeFormat: () => atomIde.OnSaveCodeFormatProvider;
method provideOnTypeCodeFormat
provideOnTypeCodeFormat: () => atomIde.OnTypeCodeFormatProvider;
method provideOutlines
provideOutlines: () => atomIde.OutlineProvider;
method provideRangeCodeFormat
provideRangeCodeFormat: () => atomIde.RangeCodeFormatProvider;
method provideRefactor
provideRefactor: () => atomIde.RefactorProvider;
method restartAllServers
protected restartAllServers: () => Promise<void>;
Restart all active language servers for this language client in the workspace
method shouldStartForEditor
protected shouldStartForEditor: (editor: TextEditor) => boolean;
(Optional) Determine whether we should start a server for a given editor if we don't have one yet
method shouldSyncForEditor
shouldSyncForEditor: (editor: TextEditor, projectPath: string) => boolean;
method spawn
protected spawn: ( exe: string, args?: string[], options?: cp.SpawnOptions, rootPath?: string, exeExtention?: string) => LanguageServerProcess;
Spawn a general language server. Use this inside the
startServerProcess
override if the language server is a general executable. Also see thespawnChildNode
method. If the name is provided as the first argument, it checksbin/platform-arch/exeName
by default, and if doesn't exists uses the exe on PATH. For example on Windows x64, by passingserve-d
,bin/win32-x64/exeName.exe
is spawned by default.Parameter exe
The
name
orpath
of the executableParameter args
Args passed to spawn the exe. Defaults to
[]
.Parameter options
: Child process spawn options. Defaults to
{}
.Parameter rootPath
The path of the folder of the exe file. Defaults to
join("bin",
${process.platform}-${process.arch})
.Parameter exeExtention
The extention of the exe file. Defaults to
process.platform === "win32" ? ".exe" : ""
method spawnChildNode
protected spawnChildNode: ( args: string[], options?: cp.SpawnOptions) => LanguageServerProcess;
Spawn a language server using Atom's Nodejs process Use this inside the
startServerProcess
override if the language server is a JavaScript file. Also see thespawn
method
method startServerProcess
protected startServerProcess: ( _projectPath: string) => LanguageServerProcess | Promise<LanguageServerProcess>;
Start your server process
class CommandExecutionAdapter
class CommandExecutionAdapter {}
method canAdapt
static canAdapt: (serverCapabilities: ServerCapabilities) => boolean;
method executeCommand
static executeCommand: ( connection: LanguageClientConnection, command: string, commandArgs?: any[]) => Promise<any | void>;
Returns a {Promise}
method registerCustomCallbackForCommand
static registerCustomCallbackForCommand: ( command: string, callback: CommandCustomCallbackFunction) => void;
class ConsoleLogger
class ConsoleLogger {}
constructor
constructor(prefix: string);
property prefix
prefix: string;
method debug
debug: (...args: any[]) => void;
method error
error: (...args: any[]) => void;
method format
format: (args_: any) => any;
method info
info: (...args: any[]) => void;
method log
log: (...args: any[]) => void;
method warn
warn: (...args: any[]) => void;
class Convert
class Convert {}
Public: Class that contains a number of helper methods for general conversions between the language server protocol and Atom/Atom packages.
method atomFileEventToLSFileEvents
static atomFileEventToLSFileEvents: ( fileEvent: FilesystemChange) => ls.FileEvent[];
Public: Convert an Atom File Event as received from atom.project.onDidChangeFiles and convert it into an Array of Language Server Protocol {FileEvent} objects. Normally this will be a 1-to-1 but renames will be represented by a deletion and a subsequent creation as LSP does not know about renames.
Parameter fileEvent
An {atom$ProjectFileEvent} to be converted.
Returns
An array of LSP {ls.FileEvent} objects that equivalent conversions to the fileEvent parameter.
method atomIdeDiagnosticToLSDiagnostic
static atomIdeDiagnosticToLSDiagnostic: ( diagnostic: atomIde.Diagnostic) => ls.Diagnostic;
Deprecated
Use Linter V2 service
method atomRangeToLSRange
static atomRangeToLSRange: (range: Range) => ls.Range;
Public: Convert an Atom {Range} into an language server {Range}.
Parameter range
An Atom {Range} to convert from.
Returns
The language server {Range} representation of the given Atom {Range}.
method convertLsTextEdit
static convertLsTextEdit: (textEdit: ls.TextEdit) => atomIde.TextEdit;
Public: Convert a language server protocol {atomIde.TextEdit} object to the Atom equivalent {atomIde.TextEdit}.
Parameter textEdits
The language server protocol {atomIde.TextEdit} objects to convert.
Returns
An Atom {atomIde.TextEdit} object.
method convertLsTextEdits
static convertLsTextEdits: ( textEdits?: ls.TextEdit[] | null) => atomIde.TextEdit[];
Public: Convert an array of language server protocol {atomIde.TextEdit} objects to an equivalent array of Atom {atomIde.TextEdit} objects.
Parameter textEdits
The language server protocol {atomIde.TextEdit} objects to convert.
Returns
An {Array} of Atom {atomIde.TextEdit} objects.
method diagnosticTypeToLSSeverity
static diagnosticTypeToLSSeverity: ( type: atomIde.DiagnosticType) => ls.DiagnosticSeverity;
Deprecated
Use Linter V2 service
method editorToTextDocumentIdentifier
static editorToTextDocumentIdentifier: ( editor: TextEditor) => ls.TextDocumentIdentifier;
Public: Create a {TextDocumentIdentifier} from an Atom {TextEditor}.
Parameter editor
A {TextEditor} that will be used to form the uri property.
Returns
A {TextDocumentIdentifier} that has a
uri
property with the Uri for the given editor's path.
method editorToTextDocumentPositionParams
static editorToTextDocumentPositionParams: ( editor: TextEditor, point?: Point) => ls.TextDocumentPositionParams;
Public: Create a {TextDocumentPositionParams} from a {TextEditor} and optional {Point}.
Parameter editor
A {TextEditor} that will be used to form the uri property.
Parameter point
An optional {Point} that will supply the position property. If not specified the current cursor position will be used.
Returns
A {TextDocumentPositionParams} that has textDocument property with the editors {TextDocumentIdentifier} and a position property with the supplied point (or current cursor position when not specified).
method encodeHTMLAttribute
static encodeHTMLAttribute: (s: string) => string;
Public: Encode a string so that it can be safely used within a HTML attribute - i.e. replacing all quoted values with their HTML entity encoded versions. e.g.
Hello"
becomesHello"
Parameter s
A string to be encoded.
Returns
A string that is HTML attribute encoded by replacing &, <, >, " and ' with their HTML entity named equivalents.
method grammarScopesToTextEditorScopes
static grammarScopesToTextEditorScopes: (grammarScopes: string[]) => string;
Public: Create a string of scopes for the atom text editor using the data-grammar selector from an {Array} of grammarScope strings.
Parameter grammarScopes
An {Array} of grammar scope string to convert from.
Returns
A single comma-separated list of CSS selectors targetting the grammars of Atom text editors. e.g. `['c', 'cpp']
=>
'atom-text-editor[data-grammar='c'], atom-text-editor[data-grammar='cpp']`
method lsRangeToAtomRange
static lsRangeToAtomRange: (range: ls.Range) => Range;
Public: Convert a language server {Range} into an Atom {Range}.
Parameter range
A language server {Range} to convert from.
Returns
The Atom {Range} representation of the given language server {Range}.
method pathToUri
static pathToUri: (filePath: string) => string;
Public: Convert a path to a Uri.
Parameter filePath
A file path to convert to a Uri.
Returns
The Uri corresponding to the path. e.g. file:///a/b/c.txt
method pointToPosition
static pointToPosition: (point: Point) => ls.Position;
Public: Convert an Atom {Point} to a language server {Position}.
Parameter point
An Atom {Point} to convert from.
Returns
The {Position} representation of the Atom {PointObject}.
method positionToPoint
static positionToPoint: (position: ls.Position) => Point;
Public: Convert a language server {Position} into an Atom {PointObject}.
Parameter position
A language server {Position} to convert from.
Returns
The Atom {PointObject} representation of the given {Position}.
method uriToPath
static uriToPath: (uri: string) => string;
Public: Convert a Uri to a path.
Parameter uri
A Uri to convert to a file path.
Returns
A file path corresponding to the Uri. e.g. /a/b/c.txt If the Uri does not begin file: then it is returned as-is to allow Atom to deal with http/https sources in the future.
class FilteredLogger
class FilteredLogger {}
constructor
constructor(logger: Logger, predicate?: (level: string, args: any[]) => boolean);
property DeveloperLevelFilter
static DeveloperLevelFilter: (_level: string, _args: any[]) => true;
property UserLevelFilter
static UserLevelFilter: (level: string, _args: any[]) => boolean;
method debug
debug: (...args: any[]) => void;
method error
error: (...args: any[]) => void;
method info
info: (...args: any[]) => void;
method log
log: (...args: any[]) => void;
method warn
warn: (...args: any[]) => void;
class LanguageClientConnection
class LanguageClientConnection extends EventEmitter {}
TypeScript wrapper around JSONRPC to implement Microsoft Language Server Protocol v3 https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
constructor
constructor(rpc: jsonrpc.MessageConnection, logger?: Logger);
property isConnected
isConnected: boolean;
method callHierarchyIncomingCalls
callHierarchyIncomingCalls: ( params: lsp.CallHierarchyIncomingCallsParams, _cancellationToken?: jsonrpc.CancellationToken) => Promise<lsp.CallHierarchyIncomingCall[] | null>;
Public: Send a
callHierarchy/incomingCalls
request.Parameter params
The {CallHierarchyIncomingCallsParams} that identifies {CallHierarchyItem} to get incoming calls.
Parameter cancellationToken
The {CancellationToken} that is used to cancel this request if necessary.
Returns
A {Promise} containing an {Array} of {CallHierarchyIncomingCall}s for the function that called by the function given to the parameter.
method callHierarchyOutgoingCalls
callHierarchyOutgoingCalls: ( params: lsp.CallHierarchyOutgoingCallsParams, _cancellationToken?: jsonrpc.CancellationToken) => Promise<lsp.CallHierarchyOutgoingCall[] | null>;
Public: Send a
callHierarchy/outgoingCalls
request.Parameter params
The {CallHierarchyOutgoingCallsParams} that identifies {CallHierarchyItem} to get outgoing calls.
Parameter cancellationToken
The {CancellationToken} that is used to cancel this request if necessary.
Returns
A {Promise} containing an {Array} of {CallHierarchyIncomingCall}s for the function that calls the function given to the parameter.
method codeAction
codeAction: ( params: lsp.CodeActionParams) => Promise<Array<lsp.Command | lsp.CodeAction> | null>;
Public: Send a
textDocument/codeAction
request.Parameter params
The {CodeActionParams} identifying the document, range and context for the code action.
Returns
A {Promise} containing an {Array} of {Command}s or {CodeAction}s that can be performed against the given documents range.
method codeActionResolve
codeActionResolve: (params: lsp.CodeAction) => Promise<lsp.CodeAction>;
Public: Send a
codeAction/resolve
request.Parameter params
The {CodeAction} whose properties (e.g.
edit
) are to be resolved.Returns
A resolved {CodeAction} that can be applied immediately.
method codeLens
codeLens: (params: lsp.CodeLensParams) => Promise<lsp.CodeLens[] | null>;
Public: Send a
textDocument/codeLens
request.Parameter params
The {CodeLensParams} identifying the document for which code lens commands are desired.
Returns
A {Promise} containing an {Array} of {CodeLens}s that associate commands and data with specified ranges within the document.
method codeLensResolve
codeLensResolve: (params: lsp.CodeLens) => Promise<lsp.CodeLens>;
Public: Send a
codeLens/resolve
request.Parameter params
The {CodeLens} identifying the code lens to be resolved with full detail.
Returns
A {Promise} containing the {CodeLens} fully resolved.
method completion
completion: ( params: lsp.TextDocumentPositionParams | CompletionParams, cancellationToken?: jsonrpc.CancellationToken) => Promise<lsp.CompletionItem[] | lsp.CompletionList | null>;
Public: Send a
textDocument/completion
request.Parameter params
The {TextDocumentPositionParams} or {CompletionParams} for which {CompletionItem}s are desired.
Parameter cancellationToken
The {CancellationToken} that is used to cancel this request if necessary.
Returns
A {Promise} containing either a {CompletionList} or an {Array} of {CompletionItem}s.
method completionItemResolve
completionItemResolve: ( params: lsp.CompletionItem) => Promise<lsp.CompletionItem>;
Public: Send a
completionItem/resolve
request.Parameter params
The {CompletionItem} for which a fully resolved {CompletionItem} is desired.
Returns
A {Promise} containing a fully resolved {CompletionItem}.
method didChangeConfiguration
didChangeConfiguration: (params: lsp.DidChangeConfigurationParams) => void;
Public: Send a
workspace/didChangeConfiguration
notification.Parameter params
The {DidChangeConfigurationParams} containing the new configuration.
method didChangeTextDocument
didChangeTextDocument: (params: lsp.DidChangeTextDocumentParams) => void;
Public: Send a
textDocument/didChange
notification.Parameter params
The {DidChangeTextDocumentParams} containing the changed text document details including the version number and actual text changes.
method didChangeWatchedFiles
didChangeWatchedFiles: (params: lsp.DidChangeWatchedFilesParams) => void;
Public: Send a
workspace/didChangeWatchedFiles
notification.Parameter params
The {DidChangeWatchedFilesParams} containing the array of {FileEvent}s that have been observed upon the watched files.
method didChangeWorkspaceFolders
didChangeWorkspaceFolders: (params: lsp.DidChangeWorkspaceFoldersParams) => void;
Public: Send a
workspace/didChangeWorkspaceFolders
notification.Parameter params
An object that contains the actual workspace folder change event ({WorkspaceFoldersChangeEvent}) in its {event} property
method didCloseTextDocument
didCloseTextDocument: (params: lsp.DidCloseTextDocumentParams) => void;
Public: Send a
textDocument/didClose
notification.Parameter params
The {DidCloseTextDocumentParams} containing the opened text document details.
method didOpenTextDocument
didOpenTextDocument: (params: lsp.DidOpenTextDocumentParams) => void;
Public: Send a
textDocument/didOpen
notification.Parameter params
The {DidOpenTextDocumentParams} containing the opened text document details.
method didSaveTextDocument
didSaveTextDocument: (params: lsp.DidSaveTextDocumentParams) => void;
Public: Send a
textDocument/didSave
notification.Parameter params
The {DidSaveTextDocumentParams} containing the saved text document details.
method dispose
dispose: () => void;
method documentFormatting
documentFormatting: ( params: lsp.DocumentFormattingParams) => Promise<lsp.TextEdit[] | null>;
Public: Send a
textDocument/formatting
request.Parameter params
The {DocumentFormattingParams} identifying the document to be formatted as well as additional formatting preferences.
Returns
A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
method documentHighlight
documentHighlight: ( params: lsp.TextDocumentPositionParams) => Promise<lsp.DocumentHighlight[] | null>;
Public: Send a
textDocument/documentHighlight
request.Parameter params
The {TextDocumentPositionParams} of a symbol for which all highlights are desired.
Returns
A {Promise} containing an {Array} of {DocumentHighlight}s that can be used to highlight this symbol.
method documentLink
documentLink: ( params: lsp.DocumentLinkParams) => Promise<lsp.DocumentLink[] | null>;
Public: Send a
textDocument/documentLink
request.Parameter params
The {DocumentLinkParams} identifying the document for which links should be identified.
Returns
A {Promise} containing an {Array} of {DocumentLink}s relating uri's to specific ranges within the document.
method documentLinkResolve
documentLinkResolve: (params: lsp.DocumentLink) => Promise<lsp.DocumentLink>;
Public: Send a
documentLink/resolve
request.Parameter params
The {DocumentLink} identifying the document link to be resolved with full detail.
Returns
A {Promise} containing the {DocumentLink} fully resolved.
method documentOnTypeFormatting
documentOnTypeFormatting: ( params: lsp.DocumentOnTypeFormattingParams) => Promise<lsp.TextEdit[] | null>;
Public: Send a
textDocument/onTypeFormatting
request.Parameter params
The {DocumentOnTypeFormattingParams} identifying the document to be formatted, the character that was typed and at what position as well as additional formatting preferences.
Returns
A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
method documentRangeFormatting
documentRangeFormatting: ( params: lsp.DocumentRangeFormattingParams) => Promise<lsp.TextEdit[] | null>;
Public: Send a
textDocument/rangeFormatting
request.Parameter params
The {DocumentRangeFormattingParams} identifying the document and range to be formatted as well as additional formatting preferences.
Returns
A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
method documentSymbol
documentSymbol: ( params: lsp.DocumentSymbolParams, _cancellationToken?: jsonrpc.CancellationToken) => Promise<lsp.SymbolInformation[] | lsp.DocumentSymbol[] | null>;
Public: Send a
textDocument/documentSymbol
request.Parameter params
The {DocumentSymbolParams} that identifies the document for which symbols are desired.
Parameter cancellationToken
The {CancellationToken} that is used to cancel this request if necessary.
Returns
A {Promise} containing an {Array} of {SymbolInformation}s that can be used to navigate this document.
method executeCommand
executeCommand: (params: lsp.ExecuteCommandParams) => Promise<any>;
Public: Send a
workspace/executeCommand
request.Parameter params
The {ExecuteCommandParams} specifying the command and arguments the language server should execute (these commands are usually from {CodeLens} or {CodeAction} responses).
Returns
A {Promise} containing anything.
method exit
exit: () => void;
Public: Send an
exit
notification to the language server.
method findReferences
findReferences: (params: lsp.ReferenceParams) => Promise<lsp.Location[] | null>;
Public: Send a
textDocument/references
request.Parameter params
The {TextDocumentPositionParams} of a symbol for which all referring {Location}s are desired.
Returns
A {Promise} containing an {Array} of {Location}s that reference this symbol.
method gotoDefinition
gotoDefinition: ( params: lsp.TextDocumentPositionParams) => Promise<lsp.Location | lsp.Location[] | lsp.LocationLink[] | null>;
Public: Send a
textDocument/definition
request.Parameter params
The {TextDocumentPositionParams} of a symbol for which one or more {Location}s that define that symbol are required.
Returns
A {Promise} containing either a single {Location} or an {Array} of many {Location}s.
method hover
hover: (params: lsp.TextDocumentPositionParams) => Promise<lsp.Hover | null>;
Public: Send a
textDocument/hover
request.Parameter params
The {TextDocumentPositionParams} for which a {Hover} is desired.
Returns
A {Promise} containing a {Hover}.
method initialize
initialize: (params: lsp.InitializeParams) => Promise<lsp.InitializeResult>;
Public: Initialize the language server with necessary {InitializeParams}.
Parameter params
The {InitializeParams} containing processId, rootPath, options and server capabilities.
Returns
A {Promise} containing the {InitializeResult} with details of the server's capabilities.
method initialized
initialized: () => void;
Public: Send an
initialized
notification to the language server.
method onApplyEdit
onApplyEdit: ( callback: ( params: lsp.ApplyWorkspaceEditParams ) => Promise<lsp.ApplyWorkspaceEditResponse>) => void;
Public: Register a callback for the
workspace/applyEdit
message.Parameter callback
The function to be called when the
workspace/applyEdit
message is received with {ApplyWorkspaceEditParams} being passed.Returns
A {Promise} containing the {ApplyWorkspaceEditResponse}.
method onCustom
onCustom: (method: string, callback: (obj: object) => void) => void;
Deprecated
Use
onCustomNotification
method instead
method onCustomNotification
onCustomNotification: (method: string, callback: (obj: object) => void) => void;
Public: Register a callback for a custom notification
Parameter method
A string containing the name of the message to listen for.
Parameter callback
The function to be called when the message is received. The payload from the message is passed to the function.
method onCustomRequest
onCustomRequest: ( method: string, callback: (obj: Record<string, any>) => Promise<Record<string, any> | null>) => void;
Public: Register a callback for a custom request
Parameter method
A string containing the name of the message to listen for.
Parameter callback
The function to be called when the message is received. The payload from the message is passed to the function.
method onLogMessage
onLogMessage: (callback: (params: lsp.LogMessageParams) => void) => void;
Public: Register a callback for the
window/logMessage
message.Parameter callback
The function to be called when the
window/logMessage
message is received with {LogMessageParams} being passed.
method onPublishDiagnostics
onPublishDiagnostics: ( callback: (params: lsp.PublishDiagnosticsParams) => void) => void;
Public: Register a callback for the
textDocument/publishDiagnostics
message.Parameter callback
The function to be called when the
textDocument/publishDiagnostics
message is received a {PublishDiagnosticsParams} containing new {Diagnostic} messages for a given uri.
method onShowDocument
onShowDocument: ( callback: (params: lsp.ShowDocumentParams) => Promise<lsp.ShowDocumentResult>) => void;
Public: Register a callback for the
window/showDocument
message.Parameter callback
The function to be called when the
window/showDocument
message is received with {ShowDocumentParams} being passed.
method onShowMessage
onShowMessage: (callback: (params: lsp.ShowMessageParams) => void) => void;
Public: Register a callback for the
window/showMessage
message.Parameter callback
The function to be called when the
window/showMessage
message is received with {ShowMessageParams} being passed.
method onShowMessageRequest
onShowMessageRequest: ( callback: ( params: lsp.ShowMessageRequestParams ) => Promise<lsp.MessageActionItem | null>) => void;
Public: Register a callback for the
window/showMessageRequest
message.Parameter callback
The function to be called when the
window/showMessageRequest
message is received with {ShowMessageRequestParam}' being passed.Returns
A {Promise} containing the {MessageActionItem}.
method onTelemetryEvent
onTelemetryEvent: (callback: (...args: any[]) => void) => void;
Public: Register a callback for the
telemetry/event
message.Parameter callback
The function to be called when the
telemetry/event
message is received with any parameters received being passed on.
method onWorkspaceFolders
onWorkspaceFolders: ( callback: () => Promise<lsp.WorkspaceFolder[] | null>) => void;
Public: Register a callback for the
workspace.workspaceFolders
request. This request is sent from the server to Atom to fetch the current open list of workspace foldersParameter A
Callback which returns a {Promise} containing an {Array} of {lsp.WorkspaceFolder[]} or {null} if only a single file is open in the tool.
method prepareCallHierarchy
prepareCallHierarchy: ( params: lsp.CallHierarchyPrepareParams, _cancellationToken?: jsonrpc.CancellationToken) => Promise<lsp.CallHierarchyItem[] | null>;
Public: Send a
textDocument/prepareCallHierarchy
request.Parameter params
The {CallHierarchyIncomingCallsParams} that containing {textDocument} and {position} associated with the calling.
Parameter cancellationToken
The {CancellationToken} that is used to cancel this request if necessary.
Returns
A {Promise} containing an {Array} of {CallHierarchyItem}s that corresponding to the request.
method rename
rename: (params: lsp.RenameParams) => Promise<lsp.WorkspaceEdit | null>;
Public: Send a
textDocument/rename
request.Parameter params
The {RenameParams} identifying the document containing the symbol to be renamed, as well as the position and new name.
Returns
A {Promise} containing an {WorkspaceEdit} that contains a list of {TextEdit}s either on the changes property (keyed by uri) or the documentChanges property containing an {Array} of {TextDocumentEdit}s (preferred).
method sendCustomNotification
sendCustomNotification: (method: string, params?: any[] | object) => void;
Public: Send a custom notification
Parameter method
A string containing the name of the notification message.
Parameter params
The method's parameters
method sendCustomRequest
sendCustomRequest: (method: string, params?: any[] | object) => Promise<any>;
Public: Send a custom request
Parameter method
A string containing the name of the request message.
Parameter params
The method's parameters
method shutdown
shutdown: () => Promise<void>;
Public: Send a
shutdown
request to the language server.
method signatureHelp
signatureHelp: ( params: lsp.TextDocumentPositionParams) => Promise<lsp.SignatureHelp | null>;
Public: Send a
textDocument/signatureHelp
request.Parameter params
The {TextDocumentPositionParams} for which a {SignatureHelp} is desired.
Returns
A {Promise} containing a {SignatureHelp}.
method willSaveTextDocument
willSaveTextDocument: (params: lsp.WillSaveTextDocumentParams) => void;
Public: Send a
textDocument/willSave
notification.Parameter params
The {WillSaveTextDocumentParams} containing the to-be-saved text document details and the reason for the save.
method willSaveWaitUntilTextDocument
willSaveWaitUntilTextDocument: ( params: lsp.WillSaveTextDocumentParams) => Promise<lsp.TextEdit[] | null>;
Public: Send a
textDocument/willSaveWaitUntil
notification.Parameter params
The {WillSaveTextDocumentParams} containing the to-be-saved text document details and the reason for the save.
Returns
A {Promise} containing an {Array} of {TextEdit}s to be applied to the text document before it is saved.
method workspaceSymbol
workspaceSymbol: ( params: lsp.WorkspaceSymbolParams) => Promise<lsp.SymbolInformation[] | null>;
Public: Send a
workspace/symbol
request.Parameter params
The {WorkspaceSymbolParams} containing the query string to search the workspace for.
Returns
A {Promise} containing an {Array} of {SymbolInformation}s that identify where the query string occurs within the workspace.
class LinterPushV2Adapter
class LinterPushV2Adapter {}
Public: Listen to diagnostics messages from the language server and publish them to the user by way of the Linter Push (Indie) v2 API provided by the Base Linter package.
constructor
constructor(connection: LanguageClientConnection);
Public: Create a new {LinterPushV2Adapter} that will listen for diagnostics via the supplied {LanguageClientConnection}.
Parameter connection
A {LanguageClientConnection} to the language server that will provide diagnostics.
method attach
attach: (indie: linter.IndieDelegate) => void;
Public: Attach this {LinterPushV2Adapter} to a given {V2IndieDelegate} registry.
Parameter indie
A {V2IndieDelegate} that wants to receive messages.
method captureDiagnostics
captureDiagnostics: (params: PublishDiagnosticsParams) => void;
Public: Capture the diagnostics sent from a langguage server, convert them to the Linter V2 format and forward them on to any attached {V2IndieDelegate}s.
Parameter params
The {PublishDiagnosticsParams} received from the language server that should be captured and forwarded on to any attached {V2IndieDelegate}s.
method detachAll
detachAll: () => void;
Public: Remove all {V2IndieDelegate} registries attached to this adapter and clear them.
method diagnosticSeverityToSeverity
static diagnosticSeverityToSeverity: ( severity: number) => 'error' | 'warning' | 'info';
Public: Convert a diagnostic severity number obtained from the language server into the textual equivalent for a Linter {V2Message}.
Parameter severity
A number representing the severity of the diagnostic.
Returns
A string of 'error', 'warning' or 'info' depending on the severity.
method diagnosticToV2Message
diagnosticToV2Message: (path: string, diagnostic: Diagnostic) => linter.Message;
Public: Convert a single {Diagnostic} received from a language server into a single {V2Message} expected by the Linter V2 API.
Parameter path
A string representing the path of the file the diagnostic belongs to.
Parameter diagnostics
A {Diagnostic} object received from the language server.
Returns
A {V2Message} equivalent to the {Diagnostic} object supplied by the language server.
method dispose
dispose: () => void;
Dispose this adapter ensuring any resources are freed and events unhooked.
method getLSDiagnosticForMessage
getLSDiagnosticForMessage: (message: linter.Message) => Diagnostic | undefined;
Public: Get the {Diagnostic} that is associated with the given Base Linter v2 {Message}.
Parameter message
The {Message} object to fetch the {Diagnostic} for.
Returns
The associated {Diagnostic}.
method getLSDiagnosticsForMessages
getLSDiagnosticsForMessages: (linterMessages: linter.Message[]) => Diagnostic[];
Public: get diagnostics for the given linter messages
Parameter linterMessages
An array of linter {V2Message}
Returns
An array of LS {Diagnostic[]}
Interfaces
interface ActiveServer
interface ActiveServer {}
The necessary elements for a server that has started or is starting.
property additionalPaths
additionalPaths?: Set<string>;
Out of project directories that this server can also support.
property capabilities
capabilities: ls.ServerCapabilities;
property connection
connection: ls.LanguageClientConnection;
property disposable
disposable: CompositeDisposable;
property process
process: LanguageServerProcess;
property projectPath
projectPath: string;
interface Logger
interface Logger {}
interface ServerAdapters
interface ServerAdapters {}
property linterPushV2
linterPushV2: LinterPushV2Adapter;
property loggingConsole
loggingConsole: LoggingConsoleAdapter;
property signatureHelpAdapter
signatureHelpAdapter?: SignatureHelpAdapter;
Type Aliases
type ConnectionType
type ConnectionType = 'stdio' | 'socket' | 'ipc';
type LanguageServerProcess
type LanguageServerProcess = ChildProcess | MinimalLanguageServerProcess;
Public: Defines a language server process which is either a ChildProcess, or it is a minimal object that resembles a ChildProcess.
MinimalLanguageServerProcess
is used so that language packages with alternative language server process hosting strategies can return something compatible withAutoLanguageClient.startServerProcess
.
Namespaces
Package Files (12)
- build/lib/adapters/command-execution-adapter.d.ts
- build/lib/adapters/linter-push-v2-adapter.d.ts
- build/lib/auto-languageclient.d.ts
- build/lib/convert.d.ts
- build/lib/download-file.d.ts
- build/lib/languageclient.d.ts
- build/lib/logger.d.ts
- build/lib/main.d.ts
- build/lib/server-manager.d.ts
- build/lib/utils.d.ts
- typings/atom-ide/index.d.ts
- typings/electron/index.d.ts
Dependencies (7)
Dev Dependencies (10)
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/atom-languageclient
.
- Markdown[](https://www.jsdocs.io/package/atom-languageclient)
- HTML<a href="https://www.jsdocs.io/package/atom-languageclient"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6160 ms. - Missing or incorrect documentation? Open an issue for this package.