--- title: "Lsp" hideTitleOnPage: true --- ## LspServer ### Constructors #### Constructor ```ts new LspServer( transport: HttpTransport, languageId: string, pathToProject: string): LspServer; ``` **Parameters**: - `transport` _HttpTransport_ - `languageId` _string_ - `pathToProject` _string_ **Returns**: - `LspServer` ### Methods #### \[Symbol.asyncDispose\]() ```ts [Symbol.asyncDispose](): Promise; ``` **Returns**: - `Promise` #### completions() ```ts completions( uri: string, position: LspPosition, options: LspCompletionsOptions = {}): Promise; ``` **Parameters**: - `uri` _string_ - `position` _LspPosition_ - `options` _LspCompletionsOptions = \{\}_ **Returns**: - `Promise` #### didClose() ```ts didClose(uri: string): Promise; ``` **Parameters**: - `uri` _string_ **Returns**: - `Promise` #### didOpen() ```ts didOpen(uri: string): Promise; ``` **Parameters**: - `uri` _string_ **Returns**: - `Promise` #### documentSymbols() ```ts documentSymbols(uri: string): Promise; ``` **Parameters**: - `uri` _string_ **Returns**: - `Promise` #### stop() ```ts stop(): Promise; ``` **Returns**: - `Promise` #### workspaceSymbols() ```ts workspaceSymbols(query: string): Promise; ``` **Parameters**: - `query` _string_ **Returns**: - `Promise` *** ## LspService Sandbox LSP namespace. Every call is scoped by `languageId` + `pathToProject`: the daemon keys one language server per pair, starting it on demand and reusing it afterwards. `start()` is therefore about controlling WHEN the server boots (and surfacing `LSP_SERVER_UNAVAILABLE` when the image lacks it), not a precondition the other calls can skip — they answer `LSP_NOT_STARTED` rather than starting one implicitly. ### Constructors #### Constructor ```ts new LspService(transport: HttpTransport): LspService; ``` **Parameters**: - `transport` _HttpTransport_ **Returns**: - `LspService` ### Methods #### start() ```ts start(languageId: string, pathToProject: string): Promise; ``` Start the language server for a project. **Parameters**: - `languageId` _string_ - `pathToProject` _string_ **Returns**: - `Promise` *** ## LspCompletionsOptions **Properties**: - `context?` _toolbox.CompletionRequest\['context'\]_ *** ## LspCompletionItem ```ts type LspCompletionItem = { [key: string]: unknown } & Omit & { documentation?: unknown } ``` One completion candidate. Shape follows the language server, so the daemon passes items through with only `isIncomplete`/`items` normalized. *** ## LspCompletionList ```ts type LspCompletionList = Omit & { items: LspCompletionItem[] } ``` *** ## LspLocation ```ts type LspLocation = toolbox.SymbolLocation ``` *** ## LspPosition ```ts type LspPosition = toolbox.SymbolPosition ``` A zero-based LSP position. *** ## LspRange ```ts type LspRange = toolbox.SymbolRange ``` *** ## LspSymbol ```ts type LspSymbol = toolbox.SymbolInfo ``` One symbol from `documentSymbols()` / `workspaceSymbols()`.