emacs-lsp / lsp-mssql

lsp-mode :heart: MSSQL Server
https://emacs-lsp.github.io/lsp-mssql
MIT License
34 stars 7 forks source link

No completions from database #7

Open johanwk opened 4 years ago

johanwk commented 4 years ago

I have installed lsp-mssql (from melpa), in Emacs 27.1 on Windows 10.

This works: I can connect to the database, there is syntax checking for the SQL, and I can execute queries and see the results. All this is already useful.

However, there is no completion (is that what "intellisense" means?) for table names or field names. Any hints on how to get this working?

(Command lsp-describe-session shows red diamonds on my buffer file name, and on 'Capabilities'. Something is obviously missing, but where to look? On startup there's a message "Python3 not found", but does this matter for completion?)

theothornhill commented 4 years ago

Same issue here. Everything but completion seems to work.

Where do I start to debug this? Edit: I get completions from native sql functions, but not identifiers from the DB I am working on.

yyoncho commented 4 years ago
  1. Do you have company-mode?
  2. Can you set lsp-print-io to t and then look for textDocument/completion requests and responses?
theothornhill commented 4 years ago
  1. Yes I do
  2. See https://paste.sr.ht/~theothornhill/5cc9b67fc7cf7bbb6eda36078970db3fda186289 - I've snipped some work info

I use lsp-mode for many languages: C#, elm, F#, JS/TS etc, and they all work fine with completion, both native keywords and more complex cases.

I can add that:

yyoncho commented 4 years ago

Seems like the completion does not return anything. The issue might be:

  1. lsp-mode not sending something server specific which has changed in recent versions.
  2. You not triggering the completion in the expected position.

If memory serves me right the completion was working if you do:

SELECT | FROM TABLE_FOO

with the cursor being on |.

If it is 1. then we need to compare the traffic between vscode extension and the server and emacs and the server.

theothornhill commented 4 years ago

I tried with your example there, and also some other places in both emacs and vs code, and vs code completes fine all over. My guess is that it's (1.)

What is the best next step to figure out what's wrong?

yyoncho commented 4 years ago

Collect the logs from both vscode/emacs from start to hitting the bug(as minimal as possible) and then find out what is missing on emacs side. (I am away from dev work for some time)

theothornhill commented 4 years ago

The vscode version doesn't seem to have a trace.server option, so I have no Idea at all for how to find that log unfortunately. Cannot find it referenced anywhere...

yyoncho commented 4 years ago

I was doing that by wrapping the server binary with a script that pipes the stdin/stdout to a file.

johanwk commented 3 years ago

I was doing that by wrapping the server binary with a script that pipes the stdin/stdout to a file.

I'd be happy to try this, but don't know where to start. You don't happen to have a pointer, to a recipe for a suitable "wrapper script"?