Skip to content

Commit 76f573b

Browse files
committed
chore: documentation
1 parent 8154984 commit 76f573b

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ Once the parser is stable, and a robust and scalable data model is implemented,
1515
At this point however, this is merely a proof of concept for building both a concrete syntax tree and an abstract syntax tree from a potentially malformed PostgreSQL source code. The `postgres_lsp` crate was created only to proof that it works e2e, and is just a very basic language server with semantic highlighting and error diagnostics. Before actual feature development can start, we have to do a bit of groundwork.
1616

1717
1. _Finish the parser_
18-
- The parser works, but the enum values for all the different syntax elements and internal conversations are manually written or copied, and, in some places, only cover a few elements required for a simple select statement. To have full coverage without possibilities for a copy and past error, they should be generated from pg_query.rs source code.
19-
- There are a few cases such as nested and named dollar quoted strings that cause the parser to fail due to limitations of the regex-based lexer. Nothing that is impossible to fix, or requires any change in the approach though.
18+
- The parser works, but the enum values for all the different syntax elements and internal conversations are manually written or copied, and, in some places, only cover a few elements required for a simple select statement. To have full coverage without possibilities for a copy and paste error, they should be generated from pg_query.rs source code.
19+
- There are a few cases such as nested and named dollar quoted strings that cause the parser to fail due to limitations of the regex-based lexer. Nothing that is impossible to fix, or requires any fundamental change in the parser though.
2020
2. _Implement a robust and scalable data model_
21-
- TODO
21+
- This is still in a research phase
22+
- A great rationale on the importance of the data model in a language server can be found [here](https://matklad.github.io/2023/05/06/zig-language-server-and-cancellation.html)
23+
- `rust-analyzer`s [`base-db` crate](https://github.com/rust-lang/rust-analyzer/tree/master/crates/base-db) will serve as a role model
24+
- The [`salsa`](https://github.com/salsa-rs/salsa) crate will most likely be the underlying data structure
2225
3. _Setup the language server properly_
23-
- TODO
26+
- This is still in a research phase
27+
- Once again `rust-analyzer` will serve as a role model, and we will most likely implement the same queueing and cancellation approach
2428
4. _Implement basic language server features_
2529
- Semantic Highlighting
2630
- Syntax Error Diagnostics
@@ -37,7 +41,32 @@ At this point however, this is merely a proof of concept for building both a con
3741
- Jump to definition
3842
- ... anything you can think of really
3943

44+
## Installation (do not do this yet!)
45+
46+
### Neovim
47+
48+
Add the postgres_lsp executable to your path, and add the following to your config to use it.
49+
50+
```lua
51+
require('lspconfig.configs').postgres_lsp = {
52+
default_config = {
53+
name = 'postgres_lsp',
54+
cmd = {'postgres_lsp'},
55+
filetypes = {'sql'},
56+
single_file_support = true,
57+
root_dir = util.root_pattern 'root-file.txt'
58+
}
59+
}
60+
61+
lsp.configure("postgres_lsp", {force_setup = true})
62+
```
63+
64+
## Contributors
65+
66+
- [psteinroe](https://github.com/psteinroe)
67+
4068
## Acknowledgments
4169

4270
- [rust-analyzer](https://github.com/rust-lang/rust-analyzer) for implementing such a robust, well documented, and feature-rich language server. Great place to learn from.
4371
- [squawk](https://github.com/sbdchd/squawk) and [pganalyze](https://pganalyze.com) for inspiring the use of libg_query.
72+
- [copple](https://github.com/kiwicopple) for the support and trust.

0 commit comments

Comments
 (0)