Skip to content

Commit ead1fe2

Browse files
committed
docs: basic readme
1 parent b789b2a commit ead1fe2

File tree

1 file changed

+53
-5
lines changed

1 file changed

+53
-5
lines changed

readme.md

+53-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
1-
this is a ~~sample~~ readme, **can** you see it _really_?
2-
helloooo
3-
heyyDidOpenTextDocumentParams
1+
# custom-lsp
2+
A custom LSP server written in 100% Go. It's purpose was learning about how LSP
3+
servers actually work at a deeper level, gaining understanding and implementing
4+
a minimal version of it.
45

5-
VS C*de is an excellent editor
6-
VS Code neovim Neovim
6+
Built with go version 1.22.1 on darwin/arm64, and tested on NEOVIM `v0.9.5`
7+
(Release) - [link](https://github.com/neovim/neovim/releases/tag/v0.9.5). Should
8+
work with other editors as well given proper config of lsp at the client end.
9+
A sample config used for testing this LSP server is linked [here](https://github.com/ayush-oyorooms/.dotfiles/blob/5a7ab2ba1c965cc1bc91de9a646a8a82d68976d1/nvim/.config/nvim/after/plugin/custom_lsp_server_test.lua)
10+
11+
A huuuge thanks to @tjdevries for sparking the interest in LSPs : )
12+
13+
## Functionalities Supported
14+
### 1. Hover
15+
This functionality in general displays the function / method / class synopsis as
16+
a popup in usual editors. It is invoked when cursor is kept on a word for a
17+
while. Here I have implemented a simple version of it which handles state and
18+
dynamically tells the char count.
19+
20+
* LSP Spec: [Hover](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_hover)
21+
* Invocation: `:lua vim.lsp.buf.hover()`
22+
23+
### 2. Go To Definition
24+
This takes to the definition of the function / method(it is different from
25+
implementation). This is invoked usually in editors when you
26+
`Ctrl / Cmd + click` on a keyword. In this implementaion it takes you to a line
27+
above where the cursor is at the moment.
28+
29+
* LSP Spec: [Go To Definition](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition)
30+
* Invocation: `:lua vim.lsp.buf.definition()`
31+
32+
### 3. Code Actions
33+
When there are errors in your project and editor shows options to fix them,
34+
these are the code actions. The server returns with the possible potential
35+
solutions to the problems in the current context. This implementation takes it
36+
quite seriously xD.
37+
38+
* LSP Spec: [Code Actions](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction)
39+
* Invocation: `:lua vim.lsp.buf.code_action()` _or_ `:Telescope diagnostics`
40+
41+
### 4. Completions
42+
These are simply the suggestions which appear as you type. This implementation
43+
provides a couple of suggestions based on typing.
44+
45+
* LSP Spec: [Completion](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_completion)
46+
* Invocation: `:lua vim.lsp.buf.completion()`
47+
48+
### 4. Diagnostics (Notification)
49+
These are simply the errors, warnings, hints along with some more info related
50+
to them that editor keeps generating async-ly and shows them in the top right
51+
section (usually). This implementation takes a few funny takes on editors.
52+
53+
* LSP Spec: [Diagnostics](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_publishDiagnostics)
54+
* Invocation: `:lua vim.lsp.diagnostic.get_line_diagnostics()` (these btw get generated in insert mode only)

0 commit comments

Comments
 (0)