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 basic auto-completion support #4

Merged
merged 5 commits into from
May 15, 2023
Merged

Add basic auto-completion support #4

merged 5 commits into from
May 15, 2023

Conversation

flobernd
Copy link
Contributor

@flobernd flobernd commented May 2, 2023

  • Sneller SQL language
  • Dynamic identifiers (tables, columns, ...)

The column meta query currently uses SELECT SNELLER_DATASHAPE(*) FROM (SELECT * FROM tbl LIMIT 1000) which does not yield extremely good results for datasets like the GHA. We have to remember replacing this with TABLEPROBE as soon as it's available.

@flobernd flobernd force-pushed the autocomplete branch 3 times, most recently from d4b1402 to cc05650 Compare May 4, 2023 15:09
@flobernd flobernd marked this pull request as ready for review May 10, 2023 13:36
@@ -0,0 +1,641 @@
import { monacoTypes } from '@grafana/ui';
Copy link
Contributor Author

@flobernd flobernd May 10, 2023

Choose a reason for hiding this comment

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

There is room for improvement here. I mainly adjusted the builtins. The rest is based on the standard SQL language config.

Copy link
Member

Choose a reason for hiding this comment

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

Is this the same "Monaco" editor that I am using in the playground? If so, then we could reuse the specification in the playground too.

Copy link
Contributor Author

@flobernd flobernd May 11, 2023

Choose a reason for hiding this comment

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

@ramondeklein Yes, it's the same Monaco editor. Chances are high that the language definition is compatible 🙂 Not sure what version is used by Grafana (they embedd the component in their grafana/ui package and export it from there).

pkg/plugin/api.go Outdated Show resolved Hide resolved
src/components/QueryEditor.tsx Outdated Show resolved Hide resolved
@flobernd flobernd requested a review from philhofer May 10, 2023 15:16
@flobernd
Copy link
Contributor Author

@philhofer I had to rebase. Could you please approve again?

github.com/grafana/grafana-plugin-sdk-go v0.159.0
github.com/patrickmn/go-cache v2.1.0+incompatible
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want to use an unmainted Go package that hasn't been updated in 4 years?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I read, it's still a solid module. Most actively maintained caching modules (e.g. BigCache) are overkill for this simple usecase.

@@ -0,0 +1,641 @@
import { monacoTypes } from '@grafana/ui';
Copy link
Member

Choose a reason for hiding this comment

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

Is this the same "Monaco" editor that I am using in the playground? If so, then we could reuse the specification in the playground too.

@flobernd flobernd merged commit 60677d1 into main May 15, 2023
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

Successfully merging this pull request may close these issues.

3 participants