diff --git a/changelogs/fragments/10545.yml b/changelogs/fragments/10545.yml new file mode 100644 index 000000000000..7abfe8330bac --- /dev/null +++ b/changelogs/fragments/10545.yml @@ -0,0 +1,2 @@ +feat: +- Enable Shortcuts to Comment Lines in Query Editor ([#10545](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10545)) \ No newline at end of file diff --git a/packages/osd-monaco/src/monaco.ts b/packages/osd-monaco/src/monaco.ts index 99cc32f415d9..d33be3b5794c 100644 --- a/packages/osd-monaco/src/monaco.ts +++ b/packages/osd-monaco/src/monaco.ts @@ -50,5 +50,6 @@ import 'monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestController'; import 'monaco-editor/esm/vs/editor/contrib/hover/browser/hoverContribution'; // For hover import 'monaco-editor/esm/vs/editor/contrib/parameterHints/browser/parameterHints'; // For parameter hints import 'monaco-editor/esm/vs/editor/contrib/format/browser/formatActions'; // For document formatting +import 'monaco-editor/esm/vs/editor/contrib/comment/browser/comment'; // For comment/uncomment support export { monaco }; diff --git a/src/plugins/explore/public/components/query_panel/query_panel_editor/use_query_panel_editor/use_query_panel_editor.ts b/src/plugins/explore/public/components/query_panel/query_panel_editor/use_query_panel_editor/use_query_panel_editor.ts index bba564f373cc..e21cb552220d 100644 --- a/src/plugins/explore/public/components/query_panel/query_panel_editor/use_query_panel_editor/use_query_panel_editor.ts +++ b/src/plugins/explore/public/components/query_panel/query_panel_editor/use_query_panel_editor/use_query_panel_editor.ts @@ -72,6 +72,10 @@ const languageConfiguration: LanguageConfiguration = { { open: "'", close: "'" }, { open: '`', close: '`' }, ], + comments: { + lineComment: '//', // line comment + blockComment: ['/*', '*/'], // block comment + }, wordPattern: /@?\w[\w@'.-]*[?!,;:"]*/, // Consider tokens containing . @ as words while applying suggestions. Refer https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10118#discussion_r2201428532 for details. };