Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Become more robust to parse errors #672

Open
rockstar opened this issue Oct 14, 2022 · 1 comment
Open

Become more robust to parse errors #672

rockstar opened this issue Oct 14, 2022 · 1 comment

Comments

@rockstar
Copy link

I've started working on a sql lsp server implementation, using sqlparser as the parser. Unfortunately, I very quickly hit a wall, mostly around how sqlparser discovers and surfaces errors. For instance, let's say the user types the following: SELECT * F and hits the key. A good lsp server would suggest completing F to FROM, even just do it automatically in that case. If one tries to parse that input string with sqlparser, it returns a ParserError("Expected end of statement, found: F"). The error isn't unexpected, but now (a) since the ast isn't available in the face of errors, there are no recommendations/commands/lints I can make based on a error-prone AST, and (b) I don't have enough information (line/col info) to send a diagnostic (the thing that makes the red squiggly lines) to the client. The line/col information was suggested in #179, but a fair amount of the work that would enable a really good LSP server implementation is being able to work with an AST that has errors in it.

I suspect what I'm describing is really hard, and has all sorts of backwards-incompatible changes that would be required to make this work. I think it'd be worthwhile, though.

@alamb
Copy link
Contributor

alamb commented Oct 14, 2022

Possibly related to #524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants