This is a barebones implementation of a Language Server Protocol (LSP) in Go, built to get familiar with LSP development. It supports fundamental features like hover information, go-to definitions, code actions, and autocomplete. The project is aimed at learning LSP concepts and basic Go development."
To install, just clone the repo and run go build main.go.
Personally I Use Neovim, and I do not know the implementation process in other editors. So I will just lay out the steps for Neovim.
(**note the cmd field should point to combiled binary **)
-> And an autocommand to trigger the LSP whenever a markdown file is opened:
Here I've added some keybindings just so its easier to do things such as codeactions,Hovers and Goto Definitions. For Autocomplete, CTRL + XCTRL+O triggers Neovim's built in auto complete so we can use that. This will happen automatically if you're using a completion engine like say nvim-cmp.
SPACE gd will trigger hover definition. (assuming leader is mapped to spacebar)
Upon an instance of the word "VS Code" in the current buffer, the LSP will send out an ERROR diagnostic. (lol)
Upon a diagnostic error (in our case the word "VS Code") we can perform code actions, with SPACE ca (assuming leader is mapped to spacebar)
The user can pick any one of the above to either censor the word "VS Code" or to replace it with a superior editor (NEOVIM BTW)
If user chooses 1, "VS Code" is replaced with Neovim, and the LSP affirms your decision. (lol)
If user chooses 2, "VS Code" is censored to "VS C*de) (lol)
In case there are no diagnostics, codeactions wont trigger, and the editor will let the user know.
Using CTRL XCTRL O will trigger autocomplete in Neovim, upon which the editor will receive autocomplete suggestion from the LSP.
( This happens automatically if you're using a completion engine as nvim-cmp )