Skip to content

Commit 947aa3f

Browse files
authored
Merge pull request supabase-community#43 from supabase/chore/readme
chore: update roadmap
2 parents 2f06c49 + e8d9b78 commit 947aa3f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The [Language Server Protocol](https://microsoft.github.io/language-server-proto
2222

2323
## Motivation
2424

25-
Despite the rising popularity of Postgres, support for the PL/pgSQL in IDEs and editors is limited. While there are some *generic* SQL Language Servers[^1] offering the Postgres syntax as a "flavor" within the parser, they usually fall short due to the ever-evolving and complex syntax of PostgreSQL. There are a few proprietary IDEs[^2] that work well, but the features are only available within the respective IDE.
25+
Despite the rising popularity of Postgres, support for the PL/pgSQL in IDEs and editors is limited. While there are some _generic_ SQL Language Servers[^1] offering the Postgres syntax as a "flavor" within the parser, they usually fall short due to the ever-evolving and complex syntax of PostgreSQL. There are a few proprietary IDEs[^2] that work well, but the features are only available within the respective IDE.
2626

2727
This Language Server is designed to support Postgres, and only Postgres. The server uses [libpg_query](https://github.com/pganalyze/libpg_query), therefore leveraging the PostgreSQL source to parse the SQL code reliably. Using Postgres within a Language Server might seem unconventional, but it's the only reliable way of parsing all valid PostgreSQL queries. You can find a longer rationale on why This is the Way™ [here](https://pganalyze.com/blog/parse-postgresql-queries-in-ruby). While libpg_query was built to execute SQL, and not to build a language server, any shortcomings have been successfully mitigated in the `parser` crate. You can read the [commented source code](./crates/parser/src/lib.rs) for more details on the inner workings of the parser.
2828

@@ -33,8 +33,10 @@ Once the parser is stable, and a robust and scalable data model is implemented,
3333
This is 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 to prove that it works end-to-end, and is just a very basic language server with semantic highlighting and error diagnostics. Before further feature development, we have to complete a bit of groundwork:
3434

3535
1. _Finish the parser_
36-
- 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. ([#4](https://github.com/supabase/postgres_lsp/pull/4))
37-
- 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.
36+
- 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. ([#4](https://github.com/supabase/postgres_lsp/pull/4)) ✅
37+
- 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. ✅
38+
- Add support for parsing function bodies ([#34](https://github.com/supabase/postgres_lsp/issues/34))
39+
- Implement a custom parser to extract statements from a source and replace the [regexp-based approach](https://github.com/supabase/postgres_lsp/blob/2f06c49f914b331cf93ea52d9edde8722d27ad05/crates/parser/src/source_parser.rs#L78)
3840
2. _Implement a robust and scalable data model_
3941
- This is still in a research phase
4042
- 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)
@@ -88,13 +90,13 @@ You'll need Cargo, Node, and npm installed.
8890

8991
If you are using VS Code, you can install both the server and the client extension by running:
9092

91-
``` sh
93+
```sh
9294
cargo xtask install
9395
```
9496

9597
If you're not using VS Code, you can install the server by running:
9698

97-
``` sh
99+
```sh
98100
cargo xtask install --server
99101
```
100102

@@ -104,7 +106,7 @@ The server binary will be installed in `.cargo/bin`. Make sure that `.cargo/bin`
104106

105107
- [psteinroe](https://github.com/psteinroe) (Maintainer)
106108

107-
## Acknowledgments
109+
## Acknowledgments
108110

109111
- [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.
110112
- [squawk](https://github.com/sbdchd/squawk) and [pganalyze](https://pganalyze.com) for inspiring the use of libpg_query.

0 commit comments

Comments
 (0)