feat(lsp): add context-aware completion ranking and document highlights

Adds context-aware completion ranking and document highlights for Tcl.
Adds completion_context to distinguish variables and commands.
Wires per-file completion snapshots and ranking into the flow.
Adds document_highlight provider support and tests for highlights.

- Context-aware ranking of completion items using per-file snapshots
- Document highlight provider wired into initialization and tests
- Tests for completion context, ranking, and document highlights
This commit is contained in:
Christoph Brandau
2026-09-03 09:19:50 +02:00
parent 41d117fe2c
commit 89add18273
8 changed files with 421 additions and 44 deletions
+9
View File
@@ -170,6 +170,15 @@ class TclLanguageServer(LanguageServer):
self._workspace_completion_cache = (self._index_generation, items)
return items
def completion_items_by_file_snapshot(
self,
) -> dict[str, tuple[lsp.CompletionItem, ...]]:
"""Return completion items grouped by source file for request ranking."""
with self._index_lock:
return {
path: tuple(items) for path, items in self.poco_completion.items()
}
def custom_function_names_snapshot(self) -> frozenset[str]:
"""Return custom completion labels for semantic highlighting."""
with self._index_lock: