Commit graph

1444 commits

Author SHA1 Message Date
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
478db2785a
input: Keep more empty space at top or bottom of the Editor. (#1256)
<img width="727" height="586" alt="image"
src="https://github.com/user-attachments/assets/2eb27326-831c-40fc-b0c8-48e6ab6ac67f"
/>

- Fix to keep 3 lines on top when move vertical.
- Improve to keep 1 line edge for cursor, when editor is too small.
2025-09-17 10:45:56 +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
3c39641486
group_box: Fix incorrect h_full in GroupBox. (#1253)
Also fix the notifications example.
2025-09-16 21:23:29 +08:00
Floyd Wang
5ddaa9f5aa
form: Add col_start and col_end for the fields (#1251)
* Continue https://github.com/longbridge/gpui-component/pull/1250
2025-09-16 20:30:45 +08:00
Floyd Wang
731ab958f8
form: Add support for multi-column layout (#1250)
| Vertical | Horizontal |
| - | - |
| <img width="1642" height="1106" alt="SCR-20250916-nnry"
src="https://github.com/user-attachments/assets/279eb192-c660-449e-931e-1d7ff79ac69f"
/> | <img width="1642" height="1106" alt="image"
src="https://github.com/user-attachments/assets/289a6672-d82d-4f6f-a267-592874ccbe42"
/> |
2025-09-16 16:28:43 +08:00
Jason Lee
717c83957d
input: Use position for preferred column for vertical move. (#1249)
For better support for non-monospaced font
2025-09-16 11:52:51 +08:00
dependabot[bot]
30b4723853
build(deps): bump gpui from 9c548a0 to 53b2f37 (#1248) 2025-09-15 23:47:25 +08:00
Jason Lee
aab1321b70
input: Refactor InputEvent::Change to not include the text. (#1246)
Change this to avoid Rope `to_string` performance cost. Ref #1220 

The listeners of `InputEvent::Change` may not be going to use entire of
text.

## Break Change

- The `InputEvent::Change(SharedString)` removed value.

```diff
- pub enum InputEvent {
-    Change(SharedString),
+ pub enum InputEvent {
+    Change,
```
2025-09-15 20:50:30 +08:00
Jason Lee
f1b6d7c5ed editor: Add completion, code_action provider. (#1242) 2025-09-15 19:25:02 +08:00
Floyd Wang
b34d8b6716
label: Add HighlightsMatch to support prefix matching (#1243)
| Mode | |
| - | - |
| Full | <img width="480" alt="SCR-20250912-ptai"
src="https://github.com/user-attachments/assets/fbaaec1c-c376-42a0-a88c-18fc21a24ac3"
/> |
| Prefix | <img width="480" alt="SCR-20250912-ptbv"
src="https://github.com/user-attachments/assets/f68ca47f-7ad2-4214-b132-bf5abbc92764"
/> |
| | <img width="480" alt="SCR-20250912-ptef"
src="https://github.com/user-attachments/assets/1a3807cb-d2e4-4ed0-ab0b-d375deae1359"
/> |
2025-09-12 18:35:55 +08:00
Cookie
feabb748ec
calendar: Fixed cross year name and multi month linkage click issues (#1241)
<img width="864" height="298" alt="image"
src="https://github.com/user-attachments/assets/7f0a34d7-e000-4756-b1ae-0e6511679660"
/>
2025-09-12 10:29:07 +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
2a918bf4de
input: Improve TextWrapper data structure. (#1237) 2025-09-10 18:52:35 +08:00
Jason Lee
db5ba1e04c
input: Fix horizontal scroll to match the longest line width. (#1238)
Close #1234
2025-09-10 18:17:15 +08:00
Jason Lee
5beaed2a9e
input: Pause blink and keep show cursor on moving or editing. (#1236)
https://github.com/user-attachments/assets/751d0b62-18f9-41c8-80a0-e11439e3b91e
2025-09-10 14:49:14 +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
844574befc
input: Fix track scroll to selected end on drag move. (#1231) 2025-09-10 13:59:02 +08:00
Jason Lee
7998d64501
highlighter: Improve Syntax Highlighter performance. (#1230)
Now can support up to 50K lines with code highlight.


https://github.com/user-attachments/assets/3bbba2cd-ea56-4778-b471-6beea323fbaa

----

Ref Links

- https://zed.dev/blog/syntax-aware-editing
2025-09-10 00:11:53 +08:00
Floyd Wang
ab98e53a5a
plot(tooltip): Fix the dots not centered (#1229) 2025-09-09 18:01:01 +08:00
Jason Lee
e1dede93b4
docs: Add profile guide. (#1227) 2025-09-09 14:56:42 +08:00
Floyd Wang
51caf932db
plot(tooltip): Add support for custom appearance (#1226) 2025-09-09 14:47:07 +08:00
Jason Lee
03c2327cdb
input: Improve Input performance by only shape visible lines. (#1222)
Close #1193

Ref issue #1220 

This PR aim to shape text in visible ranges to reduce `shape_text` time
for large document case.

- Fix rendering might be delayed and cause blanks when scrolling to
follow the selection.
- Fix `RopeExt::lines` method to avoid call `line` method on skipped
iter.
2025-09-09 14:41:52 +08:00
Floyd Wang
84b2d2a6f5
plot(scale): Add least index support for linear (#1225) 2025-09-09 11:40:09 +08:00
Jason Lee
d71a32d0e4
input: Fix move to to skip \r on Windows. (#1223)
This PR for continue #1214 to fix move cursor to ignore` `\r` for
Windows.
2025-09-09 09:40:07 +08:00
Jason Lee
413eac3385
docs: Update HTML Rendering support in README (#1221) 2025-09-08 17:42:42 +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
Floyd Wang
78dccd4d79
plot: Apply linear scale based on the direction of given range (#1219)
## Breaking Change
- Apply linear scale based on the direction of given range.

```diff
- ScaleLinear::new(vec![1., 2., 3.], vec![0., 100.])
+ ScaleLinear::new(vec![1., 2., 3.], vec![100., 0.])
```

Currently, you can draw the linear scale from minimum to maximum or from
maximum to minimum; it depends on the direction of the range.
2025-09-08 15:56:58 +08:00
Floyd Wang
5e302866ce
inspector: Improve UI details (#1217) 2025-09-08 13:29:54 +08:00
Floyd Wang
00dd457441
drawer: Ensure the drawer’s height matches the application (#1216) 2025-09-08 10:36:13 +08:00
Jason Lee
62122d5f41
docs: Update contributing for UI guides. (#1215) 2025-09-08 10:16:11 +08:00
Jason Lee
f35398d797
input: Fix some Rope method call will crash. (#1213) 2025-09-05 19:09:46 +08:00
Jason Lee
cfc2449820
input: Fix column position update when text added, to support move vertical keep column. (#1211)
Refactor this logic by use Rope line, column.
2025-09-05 18:47:24 +08:00
Jason Lee
344e4407ff
input: Use Rope for InputState. (#1208)
This PR to change the Input to use
[ropey](https://github.com/cessen/ropey) to store the text.

## Break Changes

- The `value` method of `InputState` now returns a `SharedString` type.

```diff
- pub fn value(&self) -> &SharedString
+ pub fn value(&self) -> SharedString
```

Ref links:

- https://github.com/cessen/ropey
- https://zed.dev/blog/zed-decoded-rope-sumtree
- https://github.com/helix-editor/helix/blob/master/docs/architecture.md
2025-09-05 18:20:47 +08:00
Floyd Wang
19be9b8d96
inspector: Trim the diagnostic error at the end (#1210) 2025-09-05 15:21:25 +08:00
Chuqiao Feng
c6f6a9bb09
inspector: Fix Rust parser of inspector. (#1209)
This PR aims to fix a bug of the Rust parser in my last PR #1205.
2025-09-05 15:08:05 +08:00
Chuqiao Feng
8992852165
inspector: Add live editor to inspector (#1205)
Inspired by Zed, this PR implements a simple live Rust and JSON style
editor for the inspector.

The rust style editor only supports `Styled` and `StyledExt` method
calls with no arguments.




https://github.com/user-attachments/assets/df7f1746-92d7-416c-afd5-e389ac3ea9ae

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-09-05 11:58:36 +08:00
Jason Lee
16f9380a63
highlighter: Fix some tokens were highlighted incorrectly (#1204)
Continue #1198

## Before

<img width="1322" height="1043" alt="image"
src="https://github.com/user-attachments/assets/85bedde2-cb24-4eed-be9c-64b7d5627f7c"
/>

## After

<img width="1056" height="1098" alt="image"
src="https://github.com/user-attachments/assets/2b65bd45-c24d-425e-b4ec-0e4408a3f6a4"
/>
2025-09-05 11:21:06 +08:00
Jason Lee
f3ffdb46f5
docs: Rename DEVELOPMENT.md to CONTRIBUTING.md. (#1203)
## Summary
- Renamed DEVELOPMENT.md to CONTRIBUTING.md for better GitHub homepage
visibility
- Updated README.md reference to point to the new filename

## Test plan
- [x] Verify CONTRIBUTING.md file exists and contains the same content
- [x] Confirm README.md link points to correct file
- [x] Check that GitHub will now display the contributing guidelines on
project homepage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-04 11:12:18 +08:00
Jason Lee
ee40f65fb5
markdown: Add to support LinkReference and Footnote. (#1201) 2025-09-03 16:39:17 +08:00
Jason Lee
f4a292d975 docs: Fix compare table. 2025-09-03 15:03:16 +08:00
Jason Lee
6cfdf8b629
docs: Add compare to others libraries. (#1199) 2025-09-03 14:59:30 +08:00
Jason Lee
2cfb5d24a9
highlighter: Use sum_tree to store the highlight cache. (#1198) 2025-09-03 14:09:46 +08:00
Jason Lee
189bd6e9a3
highlighter: Fix some editing operatons might result incorrect hightlight. (#1197)
This PR just removed the partial update highlight cache code. This logic
will get incorrect offset.

To make sure highlight correct first.

Remove this will slow down performance (On editing), when is more than
5K lines, but if less than this the performance can accept.
2025-09-02 18:52:02 +08:00
Jason Lee
34ec2564f8 theme: Fix default dark code editor background color. 2025-09-02 17:28:19 +08:00