Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@grafana/runtime": "8.0.5",
"@grafana/toolkit": "8.0.5",
"@grafana/ui": "8.0.5",
"@grafana/experimental": "^0.0.2-canary.23",
"@grafana/experimental": "^0.0.2-canary.33",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.1.9",
Expand Down
9 changes: 8 additions & 1 deletion src/RedshiftSQLEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SQLEditor } from '@grafana/experimental';
import redshiftLanguageDefinition from 'language/definition';
import React from 'react';
import { RedshiftQuery } from 'types';

Expand All @@ -8,5 +9,11 @@ interface RawEditorProps {
}

export default function RedshiftSQLEditor({ query, onChange }: RawEditorProps) {
return <SQLEditor query={query.rawSQL} onChange={(rawSQL) => onChange({ ...query, rawSQL })}></SQLEditor>;
return (
<SQLEditor
query={query.rawSQL}
onChange={(rawSQL) => onChange({ ...query, rawSQL })}
language={redshiftLanguageDefinition}
></SQLEditor>
);
}
10 changes: 10 additions & 0 deletions src/language/definition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { LanguageDefinition } from '@grafana/experimental';
import { conf, language } from './language';

const redshiftLanguageDefinition: LanguageDefinition & { id: string } = {
id: 'redshift',
// TODO: Load language using code splitting instead: loader: () => import('./language'),
loader: () => Promise.resolve({ conf, language }),
Copy link
Collaborator Author

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?

};

export default redshiftLanguageDefinition;
Loading