Ce11an / surrealql-lsp

LSP for SurrealQL
Apache License 2.0
2 stars 0 forks source link

Context aware completions #2

Open Ce11an opened 3 days ago

Ce11an commented 3 days ago

After a productive discussion with @WillLillis within a tree-sitter discussion, I have implemented basic context aware completions.

I would like to offer completions for all the grammar specified inside tree-sitter-surrealql.

Completions to start with:

Another issue is that a query can be over multiple lines. Currently if I write:

SELECT
  *
FROM table
<cursor>

I do not get any completions for WHERE or SPLIT.

WillLillis commented 2 days ago

Hey! Could I ask how you're currently testing this with neovim? I cloned the repo and built the server without any issues, and am currently launching it with the following command:

:lua vim.lsp.start({ cmd = { "/home/lillis/projects/surrealql-lsp/target/debug/
surrealql-lsp-server" }, root_dir = vim.fn.getcwd(), })

When I check :LspInfo, it says the server is attached, but unfortunately I'm not getting any autocomplete from the server. Any ideas?

Ce11an commented 2 days ago

Hey! Could I ask how you're currently testing this with neovim? I cloned the repo and built the server without any issues, and am currently launching it with the following command:

:lua vim.lsp.start({ cmd = { "/home/lillis/projects/surrealql-lsp/target/debug/
surrealql-lsp-server" }, root_dir = vim.fn.getcwd(), })

When I check :LspInfo, it says the server is attached, but unfortunately I'm not getting any autocomplete from the server. Any ideas?

No problem! I just pushed the config I am using. Does that help?

I just pushed a very small test file to the repo 😄

I also watch the logs with:

tail -n 50 -f ~/.local/state/nvim/lsp.log
WillLillis commented 2 days ago

That helped a lot, thank you! 🥳

image