(uri: string)
| 334 | } |
| 335 | |
| 336 | export async function documentSymbol(uri: string) { |
| 337 | return run((client) => |
| 338 | client.connection |
| 339 | .sendRequest("textDocument/documentSymbol", { |
| 340 | textDocument: { |
| 341 | uri, |
| 342 | }, |
| 343 | }) |
| 344 | .catch(() => []), |
| 345 | ) |
| 346 | .then((result) => result.flat() as (LSP.DocumentSymbol | LSP.Symbol)[]) |
| 347 | .then((result) => result.filter(Boolean)) |
| 348 | } |
| 349 | |
| 350 | async function run<T>(input: (client: LSPClient.Info) => Promise<T>): Promise<T[]> { |
| 351 | const clients = await state().then((x) => x.clients) |