lsp-mssql icon indicating copy to clipboard operation
lsp-mssql copied to clipboard

No completions from database

Open johanwk opened this issue 4 years ago • 9 comments

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?)

johanwk avatar Oct 20 '20 18:10 johanwk

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.

theothornhill avatar Oct 23 '20 10:10 theothornhill

  1. Do you have company-mode?
  2. Can you set lsp-print-io to t and then look for textDocument/completion requests and responses?

yyoncho avatar Oct 23 '20 11:10 yyoncho

  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:

  • Running queries work fine
  • Showing the treemacs thing and connecting works fine
  • Looking at schemas and all that work fine

theothornhill avatar Oct 23 '20 12:10 theothornhill

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.

yyoncho avatar Oct 23 '20 13:10 yyoncho

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?

theothornhill avatar Oct 23 '20 14:10 theothornhill

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)

yyoncho avatar Oct 23 '20 16:10 yyoncho

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...

theothornhill avatar Oct 23 '20 17:10 theothornhill

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

yyoncho avatar Oct 23 '20 17:10 yyoncho

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"?

johanwk avatar Nov 22 '20 22:11 johanwk