reddit / emacs

Adding LSP support for custom language

PortalToTheWeekend · 2022-02-20 22:29
So I’ve been playing around with creating my own programming language and am at the point now where I would like to have some LSP support when editing it’s files in doom emacs. I’ve looked around online but haven’t found anything that definitely addresses how to setup something up for a personal programming language. Does anyone here know what I should do, or where I should go look?
Maurarias · 2022-02-20 23:00
You need to write a language server that implements the protocol (Language Server Protocol). You can read it's specification [here](https://microsoft.github.io/language-server-protocol/specifications/specification-current/).
atnar · 2022-02-20 23:11
Once you've written an actual language server for your language, fork lsp-mode and follow https://github.com/emacs-lsp/lsp-mode/blob/master/docs/page/adding-new-language.md. Afterwards, you can build your fork and use it instead of the lsp-mode from melpa.
rudi_sat · 2022-02-21 09:27
Here's a sample project that can get you started, if you're ok writing your language server in Java: https://github.com/rudi/xtext-emacs-lsp-demo
Temporary_Market_316 · 2022-02-21 12:40
And here you have one in OCaml. https://github.com/rvantonder/ocaml-lsp-specification