дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
feat(plugins): expose indexed workspace symbol search (#2040)
Closes #1944 API 1.3 lets a plugin search the IDE's workspace symbol index. Results are limited to paths the plugin may read under its `project.read` grant (external content roots and symlink aliases excluded), the search honours the call's cancellation and deadline including lock waits, and ranges use UTF-16. Incremental index updates no longer publish symlink-ancestor aliases. Verified on macOS with the test fixture. Co-authored-by: arnaud-ritti <[email protected]>
Цей коміт міститься в:
1 джерело
0bee9b7aab
коміт
7cedf0b9be
71 files changed
+1157
-40
No files matched your search
@@ -281,7 +281,7 @@ machine. Users can revoke optional capabilities in Settings › Plugins.
|
||||
|
||||
| Capability | Risk | Unlocks today |
|
||||
| ------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `project.read` | low | `Project::root`, `read_file`, `find_files`, `host::projects`, `publish_diagnostics` |
|
||||
| `project.read` | low | `Project::root`, `read_file`, `find_files`, `symbols`, `host::projects`, `publish_diagnostics` |
|
||||
| `project.write` | medium | `Project::write_file` — creates and replaces text files inside the open projects |
|
||||
| `fs.read:<path>` | high | `host::fs::read_file`, `read_bytes`, `stat`, `read_dir` — files outside the projects, under the grant's directory |
|
||||
| `fs.write:<path>` | high | `host::fs::write_file`, `write_bytes` — files under that path; doesn't imply reading |
|
||||
@@ -439,6 +439,7 @@ then run `openidea-plugin check`.
|
||||
| `host::locale()` | `ui.locale` | The IDE's UI language as a BCP 47 tag (`en`, `fr`, `zh-CN`); no capability. See _Translations_. |
|
||||
| `host::log(level, msg)` | `log` | IDE log, tagged with the plugin id. `eprintln!` output is logged too and shown when the plugin crashes. |
|
||||
| `Project::find_files(glob, limit)` | `workspace.project.find-files` | Project-relative glob (`**/*Mapper.xml`); honours `.gitignore`; at most `limit` paths. |
|
||||
| `Project::symbols(query, limit)` | `workspace.symbols` | New in 1.3; `project.read`. Fuzzy in-memory search (no LSP): name, camelCase kind, container and UTF-16 location. Queries ≤ 256 UTF-8 bytes; limits capped at 1000. Snapshot notes below. |
|
||||
| `host::publish_diagnostics(path, items)` | `diagnostics.publish` | Replaces this plugin's problems for the file (editor squiggles and the Problems view); an empty list clears them. |
|
||||
| `host::fetch(request)` → `{status, headers, body}` | `net.fetch` | See _Network_. |
|
||||
| `Project::run_process(program, args, stdin)` → `{code, stdout, stderr}` | `process.run` | Only the pinned program of a `process:` grant; runs in the project root of a trusted project; 4 MiB of output; killed when the call is cancelled or times out. |
|
||||
@@ -451,6 +452,20 @@ then run `openidea-plugin check`.
|
||||
| `host::open_location(path, line, column)` | `views.open-location` | Opens a file inside the project in an editor of the invoking window, the caret at `line`/`column` (0-based, UTF-16): a view's links to code. Needs `project.read`. |
|
||||
| `host::setting(key)`, `setting_bool`, `setting_string`, `setting_number` | `settings.get` | The user's value (project over global) or the schema's default. |
|
||||
|
||||
`Project::symbols` reads the current in-memory index: results may be partial
|
||||
while indexing, and locations can lag unsaved edits. Normal saves and filesystem
|
||||
changes update the index in the background. Results are confined to the project's
|
||||
root, with normal exclusions; external content roots and updates through escaping
|
||||
symlinks are excluded. Search honours the current call's cancellation and deadline.
|
||||
Empty queries and zero limits return no symbols; a closed project returns
|
||||
`Error::NotFound`.
|
||||
|
||||
Type resolution and member queries remain deferred to the asynchronous API 2.0
|
||||
model. Providers can select their project with `host::project_of(&doc.path)` and
|
||||
call `symbols` synchronously; `crates/ide-plugin/tests/fixtures/symbols` demonstrates
|
||||
a definition provider. `MockHost::set_symbols(root, symbols)` replaces a test
|
||||
snapshot; its mock uses case-insensitive substring matching rather than fuzzy ranking.
|
||||
|
||||
Both process APIs only add environment variables. A key already in the prepared child
|
||||
environment (including the login-shell `PATH`) fails with an error naming the key;
|
||||
variables are never replaced or removed. Names compare case-insensitively on Windows.
|
||||
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
7872480dee517db617120a9327d3bbbcc007d31bbf9e6c999ce202f38f0ed478
|
||||
977835f3364613876b3f563877d7f0cf36d668226c5c6ac2280473c73d44117d
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
31f1d88c7e88553eed145fd170485c10e19967eccbf2021ec71fca862d05e952
|
||||
55e3306fc2ff9456d79f02b63712c7f83b1fe4e75fec051f5fb96e7fb766066f
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
6a2db880c49b15d7ce5ba7fda69ac8d1cac04f0412d42b6922550594ef94a7c5
|
||||
f582b640e980e4b69e292ec425d0ed8113527119d18d0fa1ea73e7c34f1f89a1
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
9299f10c517ee5582312f0f14871e21d36050ee8d621df31d7e6a4126c4ea37e
|
||||
842de029af0767864b56dc71199a823ca0ea04aec5ece8928dac69340ff7ab7a
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
1f86f15f5e864ec9a91cb31379047eafd4ae8c07ffacb5e1c85955ee07873342
|
||||
1dd92a9e139458813f513479cbc0f8187eff217f5dac2b39441537e3039e9dca
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
540e60e34b752eb201ef9cacea44066b4f59a4e36c3d1a468bf208223569a628
|
||||
5ce56abe0082fc610deec13f6907cdfd8be7346ce9a1c43c59e1828957bc3274
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
106f4a0b300fdb98fd0bd8f8bc1b3ce2c692a8a7e0107353905d7edbb7c7ce4d
|
||||
be6dd0b46a0f407f354ae2b67c6304948c71749bc3587dcf81b39dd245afdb48
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
eba583c669da994dba24a8a16546c9d2cb50fb46db53207207809b20882680e8
|
||||
4fe7aec43c3009cd0567e93f2e80c135091269aa0a2fcea3ba00f43a24c5ec56
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
d1385eb9aa4d78bbcbdf98565fdf3b550050388af9248814f5c994b54d605708
|
||||
7be4ce274fef38b5d4741646de970afd803fbf5ccffaa49236af1d15c8c870a9
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
8f4c3af7f1f0f6e2001ce161d89e2b83ef700480d6fd5517f46e90437f74639e
|
||||
0a02c2ec0444e5eccb68b2bfabeaaf7752d1bc2b22bc0f26883a2a35eeac7df7
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
2504128882832c282d627946668f10603fe4b165dca8f12a49131934d1a5c09d
|
||||
10c214d40a6b43bb8b850bfe6d97c1a360ed748b5e95645354b3317806d7a538
|
||||
Reference in new issue
Заблокувати користувача