From 9ff13e30076882678eecba326200a88b5fc7b2e7 Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Thu, 30 Apr 2026 20:41:50 +0200 Subject: [PATCH] some shite WIP --- ctags-ls/src/ctags_ls/__init__.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/ctags-ls/src/ctags_ls/__init__.py b/ctags-ls/src/ctags_ls/__init__.py index 32da070..44439e9 100644 --- a/ctags-ls/src/ctags_ls/__init__.py +++ b/ctags-ls/src/ctags_ls/__init__.py @@ -1,13 +1,23 @@ +from dataclasses import dataclass +from pathlib import Path +from typing import final from pygls.lsp.server import LanguageServer from lsprotocol import types ls = LanguageServer("ctags-ls", "v0.1") -@ls.feature(types.TEXT_DOCUMENT_COMPLETION) +@ls.feature( + types.TEXT_DOCUMENT_COMPLETION, + types.CompletionOptions(trigger_characters=["."]) +) def completions(params: types.CompletionParams): - items = [] + items = [ + types.CompletionItem(label="foo"), + types.CompletionItem(label="bar"), + types.CompletionItem(label="baz"), + ] document = ls.workspace.get_text_document(params.text_document.uri) - current_line = document.lines[params.position.line].strip() + current_line = document.lines[params.position.line][:params.position.character] if current_line.endswith("hello."): items = [ types.CompletionItem(label="world"), @@ -17,3 +27,16 @@ def completions(params: types.CompletionParams): def main(): ls.start_io() + +@final +class Tags: + def __init__(self) -> None: + self.last_mtime: int = 0 + self.cache: dict[str, Tag] = {} + +@dataclass +class Tag: + symbol: str + file: Path + search_pattern: str + type: types.CompletionItemKind