Skip to content

language_selector: Auto-select current language when opening#48475

Merged
SomeoneToIgnore merged 4 commits intozed-industries:mainfrom
cppcoffee:language_selector_index
Feb 26, 2026
Merged

language_selector: Auto-select current language when opening#48475
SomeoneToIgnore merged 4 commits intozed-industries:mainfrom
cppcoffee:language_selector_index

Conversation

@cppcoffee
Copy link
Copy Markdown
Contributor

Release Notes:

  • Added Auto-select current language when opening language selector

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 5, 2026
@cppcoffee
Copy link
Copy Markdown
Contributor Author

cppcoffee commented Feb 5, 2026

Before:

2026-02-05.21.02.07.mov

After:

2026-02-05.20.59.11.mov

When opening the language selector with an empty query, automatically
select and scroll to the buffer's current language instead of defaulting
to the first item in the list.

Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Looks like a nice improvement, thank you.

Can we have a test for this one to ensure this does not break in the future?
I think we could create a FakeFS project with 2 files of a different language + an empty buffer (so, 3 different files in general), and we can open the language modal on each such file to assert what's selected.

@SomeoneToIgnore SomeoneToIgnore self-assigned this Feb 24, 2026
@cppcoffee
Copy link
Copy Markdown
Contributor Author

Hi @SomeoneToIgnore , The test unit has been added. Please review it.

Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Thank you a lot!

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

Hm, I think the new right way to do things is via MultiWorkspace::test_new and that what should be used in the new test?

Otherwise, as soon as the tests start to pass, happy to merge this.

@cppcoffee cppcoffee force-pushed the language_selector_index branch from e45c041 to 98c8382 Compare February 26, 2026 13:20
@cppcoffee cppcoffee force-pushed the language_selector_index branch from 788f575 to 28b882b Compare February 26, 2026 13:28
@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) February 26, 2026 13:43
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
auto-merge was automatically disabled February 26, 2026 14:03

Head branch was pushed to by a user without write access

@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) February 26, 2026 15:09
@SomeoneToIgnore SomeoneToIgnore merged commit 8b2829e into zed-industries:main Feb 26, 2026
27 checks passed
@cppcoffee cppcoffee deleted the language_selector_index branch February 27, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants