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

Autocomplete/intellisense: support IRIS SQL specifically (vs. generic SQL) #37

Open
isc-tleavitt opened this issue Dec 15, 2022 · 1 comment

Comments

@isc-tleavitt
Copy link
Contributor

vscode-sqltools uses the generic autocomplete parser from Hue - in plugins/intellisense/language-server.ts:
import sqlAutocompleteParser from 'gethue/parsers/genericAutocompleteParser.js';

This falls over on certain valid aspects of IRIS SQL syntax - e.g,. implicit joins (arrow syntax) and operators/functions that are ObjectScript-specific. (This is the actual root cause for what I observed in #32 .) Predictably, in a file using such syntax, autocomplete fails after the unrecognized string.

Fixing this would require an upstream change to allow a driver to provide its own autocomplete parser, then actually implementing such a parser (see: https://docs.gethue.com/developer/development/#sql-parsers). Theoretically existing concepts from the generic autocomplete parser would transfer (although it seems that reliance on the autocomplete parser in vscode-tools might run too deep to be generic; e.g., there's a reference to id.cte and we don't support CTEs in IRIS SQL at this point). From some poking around in the Hue docs I think we'd probably run into issues with arrow syntax specifically - the "table" context is dependent on metadata on the server (what's the type of the column?), not just the SQL syntax.

@isc-tleavitt
Copy link
Contributor Author

Poked around a bit with Hue parsers this morning. Their documentation on how to create a new parser is irrelevant because of a PR a few months ago. I have a POC for adding implicit join support (which probably won't work for autocomplete without doing some very tricky things in our driver), but I'm not sure how it would be best to incorporate that. Probably the parser work should be part of this repo, but the build process would be just a little bit tricky. (Most likely involving cloning the Hue repo and overlaying our parser with it, then building with automation from the Hue repo and committing a build artifact... feels a little bit fragile but I think it's better than forking Hue or dealing with two levels of dependencies for what should be basic changes.)

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

1 participant