дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
feat(plugins): editor decorations with their own colors (API 1.17) (#5957)
Plugin API 1.17: decorations.set-styled (SDK host::set_styled_decorations) lets editor decoration items carry their own #rrggbb / #rrggbbaa foreground and background, for colors the theme palette lacks (e.g. a TODO highlighter's user-chosen colors). - Host validates and normalizes colors (anything else is Invalid); an item with colors may leave style empty; set ids, limits and clear are shared with set / set-markdown. - Editor paints the range with inline color / background-color; the after label takes the foreground only; the frontend re-checks the hex format. - SDK types, wrapper and mock (shared replace/limit helper for the three decoration kinds); decorations fixture gains a styled command. - Package openidea:[email protected].0, engine 1.17.0, components rebuilt; docs list 1.16 as shipped with 0.1.52.
Цей коміт міститься в:
1 джерело
e74edbcedc
коміт
bfbc70a438
181 files changed
+618
-214
No files matched your search
@@ -36,7 +36,7 @@ sdk/rust/openidea-plugin/ # the Rust SDK (host API, Plugin trait, mock host)
|
||||
crates/ide-plugin/tests/fixtures/ # test plugins: hello, jobs, language-toy, misbehave, semantic-tokens, hover, commit, inlay-hints, decorations
|
||||
```
|
||||
|
||||
The plugin API is defined in [`wit/`](../wit/) (`openidea:[email protected]6.0`, world
|
||||
The plugin API is defined in [`wit/`](../wit/) (`openidea:[email protected]7.0`, world
|
||||
`plugin`).
|
||||
|
||||
## 1. Quick start
|
||||
@@ -427,9 +427,23 @@ are always available. Calling a gated function without its capability returns
|
||||
|
||||
## 3. Writing code (Rust SDK)
|
||||
|
||||
### API 1.17
|
||||
|
||||
API 1.17.0 is in development on `main`. Use `engines.openidea = "^1.17"` and the
|
||||
matching SDK. Plugins for 1.16 and earlier keep working. New in 1.17:
|
||||
|
||||
- [Editor decorations](#editor-and-project-snapshots-api-14):
|
||||
`host::set_styled_decorations` (`decorations.set-styled`) draws the same items as
|
||||
`set_markdown_decorations` with their own `colors`: a `#rrggbb` or `#rrggbbaa`
|
||||
foreground and background, for colors the theme palette does not have (a TODO
|
||||
highlighter's user-chosen colors). An item with colors may leave `style` empty;
|
||||
with a palette style the colors paint over it. Any other color string is rejected
|
||||
with `Error::Invalid`. Set ids, limits and `clear_decorations` are shared with
|
||||
`set_decorations`.
|
||||
|
||||
### API 1.16
|
||||
|
||||
API 1.16.0 is in development on `main`. Use `engines.openidea = "^1.16"` and the
|
||||
API 1.16.0 shipped with OpenIDEA 0.1.52. Use `engines.openidea = "^1.16"` and the
|
||||
matching SDK. Plugins for 1.15 and earlier keep working. New in 1.16:
|
||||
|
||||
- `Project::vcs_repository_at(path)` returns the mapped worktree owning an existing project file
|
||||
@@ -836,6 +850,7 @@ then run `openidea-plugin check`.
|
||||
| `TextEditor::set_selections(ranges)`, `reveal(range)` | `editor.text-editor` | API 1.4: selections or scrolling in this window's already open editor; no capability. Commands/events only, UTF-16 coordinates. |
|
||||
| `host::set_decorations`, `clear_decorations` | `decorations.{set,clear}` | API 1.4: project-scoped editor annotations cleared on plugin stop. Requires `project.read`. |
|
||||
| `host::set_markdown_decorations` | `decorations.set-markdown` | API 1.16: the same sets with `markdown_hover` cards; shares set ids and limits with `set_decorations`. Requires `project.read`. |
|
||||
| `host::set_styled_decorations` | `decorations.set-styled` | API 1.17: those items with their own `#rrggbb` / `#rrggbbaa` `colors`; `style` may be empty when colors are set; shares set ids and limits with `set_decorations`. Requires `project.read`. |
|
||||
| `host::set_file_decoration`, `clear_file_decorations` | `decorations.{set-file,clear-file}` | API 1.4: project-tree badges/styles. Requires `project.read`. |
|
||||
| `host::set_file_note` | `decorations.set-file-note` | API 1.7: a note after the name in the project tree (one line, at most 200 characters). Requires `project.read`. |
|
||||
| `host::set_file_icon`, `set_file_icons` | `decorations.{set-file-icon,set-file-icons}` | API 1.8: assign one of the plugin's declared `[[contributes.fileIcons]]` icons to a file or plain folder by path (individually or up to 10,000 entries per set). Requires `project.read`. |
|
||||
@@ -1333,7 +1348,11 @@ unloading or crashing the plugin withdraws them; idle reclamation preserves them
|
||||
API 1.16 adds `set_markdown_decorations`: the same items, limits and set ids, with
|
||||
`markdown_hover` rendered as a hover card (the editor's Markdown hover, including
|
||||
code highlighting and safe links) while the pointer rests on the range or its
|
||||
`after` label. `hover` remains the plain-text fallback. A plugin that pushes
|
||||
`after` label. `hover` remains the plain-text fallback. API 1.17 adds
|
||||
`set_styled_decorations`: those items plus `colors` (`foreground` / `background`,
|
||||
each `#rrggbb` or `#rrggbbaa`). Palette styles follow the theme; use colors only
|
||||
when the user chose them (or the plugin's own data defines them), since they do not
|
||||
adapt to light and dark themes. The line-end `after` label takes the foreground only. A plugin that pushes
|
||||
labels when a file is opened or focused should subscribe to
|
||||
`file-opened`/`editor-focused` and call `clear_decorations` when its data no
|
||||
longer applies; the host already bounds what a set can carry.
|
||||
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
657eb2ab2d2c0e1bffa6e5852af883d38a507341bc2d9c5879717ccaef6a4100
|
||||
25da773f6dee3c966c529d526415bbbd763c5c144660b1e2744737f2bfe0fb65
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
cab71634347487537f5310bdcb883482e94387707d57dd3eb271be378186dfff
|
||||
e42622d525d315a5a5d186197e17624ec713ec1d9a47a0dbc67abfeb61854971
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
a802ccc1608628f2e97d91b5e4ba3f0d77b8addffdb7ada532d52b089c878b72
|
||||
24f75bb6f4145a4432a5dbe3dec0fbc8fb77b4bdc853f300ccd7208941d6f16d
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
28d398a0f606cacbab278002320dc1724d353d1e858eff290c4bbafc3f70fb92
|
||||
701df0210137656bbedab1d7af171c6442bbbce296f885ea63a21a7cf28a76aa
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
a2ec37204138e764dde32a021bedb4cb2b79e8905c48d5912ca356f98d8e7439
|
||||
d1dae995f46af06e43a21e57b9ad4af31854e7e87c5f120d7b516940ea6bba99
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
07fb659ac6daf89956cfeb51073f95cdc65fa801f2de62bdfa12b5ef0c72e08f
|
||||
7e50407014ba5c0a0d22a1d5c92dff8180e20f153101c9a9a18c83e0ec16cbfe
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
f2feddc2ca41706ff859f82081541832b3b3c3501c2deefb266faadcc4833b5a
|
||||
c58f9d017da99a14b127c51c0ad9ceaa7fd6d1138732d68604653fb0ff97de6b
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
563d9d1f3e3760bdc2094f10b630108ca6680636d46c1e7d04105434547c5309
|
||||
828ad3a4a9b7e8a9d938a68883254b4eb572309ef48bb11c9155915047d007e2
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
4b512f5486462cabad280f2f9b1c9fa37fb394935721e9b8bdd6e2136faf4e11
|
||||
1e60cbca93fd8a361705bd92cf8e187f857897c3763bda52eb6f33a58d16262f
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
38efacb96fdcf886c60a3b0028628d112d0859d5a6ca6d765ca16e3151f323e2
|
||||
be647f1d778223bb5cc63daebfa71085c3f20c0624b2db53d6870bbfa2c190e0
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
3dba1e7d6992ce9847a59ef3cf486f0bacee0d24629544445f056ea9ea8cbc83
|
||||
37e3ecf2c02b08a488a0c2a949a23756470d1edd9a3ee8c00bfefaca82ed87ad
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
044d9fd391ba1063acfc3b32fed2cffe7398b5b96ba19c257c53b9806a98785f
|
||||
33f55182b4c0e9ca455605a328cb47ffac155540589bbb0854750926cbbb5e05
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
3e739b326a76f9f7788e228dbabaf90e22d6170fa88284a41d5893bd1f605363
|
||||
e62e3c647e6b175ce66ab18ee1e1451be486fa5c3b586b4d508063c8d7b08fec
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
de8e4453fa010ed628e7458cc7526ce708cd9cba045506468cc1c8b3af6aa33e
|
||||
f96c4d0de92a1ac3f363b936035f413643535ba30ec7752be85caccc28af167f
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
94be23d0f39ed345eb6e46f4c80200de01835353bac269921bb6e10bfc6a50ae
|
||||
3b8a2d8b44637f5e951d42eb8932a64a347bbcea82e7ddbbc707cbc9cea2f320
|
||||
Reference in new issue
Заблокувати користувача