mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `9.0`: - [[ES|QL] Fixes the comment autocomplete when there is a space (#214696)](https://github.com/elastic/kibana/pull/214696) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Stratoula Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2025-03-17T13:07:09Z","message":"[ES|QL] Fixes the comment autocomplete when there is a space (#214696)\n\n## Summary\n\nFixes the problem with autocomplete been triggered in comments\n\n**Before**\n\n\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"685ab6cbc715d19e0275218988814952be86433a","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Feature:ES|QL","Team:ESQL","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[ES|QL] Fixes the comment autocomplete when there is a space","number":214696,"url":"https://github.com/elastic/kibana/pull/214696","mergeCommit":{"message":"[ES|QL] Fixes the comment autocomplete when there is a space (#214696)\n\n## Summary\n\nFixes the problem with autocomplete been triggered in comments\n\n**Before**\n\n\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"685ab6cbc715d19e0275218988814952be86433a"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214696","number":214696,"mergeCommit":{"message":"[ES|QL] Fixes the comment autocomplete when there is a space (#214696)\n\n## Summary\n\nFixes the problem with autocomplete been triggered in comments\n\n**Before**\n\n\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"685ab6cbc715d19e0275218988814952be86433a"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
parent
266bcefdc9
commit
c129ade30c
2 changed files with 3 additions and 2 deletions
|
@ -13,6 +13,7 @@ describe('suggestions in comments', () => {
|
|||
it('does not suggest in single-line comments', async () => {
|
||||
const { assertSuggestions } = await setup('^');
|
||||
await assertSuggestions('FROM index | EVAL // hey there ^', []);
|
||||
await assertSuggestions('FROM index // I^', [], { triggerCharacter: ' ' });
|
||||
});
|
||||
|
||||
it('does not suggest in multi-line comments', async () => {
|
||||
|
@ -29,7 +30,7 @@ describe('suggestions in comments', () => {
|
|||
test('suggests next to comments', async () => {
|
||||
const { suggest } = await setup('^');
|
||||
expect((await suggest('FROM index | EVAL ^/* */')).length).toBeGreaterThan(0);
|
||||
expect((await suggest('FROM index | EVAL /* */^')).length).toBeGreaterThan(0);
|
||||
expect((await suggest('FROM index | EVAL /* */ ^')).length).toBeGreaterThan(0);
|
||||
expect((await suggest('FROM index | EVAL ^// a comment')).length).toBeGreaterThan(0);
|
||||
expect((await suggest('FROM index | EVAL // a comment\n^')).length).toBeGreaterThan(0);
|
||||
});
|
||||
|
|
|
@ -159,7 +159,7 @@ export function getAstContext(queryString: string, ast: ESQLAst, offset: number)
|
|||
let inComment = false;
|
||||
|
||||
Walker.visitComments(ast, (node) => {
|
||||
if (node.location && node.location.min <= offset && node.location.max > offset) {
|
||||
if (node.location && node.location.min <= offset && node.location.max >= offset) {
|
||||
inComment = true;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue