kinda sorta

This commit is contained in:
Ivar Fatland
2026-04-30 15:49:45 +02:00
parent c6c426621d
commit 2fea6fe116
2 changed files with 10 additions and 11 deletions
+4 -4
View File
@@ -1,12 +1,12 @@
from pygls.lsp.server import LanguageServer from pygls.lsp.server import LanguageServer
from lsprotocol import types from lsprotocol import types
server = LanguageServer("ctags-ls", "v0.1") ls = LanguageServer("ctags-ls", "v0.1")
@server.feature(types.TEXT_DOCUMENT_COMPLETION) @ls.feature(types.TEXT_DOCUMENT_COMPLETION)
def completions(params: types.CompletionParams): def completions(params: types.CompletionParams):
items = [] items = []
document = server.workspace.get_text_document(params.text_document.uri) 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].strip()
if current_line.endswith("hello."): if current_line.endswith("hello."):
items = [ items = [
@@ -16,4 +16,4 @@ def completions(params: types.CompletionParams):
return types.CompletionList(is_incomplete=False, items=items) return types.CompletionList(is_incomplete=False, items=items)
def main(): def main():
server.start_io() ls.start_io()
+6 -7
View File
@@ -692,15 +692,14 @@ require'lazy'.setup{ --{{{1
end, end,
}) })
local CTAGS_NAME = 'ctags-ls' vim.lsp.config['ctags-ls'] = {
vim.lsp.config(CTAGS_NAME, { cmd={ 'ctags-ls' },
cmd={ CTAGS_NAME },
filetypes=nil, filetypes=nil,
root_dir=function(...) ---@diagnostic disable-line: unused-vararg root_dir=function(_, on_dir)
return vim.fn.getcwd() on_dir(vim.fn.getcwd())
end, end,
}) }
vim.lsp.enable(CTAGS_NAME) vim.lsp.enable('ctags-ls')
vim.keymap.set( 'n', ',fd', vim.lsp.buf.definition, { noremap = true, silent = true}) vim.keymap.set( 'n', ',fd', vim.lsp.buf.definition, { noremap = true, silent = true})