Skip to content

Conversation

@rickardsjp
Copy link
Contributor

The implementation uses context-aware detection to provide relevant completions based on query position, and handles incomplete/malformed syntax gracefully. Tests are included to cover the new completion scenarios.

Description

This is a follow-up PR to #496. That PR added autocompletion, but mistakenly only for log stream selectors.

This PR extends autocompletion to support more LogQL:

  • Line filter operators (|=, !=, |~, !~) after stream selectors
  • Parser functions (json, logfmt, pattern, regexp, unpack, unwrap)
  • Formatting functions

This PR also contains some refactoring to separate label completion and pipe completion into their own functions and helpers. Finally, the PR also adds tests for the completion.

The testing instructions are the same as in #496.

Screenshots

image

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

Previously, autocompletion only worked within log stream selectors. LogQL
supports additional pipeline expressions after the stream selector,
including line filters (|=, !=, |~, !~) and parser functions (json, logfmt,
pattern, regexp, unpack, unwrap).

This commit adds context-aware completions for:
- Line filter operators after stream selectors
- Parser and formatting functions

The completion detection is split into detectLabelCompletion() and
detectPipeCompletion(). ERROR_NODE cases are handled to provide
completions even when syntax is incomplete or malformed.

Signed-off-by: Jeremy Rickards <[email protected]>
@rickardsjp rickardsjp requested a review from a team as a code owner January 16, 2026 14:56
@rickardsjp rickardsjp requested review from jgbernalp and removed request for a team January 16, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant