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

Add support for context aware autocompletion #174

Merged
merged 25 commits into from
Aug 24, 2022
Merged

Add support for context aware autocompletion #174

merged 25 commits into from
Aug 24, 2022

Conversation

sunker
Copy link
Collaborator

@sunker sunker commented Aug 19, 2022

This PR switches from using the CodeEditor that was used in the query editor, variable editor and annotation editor with the SQL CodeEditor from grafana/experimental. This adds autocompletion including suggestions for macros, functions, keywords, logical operators, comparison operators etc. Like before, redshift uses a custom language with its own keywords, functions and operators. Also, a custom completion item provider is used so that the plugin can resolve tables and columns that is used by the autocompletion engine.

Fixes #108

Example:
tableandschema

Example with macros:
macros

@github-actions
Copy link

Backend code coverage report for PR #174
No changes

@github-actions
Copy link

github-actions bot commented Aug 19, 2022

Frontend code coverage report for PR #174

Plugin Main PR Difference
src 87.67% 72.73% -14.94%

@sunker sunker changed the title Autocomplete Add support for context aware autocompletion Aug 19, 2022
@sunker sunker marked this pull request as ready for review August 19, 2022 10:40
@sunker sunker requested a review from a team as a code owner August 19, 2022 10:40
@sunker sunker requested review from iwysiu and kevinwcyu and removed request for a team August 19, 2022 10:40
Copy link
Contributor

@iwysiu iwysiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor notes. It makes sense to me overall but I'm going to take another look at it monday to make sure I understand it.

cypress/integration/smoke.spec.ts Outdated Show resolved Hide resolved
src/language/macros.ts Show resolved Hide resolved
sunker and others added 4 commits August 22, 2022 10:23
@sunker sunker added the effort/x-large more than 1 week label Aug 22, 2022
@sunker sunker added effort/large 1 week and removed effort/x-large more than 1 week labels Aug 22, 2022
Copy link
Contributor

@iwysiu iwysiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

src/SQLEditor.tsx Show resolved Hide resolved
src/SQLEditor.tsx Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL autocompletion support
3 participants