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
Jason Lee
3fa996c331
input: Fix line column by use chars offset. ( #1239 )
...
- Add autocorrect to markdown example for test `markers`.
<img width="1104" height="590" alt="image"
src="https://github.com/user-attachments/assets/03103088-e828-4039-82b0-c816d5f36141 "
/>
2025-09-10 20:56:15 +08:00
Jason Lee
43c848893c
input: Refactor start_of_line, end_of_line by use Rope. ( #1232 )
...
- Removed `Cursor` struct, now use `usize` for selection offset.
2025-09-10 14:43:11 +08:00
Jason Lee
a9953a9349
input: Use zed's Rope ( #1214 )
...
Now with 10K lines plain text, in release mode on macOS. The
`large-text` example can work with:
- 120 FPS for display.
- 90 FPS for update text.
```
MTL_HUD_ENABLED=1 cargo run --example large-text --release
```
- Fixed the cursor position at end of line, also support at start of
line.
https://github.com/user-attachments/assets/1de52f6c-e138-4ed3-a600-06372a807ed8
### Check list
- [x] Modifying Text with Rope
- [x] LineColumn, GoToLine
- [x] Code Highlight
- [x] Delete word, select word
- [x] Delete line
- [x] Move left, right, up, down
2025-09-08 16:44:52 +08:00
Jason Lee
a9e6b49a15
highlighter: Fix #1204 changes cause to incorrect highlight result. ( #1218 )
...
This PR for fix some incorrect changes in #1204
## Before
<img width="854" height="864" alt="image"
src="https://github.com/user-attachments/assets/eebd07e5-3437-444d-a55d-2941228e3b08 "
/>
## After
<img width="954" height="962" alt="image"
src="https://github.com/user-attachments/assets/60761848-8d4f-4fe9-88b9-f0b0f0985d2f "
/>
<img width="1515" height="867" alt="image"
src="https://github.com/user-attachments/assets/3d4654a7-f977-4919-9c9e-f013fcdd8fde "
/>
2025-09-08 16:14:07 +08:00
Jason Lee
ee40f65fb5
markdown: Add to support LinkReference and Footnote. ( #1201 )
2025-09-03 16:39:17 +08:00
Jason Lee
6569bead8b
input: Fix horizontal scrolling offset. ( #1191 )
...
Continue #1131 to fix some scroll offset details.
- Keep line number at left.
- Show scrollbar next the line_numbers right side.
- Fix scroll_size calculate issue that will always show vertical
scrollbar, even not have enough contents.
<img width="888" height="641" alt="image"
src="https://github.com/user-attachments/assets/5d388377-3f6d-4530-b837-6c719e1eb48f "
/>
2025-09-02 14:46:28 +08:00
Jason Lee
74b3aa7e67
text_view: Add to support selection. ( #1169 )
...
### Links
Maybe we can do it in TextLayout in GPUI:
fda6eda3c2/crates/gpui/src/elements/text.rs (L309)
## Demo
https://github.com/user-attachments/assets/abbebee7-df8f-4067-86a7-15bc1a4c44cd
## Todo
- [x] Test for HTML View.
- [x] CodeBlock selection support.
- [x] Selection lines sometimes incorrect.
- [x] Listener Bounds changed to unselect.
2025-08-28 18:09:30 +08:00
Jason Lee
554082b969
text_view: Fix inline image render. ( #1166 )
...
GPUI does not support inline image into an `InteractiveText` yet. So
here, let it render into a block line.
<img width="1201" height="902" alt="image"
src="https://github.com/user-attachments/assets/797baeae-8764-417a-a907-e0d22956bf62 "
/>
<img width="1064" height="805" alt="image"
src="https://github.com/user-attachments/assets/a5ef7000-aa71-4c1b-8a82-2a0f36649fd6 "
/>
2025-08-21 16:30:58 +08:00
Jason Lee
6ae7558c44
theme: Add ThemeRegistry to load and watch themes dir. ( #1148 )
2025-08-18 19:29:27 +08:00
Jason Lee
63f61dca04
chore: Avoid built-in tree-sitter languages in default. ( #1135 )
...
With a `tree-sitter-languages` feature to enable it (Default not
enable).
Changed this for reduce the application size (From 52 MB to 22MB), Ref
#1132
Now default only includes `tree-sitter-json`, if you want more:
```toml
[dependencies]
gpui-component = { features = ["tree-sitter-languages"] }
```
---
```
cargo bloat -p hello_world --release -n 10
Finished `release` profile [optimized] target(s) in 0.27s
Analyzing target/release/hello_world
File .text Size Crate Name
0.4% 1.4% 88.5KiB simple_minify_html simple_minify_html::code_gen::attrs::ATTRS::{{closure}}
0.3% 1.0% 62.1KiB taffy taffy::compute::grid::track_sizing::resolve_intrinsic_track_sizes
0.1% 0.5% 32.6KiB gpui_component gpui_component::theme::theme_color::ThemeColor::dark
0.1% 0.5% 30.0KiB gpui_component gpui_component::theme::theme_color::ThemeColor::light
0.1% 0.5% 29.9KiB html5ever html5ever::tree_builder::TreeBuilder<Handle,Sink>::step
0.1% 0.4% 27.2KiB gpui taffy::compute::flexbox::compute_flexbox_layout
0.1% 0.4% 23.3KiB usvg usvg::text::layout::layout_text
0.1% 0.4% 22.5KiB resvg resvg::filter::apply_inner
0.1% 0.3% 21.4KiB gpui jpeg_decoder::decoder::Decoder<R>::decode_internal
0.1% 0.3% 21.2KiB image_webp image_webp::lossless::LosslessDecoder<R>::decode_image_stream
25.3% 94.3% 5.7MiB And 14091 smaller methods. Use -n N to show more.
26.8% 100.0% 6.0MiB .text section size, the file size is 22.4MiB
```
2025-08-14 18:02:27 +08:00
Jason Lee
c86b0222ce
example: Add a HelloWorld example. ( #1133 )
...
Ref #1132 to make a minimized app
2025-08-14 11:15:55 +08:00
Jason Lee
9a040eaaac
list: Refactor List, Dropdown delegate API to support section. ( #1107 )
...
Ref UITableView API:
https://developer.apple.com/documentation/uikit/uitableviewdatasource
## Changes
- Added some section related API to `ListDelegeate` and
`DropdownDelegate` with default implement, so if you don't need section
that you can just keep the default.
- Added `sections_count` method to get the number of sections, default
is 1.
- Added `render_section_header` for special the section header by if
needed, default return None.
- Added `render_section_footer` for special the section footer by if
needed, default return None.
## Break Changes
- The `DropdownState` have change new method to use IndexPath type:
```diff
- DropdownState::new(vec![], Some(1), window, cx);
+ DropdownState::new(vec![], Some(IndexPath::new(1)), window, cx);
```
- The `ListDelegeate`, `DropdownDelegate` has changed API:
- The `ix` are change from `usize` to `IndexPath`.
```diff
- fn render_item(&self, ix: usize, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>
+ fn render_item(&self, ix: IndexPath, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>
- fn set_selected_index(&mut self, ix: Option<usize>, window: &mut
Window, cx: &mut Context<List<Self>>)
+ fn set_selected_index(&mut self, ix: Option<IndexPath>, window: &mut
Window, cx: &mut Context<List<Self>>)
```
- The `items_count` method have added `section` argument to support list
section.
```diff
- fn items_count(&self, cx: &App) -> usize
+ fn items_count(&self, section: usize, cx: &App) -> usize
```
- The `can_load_more` method has renamed to `is_eof` in `ListDelegate`
and `TableDelegate`.
```diff
- fn can_load_more(&self, cx: &App) -> bool
+ fn is_eof(&self, cx: &App) -> bool
```
- The `can_search` method has renamed to `searchable` in `ListDelegate`.
```diff
- fn can_search(&self) -> bool
+ fn searchable(&self) -> bool
```
## Showcase
<img width="1196" height="925" alt="image"
src="https://github.com/user-attachments/assets/22750abe-cc3f-427e-903b-51758bd4e027 "
/>
<img width="1214" height="934" alt="image"
src="https://github.com/user-attachments/assets/52d42546-e6e7-4448-9c0f-43cd659fb630 "
/>
---------
Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-08-05 19:23:32 +08:00
Floyd Wang
6d28cce719
notification: Fix display issues caused by the taffy upgrade ( #1084 )
2025-07-23 19:12:13 +08:00
Jason Lee
271116926c
code-editor: Add go_to_line method to CodeEditor. ( #1081 )
...
- Fix to emit `enter` press key in Input single-line mode.
2025-07-23 13:33:09 +08:00
Jason Lee
1df450d3b0
story: Fix tiles story. ( #1056 )
2025-07-14 18:06:46 +08:00
Jason Lee
44427afacb
theme: Add to support highlight color to theme config. ( #1055 )
...
<img width="1058" height="1026" alt="image"
src="https://github.com/user-attachments/assets/300fb16b-c5e4-4eef-9690-54fcabc4fe47 "
/>
<img width="836" height="855" alt="image"
src="https://github.com/user-attachments/assets/3fdc8301-375d-4223-a2ea-8d4f411a90bd "
/>
2025-07-14 17:04:18 +08:00
Jason Lee
82b87d92ab
text_view: Fix nested Blockquote render in Markdown and HTML. ( #1053 )
...
<img width="986" height="271" alt="image"
src="https://github.com/user-attachments/assets/1de04629-2bdc-48f2-ae69-45c33482aeff "
/>
- Also fixed short language name in code block, e.g.: `rs` -> `rust`.
2025-07-14 14:30:40 +08:00
Jason Lee
463c3ebfea
chore: Remove unnecessary examples that have includes in gallery. ( #1049 )
2025-07-07 12:11:19 +08:00
Jason Lee
1f46b6b81c
story: Add more case to markdown example. ( #1045 )
2025-07-04 16:35:30 +08:00
Jason Lee
d70d649a67
story: Move DescriptionList into main story. ( #1037 )
2025-07-03 18:09:30 +08:00
Jason Lee
21dbaffcf4
input: Add Cursor and Selection type and export line number, cursor. ( #1012 )
2025-06-27 20:48:26 +08:00