LSP document symbols
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* vscode LSP server module.
|
||||
*/
|
||||
|
||||
import { LSP_checkFile, LSP_updateFile, LSP_hoverInfo, LSP_codeActionInfo } from './newt.js'
|
||||
import { LSP_checkFile, LSP_updateFile, LSP_hoverInfo, LSP_codeActionInfo, LSP_docSymbols } from './newt.js'
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
@@ -118,12 +118,20 @@ connection.onCodeAction(({textDocument, range}) => {
|
||||
return actions
|
||||
})
|
||||
|
||||
connection.onDocumentSymbol((params) => {
|
||||
const uri = params.textDocument.uri;
|
||||
let symbols = LSP_docSymbols(uri);
|
||||
console.log("docs got", symbols)
|
||||
return symbols;
|
||||
})
|
||||
|
||||
connection.onInitialize((_params: InitializeParams): InitializeResult => ({
|
||||
capabilities: {
|
||||
textDocumentSync: TextDocumentSyncKind.Incremental,
|
||||
hoverProvider: true,
|
||||
definitionProvider: true,
|
||||
codeActionProvider: true,
|
||||
documentSymbolProvider: true,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
4
newt-vscode-lsp/src/newt.d.ts
vendored
4
newt-vscode-lsp/src/newt.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { CodeAction, Diagnostic, Location } from "vscode-languageserver";
|
||||
import { CodeAction, Diagnostic, DocumentSymbol, Location } from "vscode-languageserver";
|
||||
|
||||
export function LSP_updateFile(name: string, content: string): (eta: any) => any;
|
||||
export function LSP_checkFile(name: string): Diagnostic[];
|
||||
@@ -8,3 +8,5 @@ interface HoverResult {
|
||||
}
|
||||
export function LSP_hoverInfo(name: string, row: number, col: number): HoverResult|boolean|null;
|
||||
export function LSP_codeActionInfo(name: string, row: number, col: number): CodeAction[]|null;
|
||||
export function LSP_docSymbols(name: string): DocumentSymbol[] | null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user