Jason Lee
4ded78ed30
dock: Refactor Panel trait to has &mut self and &mut Context<Self>. ( #1716 )
...
Continue #1712 , #1713
## Description
Also change the `Panel` trait to has `&mut self` and `&mut
Context<Self>`.
## Break Changes
The methods `title`, `title_prefix`, `set_zoomed`, `set_active`,
`dropdown_menu`, `toolbar_buttons`, `on_added_to`, `on_removed` has
changed `&self` to `&mut self`, and `cx: &App` to `cx: &mut
Context<Self>`.
```diff
- fn title(&self, window: &Window, cx: &App) -> AnyElement
+ fn title(&mut self, window: &Window, cx: &mut Context<Self>) -> AnyElement
```
2025-12-01 17:57:18 +08:00
Jason Lee
4e0f9af789
story: Use uniform_list for scroll example. ( #1709 )
...
Ref #1621
Update scrollable story to use `UniformList` to avoid performance issue
in story.
And also renamed it to `ScrollbarStory`.
2025-12-01 11:07:29 +08:00
Andreas Johansson
7e479aa7f2
input: Add to support CodeEditor as single line mode. ( #1696 )
...
## Screenshot
From `input_story`:
<img width="1069" height="122" alt="Screenshot From 2025-11-28 09-14-03"
src="https://github.com/user-attachments/assets/f14ef2fc-4939-4ceb-be3e-bede492f8602 "
/>
## Breaking Changes
- `.multi_line()` was changed to `.multi_line(bool)`.
- Removed pub `InputMode`, this should only for internal.
```diff
InputState::new(window, cx)
- .multi_line()
+ .multi_line(true)
```
## Checklist
- [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and
followed the guidelines.
- [x] Reviewed the changes in this PR and confirmed AI generated code
(If any) is accurate.
- [x] Passed `cargo run` for story tests related to the changes.
- [ ] Tested macOS, Windows and Linux platforms performance (if the
change is platform-specific)
Use cases,
1) In my API client, I have a tree sitter language for the URL input,
<img width="1001" height="162" alt="Image"
src="https://github.com/user-attachments/assets/9771decf-b0b7-4230-8ed6-784a95b72af1 "
/>
2) In my SQL editor I want to be able to allow JSON syntax highlighting
for inline editing of json columns,
<img width="501" height="130" alt="Image"
src="https://github.com/user-attachments/assets/f0f879cc-841f-49d2-a23a-2effc3747f38 "
/>
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-11-28 19:51:40 +08:00
Jason Lee
c8652f9010
setting: Add Settings component. ( #1632 )
...
https://github.com/user-attachments/assets/3c6315d9-1183-419c-bb17-a8f7ac0cf25c
2025-11-20 13:51:44 +00:00
Jason Lee
6c4de54fa4
theme: Use font_family for all elements. ( #1618 )
...
Close #1613
- And add `mono_font_family` and `mono_font_size` for code editor.
2025-11-17 03:18:17 +00:00
Jason Lee
37d1678b6f
assets: Add gpui-component-assets crate. ( #1601 )
2025-11-14 15:03:26 +08:00
Jason Lee
724ccd64a7
chore: Add ui folder to Cargo default-members. ( #1600 )
...
This to help `cargo test` default will test `ui` and `story`.
2025-11-14 06:16:03 +00:00
Jason Lee
69b21142dc
root: Improve new method argument to use into <AnyView>. ( #1594 )
2025-11-14 11:02:44 +08:00
Jason Lee
a176408d81
Revert "root: Render overlays inside Root element by default. ( #1570 )" ( #1584 )
...
Revert #1573 , #1570
2025-11-13 13:37:05 +08:00
Jason Lee
cbd4346b87
root: Impl Styled for Root. ( #1573 )
2025-11-12 17:57:15 +08:00
Jason Lee
f26f01909e
root: Render overlays inside Root element by default. ( #1570 )
...
## Break Change
- The `Root::render_notification_layer`, `Root::render_sheet_layer`,
`Root::render_dialog_layer` has been removed, we don't need it now, the
Root element has default rendered them.
2025-11-12 08:04:54 +00:00
ihavecoke
1a5dd46acd
tiles: Add to support panel auto-snap while drag movement ( #1552 )
...
Before:
https://github.com/user-attachments/assets/b9171a47-e21b-4132-8b13-7d9bf06f083a
After:
https://github.com/user-attachments/assets/e06c8353-41f8-4124-b9f4-1c44e462ab72
2025-11-11 11:56:58 +08:00
Jason Lee
945db0be56
dialog: Rename Modal to Dialog. ( #1538 )
...
## Break Change
- Renamed `Modal` to `Dialog`.
```diff
- window.open_modal(...)
+ window.open_dialog(...)
- window.close_modal(...);
+ window.close_dialog(...);
```
- Renamed `show_close` method to `close_button` in Dialog.
```diff
- .show_close(false)
+ .close_button(true)
```
2025-11-07 17:25:55 +08:00
Jason Lee
80689264e2
sheet: Rename Drawer to Sheet. ( #1527 )
...
## Break Change
- Renamed `Drawer` to `Sheet`, also renamed relative method contains
`drawer` to `sheet`.
- Renamed `ContextModal` to `WindowExt`.
```diff
- use gpui_component::drawer::Drawer
+ use gpui_component::sheet::Sheet
- use gpui_component::ContextModal
+ use gpui_component::WindowExt
```
2025-11-06 07:19:10 +00:00
Jason Lee
4b3fb51fb8
editor: Fix indent guides render position. ( #1524 )
2025-11-05 13:17:32 +00:00
Jason Lee
998a5fd922
chore: Standardize the overall API and improve docs. ( #1516 )
2025-11-05 19:10:30 +08:00
ihavecoke
fbaddbe9e3
tiles: Add scrollbar_show option to Tiles ( #1496 )
2025-11-04 17:42:46 +08:00
Jason Lee
e75c37a1ac
chore: Update List, Tree, Kbd exports. ( #1467 )
...
## Break Change
- Removed `Kbd` from root export, use `gpui_component::kbd::Kbd`
instead.
- Removed `List` from root export, use `gpui_component::list::*`
instead.
- Removed `Tree` from root export, use `gpui_component::tree:*` instead.
2025-10-30 07:19:39 +00:00
Jason Lee
2727a65494
resizable: Simplify Resizable API. ( #1459 )
...
- Added `on_resize` callback method to `ResizabelPanelGroup`.
## Break Changes
- Remove `state` argument from `h_resizable`, `v_resizable` method.
```diff
- v_resizable("resizable-1", state)
+ v_resizable("resizable-1")
```
- Removed `group` method from `ResizabelPanelGroup`, use `child`
instead.
```diff
- v_resizable(..).group(..)
+ v_resizable(..).child(..)
```
2025-10-29 23:01:05 +08:00
Jason Lee
a1ca8624af
example: Add file tree to Editor example. ( #1457 )
...
<img width="1205" height="861" alt="image"
src="https://github.com/user-attachments/assets/4b3814cd-7dc0-4fc1-8f0f-d98d7cc29294 "
/>
2025-10-29 12:58:40 +00:00
Jason Lee
34ef0ff6d0
chore: Rename Dropdown to Select, TextInput to Input. ( #1449 )
...
## Break Change
- The `Dropdown` has been renamed to `Select`.
- The `TextInput` has been renamed to `Input`.
| Before | After |
| --- | --- |
| TextInput | Input |
| Dropdown | Select |
| DropdownItem | SelectItem |
| DropdownItemGroup | SelectGroup |
| DropdownState | SelectState |
| DropdownEvent | SelectEvent |
| DropdownDelegate | SelectDelegate |
| dropdown::ListEvent | ~~Removed~~ |
- Renamed `PopupMenuExt` to `DropdownMenu`.
- Removed pub mod `menu::popup_menu`, `menu::context_menu`, they are
moved into `menu` mod.
- Renamed `popup_menu` method to `dropdown_menu` for `DropdownMenu`,
`Panel`, `PanelView` and `DropdownButton`.
| Before | After |
| --- | --- |
| popup_menu::PopupMenuExt | menu::DropdownMenu |
| popup_menu | dropdown_menu |
| popup_menu_with_anchor | dropdown_menu_with_anchor |
2025-10-28 21:22:31 +08:00
Jason Lee
cc0f936348
tiles: Add tile_radius theme option and default 0px. ( #1441 )
2025-10-28 02:54:41 +00:00
Jason Lee
6ebb9418a0
editor: Use measure_indent_width for indent guides width. ( #1428 )
...
Continue #1426 , this changes I was forgotten to push before #1426
merged.
2025-10-24 20:18:30 +08:00
Jason Lee
178269be63
editor: Add indent guides. ( #1426 )
...
<img width="1070" height="1006" alt="image"
src="https://github.com/user-attachments/assets/a456b055-b45f-45ae-84b0-452a952cc19c "
/>
2025-10-24 19:03:09 +08:00
han
1bc5ff03df
story: Add interactive brush drawing canvas ( #1370 )
...
<img width="2175" height="1358" alt="image"
src="https://github.com/user-attachments/assets/41716d72-655f-440a-ac9e-cdb91e1b4417 "
/>
---------
Co-authored-by: hl <hl@nmcsoft.com>
2025-10-15 15:27:59 +08:00
Jason Lee
5b2fed0ccb
markdown: Use list for Markdown render and add scrollbar. ( #1357 )
2025-10-13 22:06:07 +08:00
Jason Lee
2574e7f812
story: Add open file to Markdown and Editor example. ( #1363 )
...
Close #1352
2025-10-13 11:52:16 +08:00
Sunli
8a63fd67ab
chore: Fix webview example ( #1360 )
2025-10-13 10:10:35 +08:00
Jason Lee
6817c8d3cc
menu: Add AppMenuBar. ( #1338 )
...
- input: Change Input to not unselect when blur.
- popup_menu: Fix get key binding on PopupMenu with action context.
<img width="935" height="694" alt="image"
src="https://github.com/user-attachments/assets/295fa84e-f1d8-4f6f-8a77-601a45f8ad6d "
/>
## TODO
- [x] Keyboard support.
- [x] Add submenu to example.
- [ ] ~~Icon~~ and check support. Wait
https://github.com/zed-industries/zed/pull/39876
2025-10-10 21:03:16 +08:00
Jason Lee
d0396d779e
editor: Add document_colors LSP. ( #1329 )
2025-10-06 18:08:12 +08:00
Jason Lee
cfd060b66d
editor: Split Input and Editor background color. ( #1323 )
...
Keep input to use window background color, the `editor.background` only
for Editor mode.
2025-10-03 11:20:01 +08:00
Jason Lee
935cd93f5a
chore: Fix rust logo URL in test.md.
2025-09-30 16:29:56 +08:00
Sunli
34b570cd8f
text_view: Refactor TextView, SyntaxHighlighter to use async to parsing. ( #1299 )
...
1. Parse content in the background thread
2. Remove unnecessary clones
3. `TextViewStyle` and `LanguageRegistry` can now be used across threads
2025-09-29 14:04:24 +08:00
Jason Lee
13e2b08873
editor: Improve line number width by max lines. ( #1291 )
2025-09-25 22:21:09 +08:00
Jason Lee
1c3eca93b8
editor: Revert to use ropey. ( #1284 )
...
For the License reason.
- The performance is slow down, before version can handle 200K lines,
now 150K lines is good.
2025-09-24 20:52:18 +08:00
Jason Lee
bd3bffaf67
editor: Fix completion width align to longest item. ( #1281 )
2025-09-24 11:43:59 +08:00
Jason Lee
993ce34bd8
editor: Avoid scroll on select all. ( #1277 )
...
- Add `replace_text_in_range_silent` for some case to avoid show
completion, for example on cut, paster ...
- Improve to only call validation, mask on single line mode.
- Improve move cursor to scroll to visible to keep edge 3 lines.
https://github.com/user-attachments/assets/ca8bcca8-a55b-4c98-af7c-7639d1c34923
- Fix `RopeExt::offset_to_position` may crash.
- Add deffered_scroll_offset to improve paste to scroll to cursor.
https://github.com/user-attachments/assets/1af09a50-37f0-47c8-8185-4b78820d064a
2025-09-23 15:59:48 +08:00
Jason Lee
f93e9a9475
editor: Change to pass cursor as offset for completions method. ( #1271 )
...
And to support `filter_text` as completion item highlight match.
2025-09-22 16:29:51 +08:00
Jason Lee
62748aad9b
editor: Update CompletionProvider return type. ( #1270 )
2025-09-22 14:31:21 +08:00
Jason Lee
aa0f6d6222
editor: Improve range_to_utf16 and range_from_utf16 by use Rope. ( #1268 )
...
Now, we can work on 200K lines (editing).
--------
Now, all cost are on tree-sitter parse.
<img width="1091" height="672" alt="image"
src="https://github.com/user-attachments/assets/b111bc58-1334-40b2-9920-7006ad86bb3c "
/>
2025-09-22 14:07:30 +08:00
Jason Lee
692057f799
editor: Update completions to support CompletionTextEdit. ( #1267 )
...
- Fix completion menu width to longest item.
2025-09-22 11:39:50 +08:00
Jason Lee
5e7a2cb37f
editor: Add DefinitionProvider. ( #1261 )
...
https://github.com/user-attachments/assets/f8234a3f-3075-48ce-ae46-8ea869b6a13d
- Hold `cmd` to hover on a word to trigger definition check.
2025-09-19 13:49:24 +08:00
Jason Lee
6a817d6a05
editor: Add to support HoverPopover. ( #1260 )
...
<img width="725" height="631" alt="image"
src="https://github.com/user-attachments/assets/0f4aba90-82cc-43c8-916b-b4a446b8abae "
/>
2025-09-18 18:18:54 +08:00
Jason Lee
a942c57627
editor: Refactor the LSP config.
2025-09-18 14:17:18 +08:00
Jason Lee
3fe9bc8de0
example: Fix lint performance in CodeEditor example. ( #1259 )
...
Move AutoCorrect lint to background.
2025-09-18 11:25:53 +08:00
Jason Lee
8a3ef51ea1
input: Add to support search and replace. ( #1252 )
...
<img width="806" height="765" alt="image"
src="https://github.com/user-attachments/assets/5e2a7144-f814-4874-b9c1-89ebf5d942ec "
/>
- Close #1212 to support search for Input.
- Fix #1235 to support scroll to cursor when go to line.
2025-09-17 19:02:00 +08:00
Jason Lee
e01b139995
input: Fix completions API to assign Rope.
2025-09-17 14:37:21 +08:00
Jason Lee
35568124bf
editor: Improve CodeEditor inset and line number width. ( #1255 )
...
<img width="756" height="580" alt="image"
src="https://github.com/user-attachments/assets/5748e7b3-74de-417a-856f-5db05c66f892 "
/>
2025-09-16 21:50:09 +08:00
Jason Lee
f1b6d7c5ed
editor: Add completion, code_action provider. ( #1242 )
2025-09-15 19:25:02 +08:00
Jason Lee
da85754b96
input: Refactor diagnostics. ( #1240 )
...
<img width="613" height="530" alt="image"
src="https://github.com/user-attachments/assets/be86658d-706c-411c-8ba6-09b495208051 "
/>
## Break Changes
- The `Markers` has been renamed to use `Diagnostics`.
- The `input::LineNumber` has renamed to `input::Position` and changed
from 1-based to use 0-based.
- Renamed `go_to_line` to `set_cursor_position`, `line_column` to
`cursor_position`.
```diff
- pub fn line_column(&self) -> LineColumn
+ pub fn cursor_position(&self) -> Position
- pub fn go_to_line(&mut self, line: usize, column: Option<usize>, window: &mut Window, cx: &mut Context<Self>)
+ pub fn set_cursor_position(&mut self, position: impl Into<Position>, window: &mut Window, cx: &mut Context<Self>)
```
2025-09-11 16:54:40 +08:00