Skip to content

fix: Improve auto-complete behavior for aliases and maps#1987

Merged
kodiakhq[bot] merged 3 commits intomainfrom
drew/fix-auto-complete-wonkiness
Mar 25, 2026
Merged

fix: Improve auto-complete behavior for aliases and maps#1987
kodiakhq[bot] merged 3 commits intomainfrom
drew/fix-auto-complete-wonkiness

Conversation

@pulpdrew
Copy link
Copy Markdown
Contributor

Summary

This PR improves auto-complete in the following ways

  1. Auto-complete suggestions will not appear after AS, since it is assumed that a user will not want to type an existing column or function name as a column alias
  2. Accepting an auto-complete suggestion will replace characters after the cursor if they match the accepted suggestion. This is nice when, for example, I have typed ResourceAttributes[] and my cursor is before the ] - accepting a suggestion will now replace the trailing ] instead of leaving it be (in which case it would be duplicated after inserting the suggestion).

Screenshots or video

Screen.Recording.2026-03-25.at.9.06.55.AM.mov

How to test locally or on Vercel

This can be tested in the preview environment.

References

  • Linear Issue: Closes HDX-2612
  • Related PRs:

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Mar 25, 2026 5:40pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: f201673

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pulpdrew pulpdrew changed the title Drew/fix auto complete wonkiness fix: Improve auto-complete behavior for aliases and maps Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Knip - Unused Code Analysis

🔴 +2 change in total issues (231 on main → 233 on PR)

Category main PR Diff
Unused dependencies 14 14 0
Unused devDependencies 20 20 0
Unlisted dependencies 14 16 +2 🔴
Unresolved imports 2 2 0
Unlisted binaries 2 2 0
Unused exports 132 132 0
Unused exported types 41 41 0
Unused enum members 2 2 0
Duplicate exports 4 4 0
Details

Unlisted dependencies

  • 🔴 packages/app/src/components/SQLEditor/__tests__/utils.test.ts:@codemirror/autocomplete
  • 🔴 packages/app/src/components/SQLEditor/__tests__/utils.test.ts:@codemirror/state
What is this?

Knip finds unused files, dependencies, and exports in your codebase.
This comment compares the PR branch against main to detect regressions.

Run yarn knip locally to see full details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

PR Review

✅ No critical issues found.

A few minor observations (non-blocking):

  • IDENTIFIER_CHAR regex [\w.'[\]${}:] includes an unescaped [ inside the character class — this is technically valid JS regex but could confuse linters or future readers. Consider escaping it as \[.
  • getReplacementRange in tests uses result.to ?? pos as a fallback, but to is always set in the implementation — harmless but slightly misleading.

The logic is correct, well-scoped, and the test coverage for AS suppression and mid-identifier replacement range is solid. Safe to merge.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

E2E Test Results

All tests passed • 93 passed • 3 skipped • 952s

Status Count
✅ Passed 93
❌ Failed 0
⚠️ Flaky 2
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew pulpdrew force-pushed the drew/fix-auto-complete-wonkiness branch from 091c0aa to 5b2411a Compare March 25, 2026 13:24
@pulpdrew pulpdrew requested review from a team and teeohhem and removed request for a team March 25, 2026 13:33
Copy link
Copy Markdown
Contributor

@teeohhem teeohhem left a comment

Choose a reason for hiding this comment

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

Very slick. Confirmed working on my end

@kodiakhq kodiakhq bot merged commit 1fb8e35 into main Mar 25, 2026
15 checks passed
@kodiakhq kodiakhq bot deleted the drew/fix-auto-complete-wonkiness branch March 25, 2026 17:41
knudtty pushed a commit that referenced this pull request Apr 16, 2026
## Summary

This PR improves auto-complete in the following ways

1. Auto-complete suggestions will not appear after `AS`, since it is assumed that a user will not want to type an existing column or function name as a column alias
2. Accepting an auto-complete suggestion will replace characters after the cursor if they match the accepted suggestion. This is nice when, for example, I have typed `ResourceAttributes[]` and my cursor is before the `]` - accepting a suggestion will now replace the trailing `]` instead of leaving it be (in which case it would be duplicated after inserting the suggestion).

### Screenshots or video

https://github.com/user-attachments/assets/9577393c-6bfa-410b-b5ba-2ba6b00bc26b

### How to test locally or on Vercel

This can be tested in the preview environment.

### References



- Linear Issue: Closes HDX-2612
- Related PRs:
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.

2 participants