mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-22 00:20:23 +01:00
8eb2fd211f
## Problem Column filter dropdown options in `tabular_data_preview` were sorted with standard lexicographical comparison (`a.content.cmp(&b.content)`). This led to unnatural ordering for numbers and mixed alphanumeric values (e.g., `"item 10"` sorting before `"item 2"`). ## Solution Switched to `util::paths::natural_sort` based comparison: - Compares numeric segments by numerical value rather than lexicographically (e.g., `1`, `2`, `10` instead of `1`, `10`, `2`). - Performs case-insensitive comparison with case-sensitive tie-breaking. - Keeps `None`/null values sorted at the bottom of the filter list. ## Testing - Added unit tests in `table_header.rs` covering numeric runs, case insensitivity, and null value placement. - `cargo test -p tabular_data_preview` - `./script/clippy -p tabular_data_preview` clean. ## Showcase | Before | After | | --- | --- | | <img width="578" height="617" alt="image" src="https://github.com/user-attachments/assets/4d74a8d0-6364-4ef6-b659-d36350e02ea0" /> | <img width="621" height="615" alt="image" src="https://github.com/user-attachments/assets/dadd851a-5a7a-468d-803d-3e467104ae06" /> | ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [x] UI standards followed - [x] Tests cover the new/changed behavior - [x] Performance impact considered, acceptable Release Notes: - Improved column filter dropdown in tabular data preview to sort values naturally (e.g., `2` before `10`). --------- Co-authored-by: MrSubidubi <finn@zed.dev>
38 lines
794 B
TOML
38 lines
794 B
TOML
[package]
|
|
name = "tabular_data_preview"
|
|
version = "0.1.0"
|
|
publish.workspace = true
|
|
edition.workspace = true
|
|
|
|
[lib]
|
|
path = "src/tabular_data_preview.rs"
|
|
doctest = false
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
fuzzy.workspace = true
|
|
gpui.workspace = true
|
|
editor.workspace = true
|
|
picker.workspace = true
|
|
ui.workspace = true
|
|
workspace.workspace = true
|
|
log.workspace = true
|
|
indexmap.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
schemars.workspace = true
|
|
text.workspace = true
|
|
util.workspace = true
|
|
|
|
[dev-dependencies]
|
|
gpui = { workspace = true, features = ["test-support"] }
|
|
project = { workspace = true, features = ["test-support"] }
|
|
proptest.workspace = true
|
|
workspace = { workspace = true, features = ["test-support"] }
|
|
|
|
[features]
|
|
dev-tools = []
|
|
|
|
[lints]
|
|
workspace = true
|