-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Console] Fix wrong autosugest type #189496
[Console] Fix wrong autosugest type #189496
Conversation
/ci |
💚 Build Succeeded
Metrics [docs]Async chunks
To update your PR or re-run it, just comment with: cc @sabarasaba |
Pinging @elastic/kibana-management (Team:Kibana Management) |
@@ -356,7 +356,7 @@ export class MonacoEditorActionsProvider { | |||
}); | |||
const lineTokens = getLineTokens(lineContent); | |||
// if there is 1 or fewer tokens, suggest method | |||
if (lineTokens.length <= 1) { | |||
if (lineTokens.length <= 1 && !shouldTriggerSuggestions(lineContent)) { |
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.
I think the helper function shouldTriggerSuggestions
is a bit confusing here, it is used to check the line content if the suggestions should be triggered manually after a specific keybord event, for example backspace, as opposed to the automatic suggestions after "trigger characters".
The function getAutocompleteType
here is used when the suggestions are triggered (automatic or manually) to decide for which of 4 item types to look for suggestions.
For this case I would recommend creating a separate helper or a reg ex, probably one to check that the line is either empty or have a character like g
or p
or maybe allow letters/numbers but not punctuation.
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.
Thanks a lot for fixing this bug, @sabarasaba!
I left a comment in the code about creating a separate check for this case, wdyt?
Fixes https://github.com//elastic/kibana/issues/186767
Summary
Fix wrongly returned method type for autosuggest method when unvalid line is passed
Steps to reproduce:
"
(a double quote) at a blank line.