Skip to content
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

Loki: Fix Autocomplete in stream selector overwriting existing label names, or inserting autocomplete result within label value #76485

Conversation

gtk-grafana
Copy link
Contributor

@gtk-grafana gtk-grafana commented Oct 12, 2023

What is this feature?
PoC:
Changing the wordPattern monaco uses to identify words which we used to calculate the monaco range.
This allows us to somewhat dynamically calculate range passed into monaco to prevent overwriting adjacent label names, or portions of label values surrounding the users cursor.

Why do we need this feature?
Makes writing queries easier, fixes code UX papercuts.

Who is this feature for?
Loki users

Which issue(s) does this PR fix?:
Fixes #75820

Special notes for your reviewer:
Child PR of #75925

Created this PR after I accidentally pinged every reviewer (by merging main into this branch instead of the parent)
#76080

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

…ing the word pattern to include label value separator (=), include valid sting chars (-), and value wrapper ("), adding some more logic in the range calculation to prevent autocomplete results from partially overwriting adjacent label names or portions of the current label value
…ls' into gtk-grafana/logs/issues/75925/auto-complete-fixes
…ls' into gtk-grafana/logs/issues/75925/auto-complete-fixes
@github-actions
Copy link
Contributor

Backend code coverage report for PR #76485
No changes

@github-actions
Copy link
Contributor

Frontend code coverage report for PR #76485

Plugin Main PR Difference
loki 86.25% 86.3% .05%

@matyax
Copy link
Contributor

matyax commented Oct 13, 2023

It looks like it requires quotes to trigger the value autocompletes. Would it be possible to trigger it after the equal?

Quotes.mov

@gtk-grafana
Copy link
Contributor Author

@matyax Yeah it shouldn't be too hard. I created another issue to track that here: #76537.

@matyax
Copy link
Contributor

matyax commented Oct 13, 2023

Fantastic, thanks!

Copy link
Contributor

@matyax matyax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@gtk-grafana gtk-grafana marked this pull request as ready for review October 13, 2023 12:26
@gtk-grafana gtk-grafana requested a review from a team as a code owner October 13, 2023 12:26
@gtk-grafana gtk-grafana merged commit c4187d2 into gtk-grafana/logs/issues/75820/autocomplete-between-labels Oct 13, 2023
28 of 29 checks passed
@gtk-grafana gtk-grafana deleted the gtk-grafana/logs/issues/75925/auto-complete-fixes branch October 13, 2023 12:27
gtk-grafana added a commit that referenced this pull request Oct 13, 2023
…ore or between other labels (#75925)

* Fix issue getting current labels that would only grab values to the left of the cursor

* Loki: Fix Autocomplete in stream selector overwriting existing label names, or inserting autocomplete result within label value (#76485)

* Better autocomplete functionality in loki, changing the word pattern to include label value separator (=), include valid sting chars (-), and value wrapper ("), adding some more logic in the range calculation to prevent autocomplete results from partially overwriting adjacent label names or portions of the current label value
@zerok zerok modified the milestones: 10.2.x, 10.2.0 Oct 23, 2023
darrenjaneczek pushed a commit that referenced this pull request Oct 23, 2023
…ore or between other labels (#75925)

* Fix issue getting current labels that would only grab values to the left of the cursor

* Loki: Fix Autocomplete in stream selector overwriting existing label names, or inserting autocomplete result within label value (#76485)

* Better autocomplete functionality in loki, changing the word pattern to include label value separator (=), include valid sting chars (-), and value wrapper ("), adding some more logic in the range calculation to prevent autocomplete results from partially overwriting adjacent label names or portions of the current label value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants