Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve LSP experience outside VSCode #1587

Closed
jvanbruegge opened this issue Dec 5, 2019 · 13 comments · Fixed by #1604
Closed

Improve LSP experience outside VSCode #1587

jvanbruegge opened this issue Dec 5, 2019 · 13 comments · Fixed by #1604
Labels
error messages Better error reporting LSP dhall-lsp-server

Comments

@jvanbruegge
Copy link

jvanbruegge commented Dec 5, 2019

I am currently trying the LSP and sadly the diagnostics are unhelpful at best and annoying at worst. For example, I forgot to add .Type to an imported expression. This is the error I got:
grafik
This looks like it is just the normal command line error squeezed into one line. When I run the interpreter in a command line window, the information I actually needed to see my mistake was at the very bottom:
grafik
(On a side note, I don't see the use in the huge output on the cli too but there I can simply ignore it)

On the annoying side are a ton of parse errors à la Unexpected end of input, expected .... Also those errors somehow persist until I save the file again.

@sjakobi sjakobi added LSP dhall-lsp-server error messages Better error reporting labels Dec 5, 2019
@Gabriella439
Copy link
Collaborator

@jvanbruegge: I'm seeing something very different when I get a type error, although I'm testing against master. However, I don't expect it to look too different from the last release:

Language Server

@jvanbruegge
Copy link
Author

No, you are seeing the same thing, but in VSCode you can scroll over that huge chunk of text. The vim client does not have scrolling

@Gabriella439
Copy link
Collaborator

@jvanbruegge: Oh, I didn't even realize that the Dhall language server worked at all with Vim!

I know that in principle a language server should be able to support any editor that supports the language server protocol, but one issue that @EggBaconAndSpam ran into while designing the language server was that in practice language servers still requires some editor-side "glue" so we focused primarily on ironing out integration issues with VSCode.

In order to help you with your configuration I'm going to need as much detail on the following so I can reproduce your setup:

  • Editor (e.g. vim or nvim, including version)
  • Language server client plugin (e.g. coc.nvim, including version)
  • Any relevant vimrc settings

I probably won't be able to help that much (since I'm not really an expert on customizing vim), but I'll do what I can

@jvanbruegge
Copy link
Author

I use nvim version 0.4.3 with LanguageClient-neovim.
The relevant config is:

let g:LanguageClient_serverCommands = {
    \ 'dhall': ['dhall-lsp-server']
    \ }

My full configuration can be found in my dotfiles repo

@jvanbruegge
Copy link
Author

From what I can tell what does not work is configuration (the language server seems to ignore the didConfigurationChange event), and that the error messages are too huge to reasonably display them

@jvanbruegge
Copy link
Author

Oh, yeah for some reason hints and error do not necessarily show up at the correct spot, for example unused let binding is always shown at some earlier binding

@jvanbruegge jvanbruegge changed the title LSP errors are not helpful Improve LSP experience outside VSCode Dec 7, 2019
@jvanbruegge
Copy link
Author

jvanbruegge commented Dec 7, 2019

On the plus side, import completion and autocomplete works (albeit when working with dhall-kubernetes, autocomplete takes about 5 seconds to show up)

EDIT: Oh, and formatting works like a charm

@Gabriella439
Copy link
Collaborator

I'm just documenting here that this also requires installing:

Plug 'vmchale/dhall-vim'

... in case somebody else makes the same mistake I did

@Gabriella439
Copy link
Collaborator

@jvanbruegge: LanguageClient#explainErrorAtPoint appears to do what you want. If you call that then it provides the corresponding multiline display, like this:

Screen Shot 2019-12-08 at 10 55 04 AM

See: autozimu/LanguageClient-neovim#35 (comment)

@jvanbruegge
Copy link
Author

Yes, but wouldnt it be better to just remove that huge chunk of unneccesary text?

Gabriella439 added a commit that referenced this issue Dec 11, 2019
... as requested by @jvanbruegge

Fixes #1587

We already include the source range so that language server clients can
highlight the affected code.  Consequently, the diagnostic message doesn't need
to include the text of the source span.
@Gabriella439
Copy link
Collaborator

Fix is up here: #1604

Here is what the full diagnostic message looks like now in nvim:

Screen Shot 2019-12-10 at 8 51 48 PM

@jvanbruegge
Copy link
Author

nice

@Gabriella439
Copy link
Collaborator

As a side note, this change also removes the terminal escape codes around the "Error:" in the error message, too

Gabriella439 added a commit that referenced this issue Dec 12, 2019
... as requested by @jvanbruegge

Fixes #1587

We already include the source range so that language server clients can
highlight the affected code.  Consequently, the diagnostic message doesn't need
to include the text of the source span.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Better error reporting LSP dhall-lsp-server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants