Carp icon indicating copy to clipboard operation
Carp copied to clipboard

LSP support & at-point functions

Open eriksvedang opened this issue 5 years ago • 14 comments

info-at-point type-at-point goto-definition

These would be accessible by external tools via command line flags to support these features in editors, etc

The brute force solution is to just walk the whole environment and find the form that has a matching file info.

eriksvedang avatar Nov 28 '20 07:11 eriksvedang

What about using LSP?

jacereda avatar Nov 28 '20 08:11 jacereda

I have an LSP implementation in the back of my mind as a possible project, but it's certainly much bigger than what's implied here.

tealeg avatar Nov 28 '20 08:11 tealeg

Looks like starting wouldn't be too hard:

https://github.com/alanz/lsp/blob/master/example/Simple.hs

jacereda avatar Nov 28 '20 08:11 jacereda

Sure, that sounds like an even better idea!

eriksvedang avatar Nov 28 '20 10:11 eriksvedang

Can we use that for flycheck (currently supported via --check) too, then?

eriksvedang avatar Nov 28 '20 10:11 eriksvedang

I think so. AFAIK flycheck integrates with LSP.

jacereda avatar Nov 28 '20 10:11 jacereda

@eriksvedang LSP is well supported in Emacs at this point - I use it for Go, Python and Rust very happily. Flycheck works perfectly.

tealeg avatar Nov 30 '20 08:11 tealeg

Awesome, I'm VERY excited about this approach then!

eriksvedang avatar Nov 30 '20 08:11 eriksvedang

Re @jacereda 's linked Haskel code - as a general question, but wouldn't it be good to implement this in Carp rather than Haskel? The more tooling is in a language other than Carp, the bigger barrier there is to people working on it (in many cases, it requires learning two languages instead of one).

tealeg avatar Nov 30 '20 08:11 tealeg

That is true, but considering that the Carp compiler is written in Haskell, hooking into it (which might be required) will probably be simpler from within Haskell.

hellerve avatar Nov 30 '20 10:11 hellerve

@hellerve I guess that leads to a bigger topic - a self-hosted compiler, but that's a whole different ball game ;-)

tealeg avatar Nov 30 '20 10:11 tealeg

AFAIK LSP is quite messy, piggybacking into whatever that project has to offer can be a great timesaver.

jacereda avatar Nov 30 '20 10:11 jacereda

@eriksvedang LSP is well supported in Emacs at this point - I use it for Go, Python and Rust very happily. Flycheck works perfectly.

emacs 29 now has lsp built in

jgarte avatar Nov 01 '22 22:11 jgarte

That is great news!

eriksvedang avatar Nov 02 '22 09:11 eriksvedang