workspaceSymbols method

Future<List<WorkspaceSymbol>> workspaceSymbols(
  1. String query, {
  2. String? glob,
})

Workspace-wide symbols matching query, loading every parseable source file under glob (all files when null) through the adapter.

Uses a fresh, scoped language service per call so the result always reflects the current file contents and exactly the requested glob — never stale buffers from an earlier query.

Implementation

Future<List<WorkspaceSymbol>> workspaceSymbols(
  String query, {
  String? glob,
}) async {
  final lsp = LspService();
  try {
    final paths = await adapter.find(glob: glob);
    for (final p in paths) {
      final uri = _fileUri(p);
      if (Analyzer.languageOf(uri) == null) continue; // not parseable
      await lsp.analyze(uri, (await adapter.read(p)).content);
    }
    return await lsp.workspaceSymbols(query);
  } finally {
    await lsp.dispose();
  }
}