@qualified/lsp-connection
Advanced tools
Comparing version 0.2.2 to 0.3.0
import type { Message, MessageConnection, NotificationHandler, CancellationToken } from "vscode-jsonrpc"; | ||
import type { InitializeParams, ProtocolRequestType } from "vscode-languageserver-protocol"; | ||
import type { InitializeParams } from "vscode-languageserver-protocol"; | ||
export declare type LspConnection = ReturnType<typeof createLspConnection>; | ||
@@ -18,9 +18,9 @@ /** | ||
/** Notify that the client initialized. */ | ||
initialized: () => void; | ||
initialized: () => Promise<void>; | ||
/** Send shutdown request. */ | ||
shutdown: () => Promise<void>; | ||
/** Notify exit. */ | ||
exit: () => void; | ||
exit: () => Promise<void>; | ||
/** Register an error handler. */ | ||
onError: (handler: (err: Error, msg?: Message | undefined, code?: number | undefined) => void) => import("vscode-jsonrpc").Disposable; | ||
onError: (handler: (err: Error, msg?: Message, code?: number) => void) => import("vscode-jsonrpc").Disposable; | ||
/** Register a close handler. */ | ||
@@ -47,3 +47,3 @@ onClose: (handler: () => void) => import("vscode-jsonrpc").Disposable; | ||
*/ | ||
textDocumentOpened: (params: import("vscode-languageserver-protocol").DidOpenTextDocumentParams) => void; | ||
textDocumentOpened: (params: import("vscode-languageserver-protocol").DidOpenTextDocumentParams) => Promise<void>; | ||
/** | ||
@@ -57,67 +57,67 @@ * Notify the text document got closed. | ||
*/ | ||
textDocumentClosed: (params: import("vscode-languageserver-protocol").DidCloseTextDocumentParams) => void; | ||
textDocumentClosed: (params: import("vscode-languageserver-protocol").DidCloseTextDocumentParams) => Promise<void>; | ||
/** | ||
* Notify changes to a text document. | ||
*/ | ||
textDocumentChanged: (params: import("vscode-languageserver-protocol").DidChangeTextDocumentParams) => void; | ||
textDocumentChanged: (params: import("vscode-languageserver-protocol").DidChangeTextDocumentParams) => Promise<void>; | ||
/** | ||
* Notify that the text document will be saved. | ||
*/ | ||
textDocumentWillSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams) => void; | ||
textDocumentWillSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams) => Promise<void>; | ||
/** | ||
* Get text edits to apply before saving. | ||
*/ | ||
getEditsBeforeSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").TextEdit[] | null>; | ||
getEditsBeforeSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").TextEdit[] | null>; | ||
/** | ||
* Notify that the text document got saved in the client. | ||
*/ | ||
textDocumentSaved: (params: import("vscode-languageserver-protocol").DidSaveTextDocumentParams) => void; | ||
textDocumentSaved: (params: import("vscode-languageserver-protocol").DidSaveTextDocumentParams) => Promise<void>; | ||
/** | ||
* Notify that the client's configuration changed. | ||
*/ | ||
configurationChanged: (params: import("vscode-languageserver-protocol").DidChangeConfigurationParams) => void; | ||
configurationChanged: (params: import("vscode-languageserver-protocol").DidChangeConfigurationParams) => Promise<void>; | ||
/** | ||
* Notify that the client detected changes to files. | ||
*/ | ||
watchedFilesChanged: (params: import("vscode-languageserver-protocol").DidChangeWatchedFilesParams) => void; | ||
watchedFilesChanged: (params: import("vscode-languageserver-protocol").DidChangeWatchedFilesParams) => Promise<void>; | ||
/** If supported, request completion at a given text document position. */ | ||
getCompletion: (params: import("vscode-languageserver-protocol").CompletionParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CompletionList | import("vscode-languageserver-protocol").CompletionItem[] | null>; | ||
getCompletion: (params: import("vscode-languageserver-protocol").CompletionParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CompletionList | import("vscode-languageserver-protocol").CompletionItem[] | null>; | ||
/** If supported, resolve additional information for a given completion item. */ | ||
getCompletionItemDetails: (params: import("vscode-languageserver-protocol").CompletionItem, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CompletionItem | null>; | ||
getCompletionItemDetails: (params: import("vscode-languageserver-protocol").CompletionItem, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CompletionItem | null>; | ||
/** If supported, request hover information at a given text document position. */ | ||
getHoverInfo: (params: import("vscode-languageserver-protocol").HoverParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Hover | null>; | ||
getHoverInfo: (params: import("vscode-languageserver-protocol").HoverParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").Hover | null>; | ||
/** If supported, request signature information at a given text document position. */ | ||
getSignatureHelp: (params: import("vscode-languageserver-protocol").SignatureHelpParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").SignatureHelp | null>; | ||
getSignatureHelp: (params: import("vscode-languageserver-protocol").SignatureHelpParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").SignatureHelp | null>; | ||
/** If supported, resolve the type definition locations of a symbol at a given text document position. */ | ||
getDeclaration: (params: import("vscode-languageserver-protocol").DeclarationParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getDeclaration: (params: import("vscode-languageserver-protocol").DeclarationParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").Declaration | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
/** If supported, resolve the definition location of a symbol at a given text document position. */ | ||
getDefinition: (params: import("vscode-languageserver-protocol").DefinitionParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getDefinition: (params: import("vscode-languageserver-protocol").DefinitionParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").LocationLink[] | import("vscode-languageserver-protocol").Definition | null>; | ||
/** If supported, resolve the type definition locations of a symbol at a given text document position. */ | ||
getTypeDefinition: (params: import("vscode-languageserver-protocol").TypeDefinitionParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getTypeDefinition: (params: import("vscode-languageserver-protocol").TypeDefinitionParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").LocationLink[] | import("vscode-languageserver-protocol").Definition | null>; | ||
/** If supported, resolve the implementation locations of a symbol at a given text document position. */ | ||
getImplementation: (params: import("vscode-languageserver-protocol").ImplementationParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getImplementation: (params: import("vscode-languageserver-protocol").ImplementationParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").LocationLink[] | import("vscode-languageserver-protocol").Definition | null>; | ||
/** If supported, resolve project-wide references for the symbol denoted by the given text document position. */ | ||
getReferences: (params: import("vscode-languageserver-protocol").ReferenceParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location[] | null>; | ||
getReferences: (params: import("vscode-languageserver-protocol").ReferenceParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").Location[] | null>; | ||
/** If supported, resolve a DocumentHighlight for a given text document position. */ | ||
getDocumentHighlight: (params: import("vscode-languageserver-protocol").DocumentHighlightParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentHighlight[] | null>; | ||
getDocumentHighlight: (params: import("vscode-languageserver-protocol").DocumentHighlightParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentHighlight[] | null>; | ||
/** If supported, list all symbols found in a given text document. */ | ||
getDocumentSymbol: (params: import("vscode-languageserver-protocol").DocumentSymbolParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentSymbol[] | import("vscode-languageserver-protocol").SymbolInformation[] | null>; | ||
getDocumentSymbol: (params: import("vscode-languageserver-protocol").DocumentSymbolParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentSymbol[] | import("vscode-languageserver-protocol").SymbolInformation[] | null>; | ||
/** If supported, get commands for the given text document and range. */ | ||
getCodeAction: (params: import("vscode-languageserver-protocol").CodeActionParams, token?: CancellationToken | undefined) => Promise<(import("vscode-languageserver-protocol").Command | import("vscode-languageserver-protocol").CodeAction)[] | null>; | ||
getCodeAction: (params: import("vscode-languageserver-protocol").CodeActionParams, token?: CancellationToken) => Promise<(import("vscode-languageserver-protocol").Command | import("vscode-languageserver-protocol").CodeAction)[] | null>; | ||
/** If supported, get code lens for the given text document. */ | ||
getCodeLens: (params: import("vscode-languageserver-protocol").CodeLensParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CodeLens[] | null>; | ||
getCodeLens: (params: import("vscode-languageserver-protocol").CodeLensParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CodeLens[] | null>; | ||
/** If supported, resolve a command for a given code lens. */ | ||
resolveCodeLens: (params: import("vscode-languageserver-protocol").CodeLens, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CodeLens | null>; | ||
resolveCodeLens: (params: import("vscode-languageserver-protocol").CodeLens, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CodeLens | null>; | ||
/** If supported, get document links. */ | ||
getDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLinkParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentLink[] | null>; | ||
getDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLinkParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentLink[] | null>; | ||
/** If supported, resolve additional information for a given document link. */ | ||
resolveDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLink, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentLink | null>; | ||
resolveDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLink, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentLink | null>; | ||
/** If supported, list all color symbols found in a given text document. */ | ||
getColorSymbols: (params: import("vscode-languageserver-protocol").DocumentColorParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").ColorInformation[] | null>; | ||
getColorSymbols: (params: import("vscode-languageserver-protocol").DocumentColorParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").ColorInformation[] | null>; | ||
/** If supported, get folding ranges in a document. */ | ||
getFoldingRanges: (params: import("vscode-languageserver-protocol").FoldingRangeParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").FoldingRange[] | null>; | ||
getFoldingRanges: (params: import("vscode-languageserver-protocol").FoldingRangeParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").FoldingRange[] | null>; | ||
/** If supported, get selection ranges in a document. */ | ||
getSelectionRanges: (params: import("vscode-languageserver-protocol").SelectionRangeParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").SelectionRange[] | null>; | ||
getSelectionRanges: (params: import("vscode-languageserver-protocol").SelectionRangeParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").SelectionRange[] | null>; | ||
/** If supported, list project-wide symbols matching the query string in params. */ | ||
getWorkspaceSymbols: (params: import("vscode-languageserver-protocol").WorkspaceSymbolParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").SymbolInformation[] | null>; | ||
getWorkspaceSymbols: (params: import("vscode-languageserver-protocol").WorkspaceSymbolParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").SymbolInformation[] | import("vscode-languageserver-protocol").WorkspaceSymbol[] | null>; | ||
readonly syncsIncrementally: boolean; | ||
@@ -128,3 +128,1 @@ readonly completionTriggers: string[]; | ||
}; | ||
declare type Result<T> = T extends ProtocolRequestType<any, infer R, any, any, any> ? R : never; | ||
export {}; |
@@ -9,3 +9,3 @@ "use strict"; | ||
*/ | ||
exports.createLspConnection = (conn) => { | ||
const createLspConnection = (conn) => { | ||
let capabilities; | ||
@@ -28,3 +28,3 @@ // Handle dynamic registrations | ||
const maybeReq = (cond, type) => (params, token) => cond() ? conn.sendRequest(type, params, token) : Promise.resolve(null); | ||
const maybeNotify = (cond, type) => (params) => cond() ? conn.sendNotification(type, params) : undefined; | ||
const maybeNotify = (cond, type) => (params) => cond() ? conn.sendNotification(type, params) : Promise.resolve(); | ||
const notifier = (type) => (params) => conn.sendNotification(type, params); | ||
@@ -191,2 +191,3 @@ const onNotification = (type) => (handler) => { | ||
}; | ||
exports.createLspConnection = createLspConnection; | ||
const METHOD_TO_PROVIDER = { | ||
@@ -193,0 +194,0 @@ "textDocument/codeAction": "codeActionProvider", |
import type { Message, MessageConnection, NotificationHandler, CancellationToken } from "vscode-jsonrpc"; | ||
import type { InitializeParams, ProtocolRequestType } from "vscode-languageserver-protocol"; | ||
import type { InitializeParams } from "vscode-languageserver-protocol"; | ||
export declare type LspConnection = ReturnType<typeof createLspConnection>; | ||
@@ -18,9 +18,9 @@ /** | ||
/** Notify that the client initialized. */ | ||
initialized: () => void; | ||
initialized: () => Promise<void>; | ||
/** Send shutdown request. */ | ||
shutdown: () => Promise<void>; | ||
/** Notify exit. */ | ||
exit: () => void; | ||
exit: () => Promise<void>; | ||
/** Register an error handler. */ | ||
onError: (handler: (err: Error, msg?: Message | undefined, code?: number | undefined) => void) => import("vscode-jsonrpc").Disposable; | ||
onError: (handler: (err: Error, msg?: Message, code?: number) => void) => import("vscode-jsonrpc").Disposable; | ||
/** Register a close handler. */ | ||
@@ -47,3 +47,3 @@ onClose: (handler: () => void) => import("vscode-jsonrpc").Disposable; | ||
*/ | ||
textDocumentOpened: (params: import("vscode-languageserver-protocol").DidOpenTextDocumentParams) => void; | ||
textDocumentOpened: (params: import("vscode-languageserver-protocol").DidOpenTextDocumentParams) => Promise<void>; | ||
/** | ||
@@ -57,67 +57,67 @@ * Notify the text document got closed. | ||
*/ | ||
textDocumentClosed: (params: import("vscode-languageserver-protocol").DidCloseTextDocumentParams) => void; | ||
textDocumentClosed: (params: import("vscode-languageserver-protocol").DidCloseTextDocumentParams) => Promise<void>; | ||
/** | ||
* Notify changes to a text document. | ||
*/ | ||
textDocumentChanged: (params: import("vscode-languageserver-protocol").DidChangeTextDocumentParams) => void; | ||
textDocumentChanged: (params: import("vscode-languageserver-protocol").DidChangeTextDocumentParams) => Promise<void>; | ||
/** | ||
* Notify that the text document will be saved. | ||
*/ | ||
textDocumentWillSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams) => void; | ||
textDocumentWillSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams) => Promise<void>; | ||
/** | ||
* Get text edits to apply before saving. | ||
*/ | ||
getEditsBeforeSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").TextEdit[] | null>; | ||
getEditsBeforeSave: (params: import("vscode-languageserver-protocol").WillSaveTextDocumentParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").TextEdit[] | null>; | ||
/** | ||
* Notify that the text document got saved in the client. | ||
*/ | ||
textDocumentSaved: (params: import("vscode-languageserver-protocol").DidSaveTextDocumentParams) => void; | ||
textDocumentSaved: (params: import("vscode-languageserver-protocol").DidSaveTextDocumentParams) => Promise<void>; | ||
/** | ||
* Notify that the client's configuration changed. | ||
*/ | ||
configurationChanged: (params: import("vscode-languageserver-protocol").DidChangeConfigurationParams) => void; | ||
configurationChanged: (params: import("vscode-languageserver-protocol").DidChangeConfigurationParams) => Promise<void>; | ||
/** | ||
* Notify that the client detected changes to files. | ||
*/ | ||
watchedFilesChanged: (params: import("vscode-languageserver-protocol").DidChangeWatchedFilesParams) => void; | ||
watchedFilesChanged: (params: import("vscode-languageserver-protocol").DidChangeWatchedFilesParams) => Promise<void>; | ||
/** If supported, request completion at a given text document position. */ | ||
getCompletion: (params: import("vscode-languageserver-protocol").CompletionParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CompletionList | import("vscode-languageserver-protocol").CompletionItem[] | null>; | ||
getCompletion: (params: import("vscode-languageserver-protocol").CompletionParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CompletionList | import("vscode-languageserver-protocol").CompletionItem[] | null>; | ||
/** If supported, resolve additional information for a given completion item. */ | ||
getCompletionItemDetails: (params: import("vscode-languageserver-protocol").CompletionItem, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CompletionItem | null>; | ||
getCompletionItemDetails: (params: import("vscode-languageserver-protocol").CompletionItem, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CompletionItem | null>; | ||
/** If supported, request hover information at a given text document position. */ | ||
getHoverInfo: (params: import("vscode-languageserver-protocol").HoverParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Hover | null>; | ||
getHoverInfo: (params: import("vscode-languageserver-protocol").HoverParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").Hover | null>; | ||
/** If supported, request signature information at a given text document position. */ | ||
getSignatureHelp: (params: import("vscode-languageserver-protocol").SignatureHelpParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").SignatureHelp | null>; | ||
getSignatureHelp: (params: import("vscode-languageserver-protocol").SignatureHelpParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").SignatureHelp | null>; | ||
/** If supported, resolve the type definition locations of a symbol at a given text document position. */ | ||
getDeclaration: (params: import("vscode-languageserver-protocol").DeclarationParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getDeclaration: (params: import("vscode-languageserver-protocol").DeclarationParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").Declaration | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
/** If supported, resolve the definition location of a symbol at a given text document position. */ | ||
getDefinition: (params: import("vscode-languageserver-protocol").DefinitionParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getDefinition: (params: import("vscode-languageserver-protocol").DefinitionParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").LocationLink[] | import("vscode-languageserver-protocol").Definition | null>; | ||
/** If supported, resolve the type definition locations of a symbol at a given text document position. */ | ||
getTypeDefinition: (params: import("vscode-languageserver-protocol").TypeDefinitionParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getTypeDefinition: (params: import("vscode-languageserver-protocol").TypeDefinitionParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").LocationLink[] | import("vscode-languageserver-protocol").Definition | null>; | ||
/** If supported, resolve the implementation locations of a symbol at a given text document position. */ | ||
getImplementation: (params: import("vscode-languageserver-protocol").ImplementationParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location | import("vscode-languageserver-protocol").Location[] | import("vscode-languageserver-protocol").LocationLink[] | null>; | ||
getImplementation: (params: import("vscode-languageserver-protocol").ImplementationParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").LocationLink[] | import("vscode-languageserver-protocol").Definition | null>; | ||
/** If supported, resolve project-wide references for the symbol denoted by the given text document position. */ | ||
getReferences: (params: import("vscode-languageserver-protocol").ReferenceParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").Location[] | null>; | ||
getReferences: (params: import("vscode-languageserver-protocol").ReferenceParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").Location[] | null>; | ||
/** If supported, resolve a DocumentHighlight for a given text document position. */ | ||
getDocumentHighlight: (params: import("vscode-languageserver-protocol").DocumentHighlightParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentHighlight[] | null>; | ||
getDocumentHighlight: (params: import("vscode-languageserver-protocol").DocumentHighlightParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentHighlight[] | null>; | ||
/** If supported, list all symbols found in a given text document. */ | ||
getDocumentSymbol: (params: import("vscode-languageserver-protocol").DocumentSymbolParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentSymbol[] | import("vscode-languageserver-protocol").SymbolInformation[] | null>; | ||
getDocumentSymbol: (params: import("vscode-languageserver-protocol").DocumentSymbolParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentSymbol[] | import("vscode-languageserver-protocol").SymbolInformation[] | null>; | ||
/** If supported, get commands for the given text document and range. */ | ||
getCodeAction: (params: import("vscode-languageserver-protocol").CodeActionParams, token?: CancellationToken | undefined) => Promise<(import("vscode-languageserver-protocol").Command | import("vscode-languageserver-protocol").CodeAction)[] | null>; | ||
getCodeAction: (params: import("vscode-languageserver-protocol").CodeActionParams, token?: CancellationToken) => Promise<(import("vscode-languageserver-protocol").Command | import("vscode-languageserver-protocol").CodeAction)[] | null>; | ||
/** If supported, get code lens for the given text document. */ | ||
getCodeLens: (params: import("vscode-languageserver-protocol").CodeLensParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CodeLens[] | null>; | ||
getCodeLens: (params: import("vscode-languageserver-protocol").CodeLensParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CodeLens[] | null>; | ||
/** If supported, resolve a command for a given code lens. */ | ||
resolveCodeLens: (params: import("vscode-languageserver-protocol").CodeLens, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").CodeLens | null>; | ||
resolveCodeLens: (params: import("vscode-languageserver-protocol").CodeLens, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").CodeLens | null>; | ||
/** If supported, get document links. */ | ||
getDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLinkParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentLink[] | null>; | ||
getDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLinkParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentLink[] | null>; | ||
/** If supported, resolve additional information for a given document link. */ | ||
resolveDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLink, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").DocumentLink | null>; | ||
resolveDocumentLink: (params: import("vscode-languageserver-protocol").DocumentLink, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").DocumentLink | null>; | ||
/** If supported, list all color symbols found in a given text document. */ | ||
getColorSymbols: (params: import("vscode-languageserver-protocol").DocumentColorParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").ColorInformation[] | null>; | ||
getColorSymbols: (params: import("vscode-languageserver-protocol").DocumentColorParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").ColorInformation[] | null>; | ||
/** If supported, get folding ranges in a document. */ | ||
getFoldingRanges: (params: import("vscode-languageserver-protocol").FoldingRangeParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").FoldingRange[] | null>; | ||
getFoldingRanges: (params: import("vscode-languageserver-protocol").FoldingRangeParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").FoldingRange[] | null>; | ||
/** If supported, get selection ranges in a document. */ | ||
getSelectionRanges: (params: import("vscode-languageserver-protocol").SelectionRangeParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").SelectionRange[] | null>; | ||
getSelectionRanges: (params: import("vscode-languageserver-protocol").SelectionRangeParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").SelectionRange[] | null>; | ||
/** If supported, list project-wide symbols matching the query string in params. */ | ||
getWorkspaceSymbols: (params: import("vscode-languageserver-protocol").WorkspaceSymbolParams, token?: CancellationToken | undefined) => Promise<import("vscode-languageserver-protocol").SymbolInformation[] | null>; | ||
getWorkspaceSymbols: (params: import("vscode-languageserver-protocol").WorkspaceSymbolParams, token?: CancellationToken) => Promise<import("vscode-languageserver-protocol").SymbolInformation[] | import("vscode-languageserver-protocol").WorkspaceSymbol[] | null>; | ||
readonly syncsIncrementally: boolean; | ||
@@ -128,3 +128,1 @@ readonly completionTriggers: string[]; | ||
}; | ||
declare type Result<T> = T extends ProtocolRequestType<any, infer R, any, any, any> ? R : never; | ||
export {}; |
@@ -24,3 +24,3 @@ import { CodeActionRequest, CodeLensRequest, CodeLensResolveRequest, CompletionRequest, CompletionResolveRequest, DeclarationRequest, DefinitionRequest, DidChangeConfigurationNotification, DidChangeTextDocumentNotification, DidChangeWatchedFilesNotification, DidCloseTextDocumentNotification, DidOpenTextDocumentNotification, DidSaveTextDocumentNotification, DocumentColorRequest, DocumentHighlightRequest, DocumentLinkRequest, DocumentLinkResolveRequest, DocumentSymbolRequest, ExitNotification, FoldingRangeRequest, HoverRequest, ImplementationRequest, InitializeRequest, InitializedNotification, LogMessageNotification, PublishDiagnosticsNotification, ReferencesRequest, RegistrationRequest, SelectionRangeRequest, ShowMessageNotification, ShutdownRequest, SignatureHelpRequest, TextDocumentSyncKind, TypeDefinitionRequest, UnregistrationRequest, WillSaveTextDocumentNotification, WillSaveTextDocumentWaitUntilRequest, WorkspaceSymbolRequest, } from "vscode-languageserver-protocol"; | ||
const maybeReq = (cond, type) => (params, token) => cond() ? conn.sendRequest(type, params, token) : Promise.resolve(null); | ||
const maybeNotify = (cond, type) => (params) => cond() ? conn.sendNotification(type, params) : undefined; | ||
const maybeNotify = (cond, type) => (params) => cond() ? conn.sendNotification(type, params) : Promise.resolve(); | ||
const notifier = (type) => (params) => conn.sendNotification(type, params); | ||
@@ -27,0 +27,0 @@ const onNotification = (type) => (handler) => { |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -24,8 +24,9 @@ "homepage": "https://github.com/qualified/lsps#readme", | ||
"dependencies": { | ||
"vscode-languageserver-protocol": "^3.16.0" | ||
"vscode-languageserver-protocol": "^3.17.1" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.0.2", | ||
"vscode-jsonrpc": "^6.0.0" | ||
} | ||
"typescript": "^4.7.4", | ||
"vscode-jsonrpc": "^8.0.1" | ||
}, | ||
"readme": "# @qualified/lsp-connection\n\nVSCode JSON RPC `MessageConnection` wrapper for LSP messages.\n\n`createLspConnection(conn: rpc.MessageConnection): LspConnection`\n" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65199
679