fix(desktop): pass the real window label to project-requiring commands (#960)

Add Interpreter (creating a virtualenv), the Python packages list and pip install/uninstall, Settings › Git › Test, JVM listen-mode debugging and Create Patch › Save to file failed with "no project is open in this window", or ran without the project.

Their commands passed an empty window label to ops that resolve the calling window's project. They now pass the real window label, as the other project-scoped commands do. A sweep of every command that passes an empty label found exactly these seven ops using it: `sdk_locate_tools`, `sdk_python_create_venv`, `sdk_python_packages`, `sdk_python_pip`, `vcs_git_version`, `debug_listen_for_jvm` and `vcs_write_patch`. Without the window, the last one skipped the project's disk sync, so a patch saved inside the project showed up as an external change.

Fixes #955.

Co-authored-by: a-rookie-of-C-language <[email protected]>
Цей коміт міститься в:
arookieofcтаa-rookie-of-C-language authored and GitHub committed 2026-11-03 14:50:49 +08:00
1 джерело b55c398fb5
коміт 18e16e76a4
3 files changed
+20 -9

No files matched your search

+2 -1
Переглянути файл
@@ -261,12 +261,13 @@ pub async fn debug_attachable_processes(state: State<'_, AppState>) -> IdeResult
#[tauri::command]
#[specta::specta]
pub async fn debug_listen_for_jvm(
window: Window,
state: State<'_, AppState>,
request: ide_core::RequestId,
host: String,
port: u16,
) -> IdeResult<u16> {
ide_host::ops::debug::debug_listen_for_jvm(&state.host, "", request, host, port).await
ide_host::ops::debug::debug_listen_for_jvm(&state.host, window.label(), request, host, port).await
}
/// HotSwap (Reload Changed Classes) in a java-debug session.
+9 -4
Переглянути файл
@@ -39,17 +39,19 @@ pub async fn sdk_project_libraries(
#[tauri::command]
#[specta::specta]
pub async fn sdk_locate_tools(
window: Window,
state: State<'_, AppState>,
names: Vec<String>,
near: Option<PathBuf>,
) -> IdeResult<LocatedTools> {
ide_host::ops::sdk::sdk_locate_tools(&state.host, "", names, near).await
ide_host::ops::sdk::sdk_locate_tools(&state.host, window.label(), names, near).await
}
/// `base -m venv location`; output lines stream through `on_output`.
#[tauri::command]
#[specta::specta]
pub async fn sdk_python_create_venv(
window: Window,
state: State<'_, AppState>,
base: PathBuf,
location: PathBuf,
@@ -58,7 +60,7 @@ pub async fn sdk_python_create_venv(
) -> IdeResult<Sdk> {
ide_host::ops::sdk::sdk_python_create_venv(
&state.host,
"",
window.label(),
base,
location,
request,
@@ -70,17 +72,20 @@ pub async fn sdk_python_create_venv(
#[tauri::command]
#[specta::specta]
pub async fn sdk_python_packages(
window: Window,
state: State<'_, AppState>,
python: PathBuf,
request: RequestId,
) -> IdeResult<Vec<PythonPackage>> {
ide_host::ops::sdk::sdk_python_packages(&state.host, "", python, request).await
ide_host::ops::sdk::sdk_python_packages(&state.host, window.label(), python, request).await
}
/// Installs (`uninstall = false`) or removes a package; output streams through `on_output`.
#[tauri::command]
#[specta::specta]
#[allow(clippy::too_many_arguments)]
pub async fn sdk_python_pip(
window: Window,
state: State<'_, AppState>,
python: PathBuf,
requirement: String,
@@ -91,7 +96,7 @@ pub async fn sdk_python_pip(
) -> IdeResult<()> {
ide_host::ops::sdk::sdk_python_pip(
&state.host,
"",
window.label(),
python,
requirement,
uninstall,
+9 -4
Переглянути файл
@@ -371,8 +371,8 @@ pub async fn vcs_init(state: State<'_, AppState>, dir: PathBuf) -> IdeResult<()>
/// executable when `path` is empty.
#[tauri::command]
#[specta::specta]
pub async fn vcs_git_version(state: State<'_, AppState>, path: String) -> IdeResult<GitExecutableInfo> {
ide_host::ops::vcs::vcs_git_version(&state.host, "", path).await
pub async fn vcs_git_version(window: Window, state: State<'_, AppState>, path: String) -> IdeResult<GitExecutableInfo> {
ide_host::ops::vcs::vcs_git_version(&state.host, window.label(), path).await
}
/// The auto-detected git executable (shown as the field's placeholder).
@@ -656,8 +656,13 @@ pub fn vcs_changelists_save(window: Window, state: State<'_, AppState>, changeli
/// Create Patch › Save to file.
#[tauri::command]
#[specta::specta]
pub async fn vcs_write_patch(state: State<'_, AppState>, path: PathBuf, patch: String) -> IdeResult<()> {
ide_host::ops::vcs::vcs_write_patch(&state.host, "", path, patch).await
pub async fn vcs_write_patch(
window: Window,
state: State<'_, AppState>,
path: PathBuf,
patch: String,
) -> IdeResult<()> {
ide_host::ops::vcs::vcs_write_patch(&state.host, window.label(), path, patch).await
}
#[tauri::command]