emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.8k stars 893 forks source link

Snippet support in completion-at-point #350

Closed yyoncho closed 4 years ago

yyoncho commented 6 years ago

Investigate whether the implementation that is already present in company-lsp could be moved to lsp-mode and used in completion-at-point

cyruseuros commented 5 years ago

Has this turned into a dead end or is it just a question of extra work? If so, I'd like to help

yyoncho commented 5 years ago

@jjzmajic It is a question of extra work - it hasn't been a priority since company-lsp supports that. Just for the record, there is one more disadvantage that capf has - it is sync and blocking. Thank you.

cyruseuros commented 5 years ago

Time to get my hands dirty then! Any pointers you care to drop? Also, I think you just gave me an idea for my next package: async-capf. Just overriding complete-symbol. Personally I avoid company because helm is way better at narrowing completions down, and generally feels snappier with capf. Either there is a response or there isn't, no waiting for a maybe.

yyoncho commented 5 years ago

Any pointers you care to drop?

  1. Take a look at company-lsp--post-completion. It will be great if we can move the logic here and share it across components.
  2. About the async - AFAIK jsonrpc/eglot have async implementation which works like that: Performs the request sync but have a sit-for in a loop waiting for the result and at the same time attach to post-command which can be used to cancel the request (i. e. if the user presses a key before the call returns). I have never tried/tested but it might feel like the request has been performed asynchronously. I am not 100% sure whether being async is a concern for you if you are using helm frontend.

Also, I think you just gave me an idea for my next package: async-capf

IMO it will be better to first discuss with @dgutov first, maybe there are plans to make completion-at-point-function to support async calls directly in Emacs core.

dgutov commented 5 years ago

@yyoncho We discussed it, but there's nothing solid yet.

cyruseuros commented 5 years ago

Eglot does feel more responsive, but the flymake-only situation is a deal-breaker for me. @dgutov, this day was bound to come. How does one get his feet wet when it comes to hacking on core Emacs? In my mind, this is literally the only thing company has on capf. If anything, it should be a fronted-only package (impressive as it is). I don't want another module between me and my completions.

dgutov commented 5 years ago

@jjzmajic First of all, there's a file at the top of Emacs development tree called CONTRIBUTE. You should familiarize yourself with it.

Next, you either file a bug report with M-x report-emacs-bug or initiate a discussion on emacs-devel by writing to the said mailing list. Either way all subsequent communication will happen over email.

joaotavora commented 5 years ago

Eglot does feel more responsive, but the flymake-only situation is a deal-breaker for me. @dgutov, this day was bound to come. How does one get his feet wet when it comes to hacking on core Emacs?

Eh, if you're going to be hacking on core Emacs, why just not hack on flymake? :-D just sayin...