дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
Plugins can add panes to the Project tool window and commands to the Git branch menus: - `[[contributes.projectViewPanes]]` with the `project-view-provider` export regroups a directory's native children under virtual folders. Existing nodes keep their icons, Git status and actions. `project-view.refresh` / `select-in` and `projectViewContext` menu items work against these panes. Requires `project.read`. - `git.branches.popup` and `git.branch.context` menus. `invocation.git-action-context` gives the command the repository roots and the full ref of the clicked branch. Requires `vcs.read`. - `views.open-revision-comparison` opens the IDE's comparison of two full commit IDs as a Compare tool window tab, the same one Compare Versions opens. The repository must be a mapped Git root of the invoking trusted project. Requires `vcs.read`. All of this is part of plugin API 1.21. A project-view test fixture and host tests cover the provider, the branch menu context and the comparison call. The plugin components and bindings are rebuilt. Co-authored-by: kirito1105 <[email protected]>
20 рядки
999 B
Rust
20 рядки
999 B
Rust
use openidea_plugin::{Error, host, mock::MockHost};
|
|
|
|
#[test]
|
|
fn project_view_helpers_require_project_read_and_preserve_window_options() {
|
|
{
|
|
let _mock = MockHost::install().with_capabilities(&[]);
|
|
assert_eq!(host::refresh_project_view("grouped", None), Err(Error::Denied("project.read".into())));
|
|
assert_eq!(host::select_in_project_view("project", "main.go", None), Err(Error::Denied("project.read".into())));
|
|
}
|
|
let mock = MockHost::install().with_capabilities(&["project.read"]);
|
|
host::refresh_project_view("grouped", Some("src")).unwrap();
|
|
host::select_in_project_view("grouped", "src/main.go", None).unwrap();
|
|
host::select_in_project_view("project", "src/main.go", Some(false)).unwrap();
|
|
assert_eq!(mock.project_view_refreshes(), [("grouped".into(), Some("src".into()))]);
|
|
assert_eq!(
|
|
mock.project_view_selections(),
|
|
[("grouped".into(), "src/main.go".into(), true), ("project".into(), "src/main.go".into(), false),]
|
|
);
|
|
}
|