Skip to content

Commit

Permalink
[8.15] [ES|QL] Automatically encapsulate index names with special cha…
Browse files Browse the repository at this point in the history
…rs with quotes (elastic#187899) (elastic#188052)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[ES|QL] Automatically encapsulate index names with special chars with
quotes (elastic#187899)](elastic#187899)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Quynh Nguyen
(Quinn)","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-11T06:56:56Z","message":"[ES|QL]
Automatically encapsulate index names with special chars with quotes
(elastic#187899)\n\n## Summary\r\n\r\nAddresses
elastic#186411. This PR\r\nintroduces
quoted index names when auto populated/suggested if the index\r\nname
contains special
characters.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/43350163/94a37a82-9921-4419-b7d4-c8c50cc509f3\r\n\r\nIf
user is already prefixing index name with a quote, e.g. `from \"a`
it\r\nwill suggest as normal.\r\n\r\n\r\n### Checklis\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [ ] Any text added
follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
Risk Matrix\r\n\r\nDelete this section if it is not applicable to this
PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other
developers to\r\nidentify risks that should be tested prior to the
change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider
some of the following examples\r\nand how they may potentially impact
the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
Multiple Spaces&mdash;unexpected behavior in non-default Kibana
Space.\r\n| Low | High | Integration tests will verify that all features
are still\r\nsupported in non-default Kibana Space and when user
switches between\r\nspaces. |\r\n| Multiple nodes&mdash;Elasticsearch
polling might have race conditions\r\nwhen multiple Kibana nodes are
polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so
executing them multiple times will not result\r\nin logical error, but
will degrade performance. To test for this case we\r\nadd plenty of unit
tests around this logic and document manual testing\r\nprocedure. |\r\n|
Code should gracefully handle cases when feature X or plugin Y
are\r\ndisabled. | Medium | High | Unit tests will verify that any
feature flag\r\nor plugin combination still results in our service
operational. |\r\n| [See more potential
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
|\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for
breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"27dc08bcc400a495622b21deb79fbf62c1a10d55","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","backport:prev-minor","Feature:ES|QL","Team:ESQL","v8.15.0","v8.16.0"],"title":"[ES|QL]
Automatically encapsulate index names with special chars with
quotes","number":187899,"url":"https://github.com/elastic/kibana/pull/187899","mergeCommit":{"message":"[ES|QL]
Automatically encapsulate index names with special chars with quotes
(elastic#187899)\n\n## Summary\r\n\r\nAddresses
elastic#186411. This PR\r\nintroduces
quoted index names when auto populated/suggested if the index\r\nname
contains special
characters.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/43350163/94a37a82-9921-4419-b7d4-c8c50cc509f3\r\n\r\nIf
user is already prefixing index name with a quote, e.g. `from \"a`
it\r\nwill suggest as normal.\r\n\r\n\r\n### Checklis\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [ ] Any text added
follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
Risk Matrix\r\n\r\nDelete this section if it is not applicable to this
PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other
developers to\r\nidentify risks that should be tested prior to the
change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider
some of the following examples\r\nand how they may potentially impact
the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
Multiple Spaces&mdash;unexpected behavior in non-default Kibana
Space.\r\n| Low | High | Integration tests will verify that all features
are still\r\nsupported in non-default Kibana Space and when user
switches between\r\nspaces. |\r\n| Multiple nodes&mdash;Elasticsearch
polling might have race conditions\r\nwhen multiple Kibana nodes are
polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so
executing them multiple times will not result\r\nin logical error, but
will degrade performance. To test for this case we\r\nadd plenty of unit
tests around this logic and document manual testing\r\nprocedure. |\r\n|
Code should gracefully handle cases when feature X or plugin Y
are\r\ndisabled. | Medium | High | Unit tests will verify that any
feature flag\r\nor plugin combination still results in our service
operational. |\r\n| [See more potential
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
|\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for
breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"27dc08bcc400a495622b21deb79fbf62c1a10d55"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187899","number":187899,"mergeCommit":{"message":"[ES|QL]
Automatically encapsulate index names with special chars with quotes
(elastic#187899)\n\n## Summary\r\n\r\nAddresses
elastic#186411. This PR\r\nintroduces
quoted index names when auto populated/suggested if the index\r\nname
contains special
characters.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/43350163/94a37a82-9921-4419-b7d4-c8c50cc509f3\r\n\r\nIf
user is already prefixing index name with a quote, e.g. `from \"a`
it\r\nwill suggest as normal.\r\n\r\n\r\n### Checklis\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [ ] Any text added
follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
Risk Matrix\r\n\r\nDelete this section if it is not applicable to this
PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other
developers to\r\nidentify risks that should be tested prior to the
change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider
some of the following examples\r\nand how they may potentially impact
the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
Multiple Spaces&mdash;unexpected behavior in non-default Kibana
Space.\r\n| Low | High | Integration tests will verify that all features
are still\r\nsupported in non-default Kibana Space and when user
switches between\r\nspaces. |\r\n| Multiple nodes&mdash;Elasticsearch
polling might have race conditions\r\nwhen multiple Kibana nodes are
polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so
executing them multiple times will not result\r\nin logical error, but
will degrade performance. To test for this case we\r\nadd plenty of unit
tests around this logic and document manual testing\r\nprocedure. |\r\n|
Code should gracefully handle cases when feature X or plugin Y
are\r\ndisabled. | Medium | High | Unit tests will verify that any
feature flag\r\nor plugin combination still results in our service
operational. |\r\n| [See more potential
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
|\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for
breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"27dc08bcc400a495622b21deb79fbf62c1a10d55"}}]}]
BACKPORT-->

Co-authored-by: Quynh Nguyen (Quinn) <[email protected]>
  • Loading branch information
kibanamachine and qn895 authored Jul 11, 2024
1 parent f405425 commit dd6a8ff
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,27 @@ const fields: Array<{ name: string; type: string; suggestedAs?: string }> = [
];

const indexes = ([] as Array<{ name: string; hidden: boolean; suggestedAs?: string }>).concat(
['a', 'index', 'otherIndex', '.secretIndex', 'my-index'].map((name) => ({
[
'a',
'index',
'otherIndex',
'.secretIndex',
'my-index',
'my-index$',
'my_index{}',
'my-index+1',
'synthetics-*',
].map((name) => ({
name,
hidden: name.startsWith('.'),
})),
['my-index[quoted]', 'my-index$', 'my_index{}'].map((name) => ({
name,
hidden: false,
suggestedAs: `\`${name}\``,
}))
['my-index[quoted]', 'my:index', 'my,index', 'logstash-{now/d{yyyy.MM.dd|+12:00}}'].map(
(name) => ({
name,
hidden: false,
suggestedAs: `"${name}"`,
})
)
);

const integrations: Integration[] = ['nginx', 'k8s'].map((name) => ({
Expand Down Expand Up @@ -368,8 +380,9 @@ describe('autocomplete', () => {
});

describe('from', () => {
const suggestedIndexes = indexes.filter(({ hidden }) => !hidden).map(({ name }) => name);

const suggestedIndexes = indexes
.filter(({ hidden }) => !hidden)
.map(({ name, suggestedAs }) => suggestedAs || name);
// Monaco will filter further down here
testSuggestions(
'f',
Expand Down Expand Up @@ -397,8 +410,7 @@ describe('autocomplete', () => {
const dataSources = indexes.concat(integrations);
const suggestedDataSources = dataSources
.filter(({ hidden }) => !hidden)
.map(({ name }) => name);

.map(({ name, suggestedAs }) => suggestedAs || name);
testSuggestions('from ', suggestedDataSources, '', [undefined, dataSources, undefined]);
testSuggestions('from a,', suggestedDataSources, '', [undefined, dataSources, undefined]);
testSuggestions('from *,', suggestedDataSources, '', [undefined, dataSources, undefined]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import {
getQueryForFields,
getSourcesFromCommands,
isAggFunctionUsedAlready,
removeQuoteForSuggestedSources,
} from './helper';
import { FunctionParameter } from '../definitions/types';

Expand Down Expand Up @@ -857,19 +858,28 @@ async function getExpressionSuggestionsByType(
suggestions.push(...(policies.length ? policies : [buildNoPoliciesAvailableDefinition()]));
} else {
const index = getSourcesFromCommands(commands, 'index');
const canRemoveQuote = isNewExpression && innerText.includes('"');

// This is going to be empty for simple indices, and not empty for integrations
if (index && index.text && index.text !== EDITOR_MARKER) {
const source = index.text.replace(EDITOR_MARKER, '');
const dataSource = await getDatastreamsForIntegration(source);

const newDefinitions = buildSourcesDefinitions(
dataSource?.dataStreams?.map(({ name }) => ({ name, isIntegration: false })) || []
);
suggestions.push(...newDefinitions);
suggestions.push(
...(canRemoveQuote ? removeQuoteForSuggestedSources(newDefinitions) : newDefinitions)
);
} else {
// FROM <suggest>
// @TODO: filter down the suggestions here based on other existing sources defined
const sourcesDefinitions = await getSources();
suggestions.push(...sourcesDefinitions);
suggestions.push(
...(canRemoveQuote
? removeQuoteForSuggestedSources(sourcesDefinitions)
: sourcesDefinitions)
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
CommandOptionsDefinition,
CommandModeDefinition,
} from '../definitions/types';
import { getCommandDefinition, shouldBeQuotedText } from '../shared/helpers';
import { shouldBeQuotedSource, getCommandDefinition, shouldBeQuotedText } from '../shared/helpers';
import { buildDocumentation, buildFunctionDocumentation } from './documentation_util';
import { DOUBLE_BACKTICK, SINGLE_TICK_REGEX } from '../shared/constants';

Expand All @@ -37,6 +37,13 @@ function getSafeInsertText(text: string, options: { dashSupported?: boolean } =
? `\`${text.replace(SINGLE_TICK_REGEX, DOUBLE_BACKTICK)}\``
: text;
}
export function getQuotedText(text: string) {
return text.startsWith(`"`) && text.endsWith(`"`) ? text : `"${text}"`;
}

function getSafeInsertSourceText(text: string) {
return shouldBeQuotedSource(text) ? getQuotedText(text) : text;
}

export function getSuggestionFunctionDefinition(fn: FunctionDefinition): SuggestionRawDefinition {
const fullSignatures = getFunctionSignatures(fn);
Expand Down Expand Up @@ -148,7 +155,7 @@ export const buildSourcesDefinitions = (
): SuggestionRawDefinition[] =>
sources.map(({ name, isIntegration, title }) => ({
label: title ?? name,
text: name,
text: getSafeInsertSourceText(name),
isSnippet: isIntegration,
...(isIntegration && { command: TRIGGER_SUGGESTION_COMMAND }),
kind: isIntegration ? 'Class' : 'Issue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
*/

import type { ESQLAstItem, ESQLCommand, ESQLFunction, ESQLSource } from '@kbn/esql-ast';
import { FunctionDefinition } from '../definitions/types';
import type { FunctionDefinition } from '../definitions/types';
import { getFunctionDefinition, isAssignment, isFunctionItem } from '../shared/helpers';
import type { SuggestionRawDefinition } from './types';

function extractFunctionArgs(args: ESQLAstItem[]): ESQLFunction[] {
return args.flatMap((arg) => (isAssignment(arg) ? arg.args[1] : arg)).filter(isFunctionItem);
Expand Down Expand Up @@ -71,3 +72,11 @@ export function getSourcesFromCommands(commands: ESQLCommand[], sourceType: 'ind

return sources.length === 1 ? sources[0] : undefined;
}

export function removeQuoteForSuggestedSources(suggestions: SuggestionRawDefinition[]) {
return suggestions.map((d) => ({
...d,
// "text" -> text
text: d.text.startsWith('"') && d.text.endsWith('"') ? d.text.slice(1, -1) : d.text,
}));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { shouldBeQuotedSource } from './helpers';

describe('shouldBeQuotedSource', () => {
it('does not have to be quoted for sources with acceptable characters @-+$', () => {
expect(shouldBeQuotedSource('foo')).toBe(false);
expect(shouldBeQuotedSource('123-test@foo_bar+baz1')).toBe(false);
expect(shouldBeQuotedSource('my-index*')).toBe(false);
expect(shouldBeQuotedSource('my-index$')).toBe(false);
expect(shouldBeQuotedSource('.my-index$')).toBe(false);
});
it(`should be quoted if containing any of special characters [:"=|,[\]/ \t\r\n]`, () => {
expect(shouldBeQuotedSource('foo\ttest')).toBe(true);
expect(shouldBeQuotedSource('foo\rtest')).toBe(true);
expect(shouldBeQuotedSource('foo\ntest')).toBe(true);
expect(shouldBeQuotedSource('foo:test=bar')).toBe(true);
expect(shouldBeQuotedSource('foo|test=bar')).toBe(true);
expect(shouldBeQuotedSource('foo[test]=bar')).toBe(true);
expect(shouldBeQuotedSource('foo/test=bar')).toBe(true);
expect(shouldBeQuotedSource('foo test=bar')).toBe(true);
expect(shouldBeQuotedSource('foo,test-*,abc')).toBe(true);
expect(shouldBeQuotedSource('foo, test-*, abc, xyz')).toBe(true);
expect(shouldBeQuotedSource('foo, test-*, abc, xyz,test123')).toBe(true);
expect(shouldBeQuotedSource('foo,test,xyz')).toBe(true);
expect(
shouldBeQuotedSource('<logstash-{now/M{yyyy.MM}}>,<logstash-{now/d{yyyy.MM.dd|+12:00}}>')
).toBe(true);
expect(shouldBeQuotedSource('`backtick`,``multiple`back``ticks```')).toBe(true);
expect(shouldBeQuotedSource('test,metadata,metaata,.metadata')).toBe(true);
expect(shouldBeQuotedSource('cluster:index')).toBe(true);
expect(shouldBeQuotedSource('cluster:index|pattern')).toBe(true);
expect(shouldBeQuotedSource('cluster:.index')).toBe(true);
expect(shouldBeQuotedSource('cluster*:index*')).toBe(true);
expect(shouldBeQuotedSource('cluster*:*')).toBe(true);
expect(shouldBeQuotedSource('*:index*')).toBe(true);
expect(shouldBeQuotedSource('*:index|pattern')).toBe(true);
expect(shouldBeQuotedSource('*:*')).toBe(true);
expect(shouldBeQuotedSource('*:*,cluster*:index|pattern,i|p')).toBe(true);
expect(shouldBeQuotedSource('index-[dd-mm]')).toBe(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ export function isRestartingExpression(text: string) {
return getLastCharFromTrimmed(text) === ',';
}

export function shouldBeQuotedSource(text: string) {
// Based on lexer `fragment UNQUOTED_SOURCE_PART`
return /[:"=|,[\]\/ \t\r\n]/.test(text);
}
export function shouldBeQuotedText(
text: string,
{ dashSupported }: { dashSupported?: boolean } = {}
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-monaco/src/esql/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ export const ESQLLang: CustomLangModuleType<ESQLCallbacks> = {
{ open: '(', close: ')' },
{ open: '[', close: ']' },
{ open: `'`, close: `'` },
{ open: '"""', close: '"""' },
{ open: '"', close: '"' },
],
surroundingPairs: [
{ open: '(', close: ')' },
{ open: `'`, close: `'` },
{ open: '"""', close: '"""' },
{ open: '"', close: '"' },
],
},
Expand Down

0 comments on commit dd6a8ff

Please sign in to comment.