-
Notifications
You must be signed in to change notification settings - Fork 11
Custom redshift language #154
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
Conversation
|
Code coverage report for PR #154
|
| const redshiftLanguageDefinition: LanguageDefinition = { | ||
| id: 'redshift', | ||
| // TODO: Load language using code splitting instead: loader: () => import('./language'), | ||
| loader: () => Promise.resolve({ conf, language }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This language is in no way heavy, but I would like to use code splitting here since that's the de facto way to load Monaco languages. However, when doing so webpack tries to resolve the script from the server root ([0].js), but it's placed in the public/plugins/grafana-redshift-datasource/0.js. Any idea on how to work around this @dprokop?
andresmgot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main question here is that if we are able to extend the existing monaco language for redshift so we don't need to re-define everything?
|
|
||
| // Language based on standard SQL, but edited according to https://docs.aws.amazon.com/redshift/latest/dg/c_SQL_commands.html | ||
|
|
||
| export const logicalOperators = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all this is already written in the official language for Redshift: https://github.com/microsoft/monaco-editor/blob/main/src/basic-languages/redshift/redshift.ts#L34
can we use it here?
Any language from the Monaco language registry can be used, but extending it is not possible. But we don't want to use the redshift language from the Monaco registry for a few reasons:
Plan to update the redshift language definition so that it's at least somewhat close to official language ref in a future PR |
andresmgot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for the explanation!
|
@andresmgot any idea of what's causing the build error? |
|
It seems an issue with react 18: chakra-ui/chakra-ui#5896 Which got updated in your commit: d85b0b6 If you force |
b7d3728 to
89ed1bc
Compare
This PR composes and uses a custom redshift Monaco language that is based on the standard sql language from grafana experimental. This was made possible in this this PR in grafana experimental.
Part of #108
Fixes #153