дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
Merge remote-tracking branch 'origin/main' into pr-6263
# Conflicts: # src/platform/locales/text/en.json # src/platform/locales/text/zh.json
Цей коміт міститься в:
коміт
dd1ab68e11
47 files changed
+708
-90
No files matched your search
Створено
@@ -4440,7 +4440,6 @@ dependencies = [
|
||||
"serde_json",
|
||||
"specta",
|
||||
"tracing",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -73,6 +73,38 @@ pub fn find_command(command: &str, search: &OsStr, root: &Path) -> Option<PathBu
|
||||
dirs.into_iter().find_map(|dir| names.iter().map(|name| dir.join(name)).find(|p| is_executable(p)))
|
||||
}
|
||||
|
||||
const GH_FALLBACK_PATHS: &[&str] = if cfg!(windows) {
|
||||
&[r"C:\Program Files\GitHub CLI\gh.exe"]
|
||||
} else {
|
||||
&["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh", "/snap/bin/gh"]
|
||||
};
|
||||
|
||||
/// Locates `gh` across `OPENIDEA_GH`, [`search_path`] (which includes IDE-managed tools
|
||||
/// only when installed, then the user's `PATH`), and standard OS install locations.
|
||||
pub fn find_gh_executable() -> Option<PathBuf> {
|
||||
let explicit = std::env::var_os("OPENIDEA_GH").map(PathBuf::from);
|
||||
find_gh_in(explicit.as_deref(), &search_path(), GH_FALLBACK_PATHS)
|
||||
}
|
||||
|
||||
/// Locates a pre-installed `gh` outside [`search_path`] (`OPENIDEA_GH`, Windows Program Files,
|
||||
/// Linux Snap) so tool detection reports it as available without prompting for a duplicate install.
|
||||
pub fn find_gh_outside_search_path() -> Option<PathBuf> {
|
||||
if let Some(explicit) = std::env::var_os("OPENIDEA_GH").map(PathBuf::from).filter(|p| is_executable(p)) {
|
||||
return Some(explicit);
|
||||
}
|
||||
GH_FALLBACK_PATHS.iter().map(PathBuf::from).find(|p| is_executable(p))
|
||||
}
|
||||
|
||||
pub fn find_gh_in(explicit: Option<&Path>, search: &OsStr, fallbacks: &[&str]) -> Option<PathBuf> {
|
||||
if let Some(explicit) = explicit.filter(|p| is_executable(p)) {
|
||||
return Some(explicit.to_path_buf());
|
||||
}
|
||||
if let Some(found) = find_command("gh", search, Path::new("")) {
|
||||
return Some(found);
|
||||
}
|
||||
fallbacks.iter().map(PathBuf::from).find(|p| is_executable(p))
|
||||
}
|
||||
|
||||
fn is_executable(path: &Path) -> bool {
|
||||
let Ok(metadata) = path.metadata() else { return false };
|
||||
#[cfg(unix)]
|
||||
|
||||
@@ -12,4 +12,3 @@ serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
specta.workspace = true
|
||||
tracing.workspace = true
|
||||
which = "8"
|
||||
@@ -16,30 +16,15 @@ use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::sync::OnceLock;
|
||||
use std::time::Duration;
|
||||
|
||||
/// API calls normally answer within a few seconds.
|
||||
const QUICK: Duration = Duration::from_secs(60);
|
||||
|
||||
/// Locates the gh executable once per process (GUI apps on macOS have a minimal `PATH`).
|
||||
/// Locates the gh executable (GUI apps on macOS have a minimal `PATH`, and the IDE can
|
||||
/// install or remove a managed copy in its tools directory at runtime).
|
||||
pub fn gh_executable() -> Option<PathBuf> {
|
||||
static GH: OnceLock<Option<PathBuf>> = OnceLock::new();
|
||||
GH.get_or_init(|| {
|
||||
if let Some(explicit) = std::env::var_os("OPENIDEA_GH").map(PathBuf::from).filter(|p| p.is_file()) {
|
||||
return Some(explicit);
|
||||
}
|
||||
if let Ok(found) = which::which("gh") {
|
||||
return Some(found);
|
||||
}
|
||||
let candidates: &[&str] = if cfg!(windows) {
|
||||
&[r"C:\Program Files\GitHub CLI\gh.exe"]
|
||||
} else {
|
||||
&["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh", "/snap/bin/gh"]
|
||||
};
|
||||
candidates.iter().map(PathBuf::from).find(|p| p.is_file())
|
||||
})
|
||||
.clone()
|
||||
ide_core::tool_path::find_gh_executable()
|
||||
}
|
||||
|
||||
fn command(root: &Path, args: &[&str]) -> IdeResult<Command> {
|
||||
@@ -386,3 +371,37 @@ pub fn prepare_diff(
|
||||
let files = repo.diff_files(&base, head_oid)?;
|
||||
Ok(PrDiffRevisions { base, head: head_oid.to_owned(), files, root: ide_core::IpcPath(repo.root().to_path_buf()) })
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn gh_executable_picks_up_newly_installed_binary_without_restart() {
|
||||
let dir = std::env::temp_dir().join(format!("openidea-gh-test-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let search = std::env::join_paths([&dir]).unwrap();
|
||||
assert_eq!(ide_core::tool_path::find_gh_in(None, &search, &[]), None);
|
||||
|
||||
let gh = dir.join(if cfg!(windows) { "gh.exe" } else { "gh" });
|
||||
std::fs::write(&gh, "#!/bin/sh\n").unwrap();
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
std::fs::set_permissions(&gh, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
}
|
||||
assert_eq!(ide_core::tool_path::find_gh_in(None, &search, &[]), Some(gh.clone()));
|
||||
|
||||
let explicit = dir.join(if cfg!(windows) { "custom-gh.exe" } else { "custom-gh" });
|
||||
std::fs::write(&explicit, "#!/bin/sh\n").unwrap();
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
std::fs::set_permissions(&explicit, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
}
|
||||
assert_eq!(ide_core::tool_path::find_gh_in(Some(&explicit), &search, &[]), Some(explicit));
|
||||
|
||||
std::fs::remove_file(&gh).unwrap();
|
||||
assert_eq!(ide_core::tool_path::find_gh_in(None, &search, &[]), None);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
}
|
||||
@@ -29,15 +29,19 @@ fn tools(host: &Host, window: &str) -> IdeResult<Tools> {
|
||||
&root,
|
||||
&settings,
|
||||
));
|
||||
// Godot is usually an app bundle / Flatpak outside the search path.
|
||||
let found = ide_sdk::godot::find(None).map(|p| (ide_sdk::godot::COMMAND.to_owned(), p));
|
||||
// Godot and GitHub CLI can live in app bundles / MSI / Snap folders outside the search path.
|
||||
let mut found: std::collections::BTreeMap<_, _> =
|
||||
ide_sdk::godot::find(None).map(|p| (ide_sdk::godot::COMMAND.to_owned(), p)).into_iter().collect();
|
||||
if let Some(gh) = ide_core::tool_path::find_gh_outside_search_path() {
|
||||
found.insert("gh".to_owned(), gh);
|
||||
}
|
||||
let runtime = ide_sdk::apply::tool_install_environment(&root, &settings);
|
||||
let work_dir = (!root.as_os_str().is_empty()).then_some(root);
|
||||
Ok(Tools::new(&data)
|
||||
.with_downloads(settings.tool_downloads.clone())
|
||||
.with_runtime(runtime.commands, runtime.env)
|
||||
.with_custom_paths(custom)
|
||||
.with_found_paths(found.into_iter().collect())
|
||||
.with_found_paths(found)
|
||||
.with_work_dir(work_dir))
|
||||
}
|
||||
|
||||
|
||||
@@ -697,6 +697,7 @@ async fn typescript() {
|
||||
}
|
||||
|
||||
/// The latest `tsc` diagnostics of `path` (Problems › TypeScript Project Errors), `None` before any.
|
||||
#[cfg(unix)]
|
||||
fn tsc_errors(events: &Events, path: &Path) -> Option<Vec<String>> {
|
||||
events.lock().unwrap().iter().rev().find_map(|e| match e {
|
||||
IdeEvent::Diagnostics { path: p, source, items } if source == "tsc" && **p == *path => {
|
||||
|
||||
@@ -6,7 +6,6 @@ use ide_host::{Host, HostConfig};
|
||||
use ide_plugin::TextQuery;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
struct Harness {
|
||||
host: Arc<Host>,
|
||||
@@ -510,6 +509,7 @@ async fn plugin_run_output_mode_executes_pty_and_pipes_with_input_exit_and_stop(
|
||||
use ide_host::plugins::{Consent, PluginEvent, PluginHost, WindowRequest};
|
||||
use ide_plugin::{Invocation, Limits};
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::time::Duration;
|
||||
|
||||
let f = Harness::new();
|
||||
f.host.set_project_trust(&f.root, true, false).await.unwrap();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! without network.
|
||||
|
||||
use crate::platform::{Arch, Os, Platform};
|
||||
use crate::process::{Emit, Http};
|
||||
use crate::process::Emit;
|
||||
use crate::sources::Download;
|
||||
use crate::{InstallEvent, InstallGuard, Tools, archive, clear_quarantine, fetch_verified};
|
||||
use ide_core::error::ErrorKind;
|
||||
@@ -240,10 +240,6 @@ fn unpacked_root(pkg: &Path, home: &Path) -> PathBuf {
|
||||
}
|
||||
|
||||
impl Tools {
|
||||
fn http(&self) -> IdeResult<Http> {
|
||||
Http::new(&self.system_path)
|
||||
}
|
||||
|
||||
/// Java versions `vendor` publishes.
|
||||
pub fn jdk_releases(&self, vendor: &str, cancel: &CancellationToken) -> IdeResult<JdkReleases> {
|
||||
vendor_or_err(vendor)?;
|
||||
|
||||
@@ -557,6 +557,10 @@ impl Tools {
|
||||
&self.root
|
||||
}
|
||||
|
||||
pub(crate) fn http(&self) -> IdeResult<Http> {
|
||||
Ok(Http::new(&self.system_path)?.with_gh_from(&self.child_path))
|
||||
}
|
||||
|
||||
/// [`Tools::command`] in the project directory.
|
||||
fn command_in_project(&self, program: impl AsRef<std::ffi::OsStr>) -> Command {
|
||||
let mut cmd = self.command(program);
|
||||
@@ -902,7 +906,7 @@ impl Tools {
|
||||
_ => (ToolStatus::Missing, None, None),
|
||||
}
|
||||
}
|
||||
_ => match self.which(main) {
|
||||
_ => match self.which(main).or_else(|| self.found.get(main).cloned()) {
|
||||
Some(path) => {
|
||||
let version = self.query_version(spec, &path);
|
||||
(ToolStatus::OnPath, Some(path), version)
|
||||
@@ -1250,7 +1254,8 @@ impl Tools {
|
||||
dotnet::SDK_DOWNLOAD_URL
|
||||
)));
|
||||
};
|
||||
let pick = Http::new(&self.system_path)
|
||||
let pick = self
|
||||
.http()
|
||||
.and_then(|http| dotnet::pick_tool_version(package, sdk.major, |url| http.get_text(url, cancel)));
|
||||
match pick {
|
||||
Ok(dotnet::ToolPick::Latest) => Ok(None),
|
||||
@@ -1542,7 +1547,7 @@ impl Tools {
|
||||
cancel: &CancellationToken,
|
||||
emit: Emit,
|
||||
) -> IdeResult<()> {
|
||||
let http = Http::new(&self.system_path)?;
|
||||
let http = self.http()?;
|
||||
let message = match source {
|
||||
ReleaseSource::GitHubTag { tag, .. } => format!("Resolving release {tag}…"),
|
||||
_ => "Resolving the latest release…".into(),
|
||||
@@ -1683,7 +1688,7 @@ impl Tools {
|
||||
fn latest_version(&self, method: Method, cancel: &CancellationToken) -> IdeResult<Option<String>> {
|
||||
match method {
|
||||
Method::Release { source, assets, .. } => {
|
||||
let http = Http::new(&self.system_path)?;
|
||||
let http = self.http()?;
|
||||
Ok(Some(self.resolve_release(&http, source, assets, cancel)?.version))
|
||||
}
|
||||
Method::Npm { packages } => {
|
||||
|
||||
@@ -441,6 +441,17 @@ impl Http {
|
||||
self
|
||||
}
|
||||
|
||||
/// Looks up `gh` on `search_path` (e.g. a path that includes IDE-managed tools).
|
||||
pub(crate) fn with_gh_from(mut self, search_path: &std::ffi::OsStr) -> Self {
|
||||
self.gh = which::which_in("gh", Some(search_path), ".").ok();
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn gh_path(&self) -> Option<&Path> {
|
||||
self.gh.as_deref()
|
||||
}
|
||||
|
||||
/// Skips `GITHUB_TOKEN` / `GH_TOKEN` / `gh auth token` (e.g. retrying a public GitHub endpoint after HTTP 401).
|
||||
pub fn without_github_auth(mut self) -> Self {
|
||||
self.gh = None;
|
||||
|
||||
@@ -181,6 +181,28 @@ pub static TOOLS: &[ToolSpec] = &[
|
||||
needs: NODE,
|
||||
homepage: "https://github.com/devcontainers/cli",
|
||||
},
|
||||
ToolSpec {
|
||||
name: "gh",
|
||||
display: "GitHub CLI",
|
||||
kind: Cli,
|
||||
commands: &["gh"],
|
||||
method: Method::Release {
|
||||
source: ReleaseSource::GitHub { repo: "cli/cli" },
|
||||
assets: &[
|
||||
rule(Mac, Arm64, "gh_*_macOS_arm64.zip"),
|
||||
rule(Mac, X64, "gh_*_macOS_amd64.zip"),
|
||||
rule(Linux, Arm64, "gh_*_linux_arm64.tar.gz"),
|
||||
rule(Linux, X64, "gh_*_linux_amd64.tar.gz"),
|
||||
rule(Windows, Arm64, "gh_*_windows_arm64.zip"),
|
||||
rule(Windows, X64, "gh_*_windows_amd64.zip"),
|
||||
],
|
||||
locate: &["gh"],
|
||||
},
|
||||
fallback: None,
|
||||
version: ver("gh"),
|
||||
needs: &[],
|
||||
homepage: "https://cli.github.com",
|
||||
},
|
||||
ToolSpec {
|
||||
name: "oxfmt",
|
||||
display: "oxfmt",
|
||||
@@ -1483,4 +1505,56 @@ mod tests {
|
||||
let win_arm = Platform { os: Windows, arch: Arm64 };
|
||||
assert_eq!(select_asset(&names, rules, win_arm), Some("kotlin-server-263.7084.0-aarch64.win.zip"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gh_release_picks_portable_archive_for_every_supported_platform() {
|
||||
use crate::platform::{Platform, select_asset};
|
||||
let names = [
|
||||
"gh_2.106.0_checksums.txt",
|
||||
"gh_2.106.0_linux_386.deb",
|
||||
"gh_2.106.0_linux_386.tar.gz",
|
||||
"gh_2.106.0_linux_amd64.deb",
|
||||
"gh_2.106.0_linux_amd64.rpm",
|
||||
"gh_2.106.0_linux_amd64.tar.gz",
|
||||
"gh_2.106.0_linux_arm64.deb",
|
||||
"gh_2.106.0_linux_arm64.tar.gz",
|
||||
"gh_2.106.0_linux_armv6.tar.gz",
|
||||
"gh_2.106.0_macOS_amd64.zip",
|
||||
"gh_2.106.0_macOS_arm64.zip",
|
||||
"gh_2.106.0_macOS_universal.pkg",
|
||||
"gh_2.106.0_windows_386.zip",
|
||||
"gh_2.106.0_windows_amd64.msi",
|
||||
"gh_2.106.0_windows_amd64.zip",
|
||||
"gh_2.106.0_windows_arm64.msi",
|
||||
"gh_2.106.0_windows_arm64.zip",
|
||||
];
|
||||
let spec = find("gh").unwrap();
|
||||
assert_eq!(spec.kind, Cli);
|
||||
let rules = spec.asset_rules();
|
||||
for (os, arch, expected) in [
|
||||
(Mac, Arm64, "gh_2.106.0_macOS_arm64.zip"),
|
||||
(Mac, X64, "gh_2.106.0_macOS_amd64.zip"),
|
||||
(Linux, Arm64, "gh_2.106.0_linux_arm64.tar.gz"),
|
||||
(Linux, X64, "gh_2.106.0_linux_amd64.tar.gz"),
|
||||
(Windows, Arm64, "gh_2.106.0_windows_arm64.zip"),
|
||||
(Windows, X64, "gh_2.106.0_windows_amd64.zip"),
|
||||
] {
|
||||
assert_eq!(select_asset(&names, rules, Platform { os, arch }), Some(expected));
|
||||
}
|
||||
|
||||
let Method::Release { locate, .. } = &spec.method else { unreachable!() };
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let unix_bin = tmp.path().join("gh_2.106.0_macOS_arm64/bin/gh");
|
||||
std::fs::create_dir_all(unix_bin.parent().unwrap()).unwrap();
|
||||
std::fs::write(&unix_bin, "").unwrap();
|
||||
let unix_names: Vec<String> = locate.iter().map(|n| (*n).to_owned()).collect();
|
||||
assert_eq!(crate::archive::locate(tmp.path(), &unix_names), Some(unix_bin));
|
||||
|
||||
let win_dir = tempfile::tempdir().unwrap();
|
||||
let win_bin = win_dir.path().join("bin/gh.exe");
|
||||
std::fs::create_dir_all(win_bin.parent().unwrap()).unwrap();
|
||||
std::fs::write(&win_bin, "").unwrap();
|
||||
let win_names: Vec<String> = locate.iter().map(|n| format!("{n}.exe")).collect();
|
||||
assert_eq!(crate::archive::locate(win_dir.path(), &win_names), Some(win_bin));
|
||||
}
|
||||
}
|
||||
@@ -147,6 +147,11 @@ fn pick_release(
|
||||
let checksum_url = assets
|
||||
.iter()
|
||||
.find(|c| c.name == format!("{name}.sha256") || c.name == format!("{name}.sha256sum"))
|
||||
.or_else(|| {
|
||||
assets
|
||||
.iter()
|
||||
.find(|c| c.name.eq_ignore_ascii_case("checksums.txt") || c.name.ends_with("_checksums.txt"))
|
||||
})
|
||||
.map(|c| c.url.clone());
|
||||
return Ok(Download {
|
||||
version,
|
||||
@@ -622,6 +627,28 @@ mod tests {
|
||||
let sums = format!("{} other.zip\n{} *wanted.zip\n", "b".repeat(64), "C".repeat(64));
|
||||
assert_eq!(parse_checksum(&sums, "wanted.zip"), Some("c".repeat(64)));
|
||||
assert_eq!(parse_checksum(&sums, "missing.zip"), None);
|
||||
|
||||
let gh = serde_json::json!({
|
||||
"tag_name": "v2.106.0",
|
||||
"assets": [
|
||||
{
|
||||
"name": "gh_2.106.0_macOS_arm64.zip",
|
||||
"browser_download_url": "https://github.com/cli/cli/releases/download/v2.106.0/gh_2.106.0_macOS_arm64.zip"
|
||||
},
|
||||
{
|
||||
"name": "gh_2.106.0_checksums.txt",
|
||||
"browser_download_url": "https://github.com/cli/cli/releases/download/v2.106.0/gh_2.106.0_checksums.txt"
|
||||
}
|
||||
]
|
||||
})
|
||||
.to_string();
|
||||
let dl = github_pick(&gh, find("gh").unwrap().asset_rules(), MAC_ARM).unwrap();
|
||||
assert_eq!(dl.version, "2.106.0");
|
||||
assert_eq!(dl.name, "gh_2.106.0_macOS_arm64.zip");
|
||||
assert_eq!(
|
||||
dl.checksum_url.as_deref(),
|
||||
Some("https://github.com/cli/cli/releases/download/v2.106.0/gh_2.106.0_checksums.txt")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1428,3 +1428,27 @@ fn a_mirror_never_installs_what_it_alone_vouches_for() {
|
||||
let err = check_sha256(&archive, &dl(Some(&digest)), Some(&"0".repeat(64)), true, &emit).unwrap_err();
|
||||
assert!(err.message.contains("checksum mismatch"), "{}", err.message);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn managed_gh_is_detected_on_tools_bin_dirs_and_available_to_http() {
|
||||
let env = Env::new();
|
||||
env.script(&env.sys, "curl", "exit 0");
|
||||
let app_data = env.root.parent().unwrap();
|
||||
let gh_bin = env.root.join("gh/bin");
|
||||
assert!(tools_bin_dirs(app_data).contains(&gh_bin));
|
||||
|
||||
let missing = env.tools().info("gh", &[]).unwrap();
|
||||
assert_eq!(missing.kind, ToolKind::Cli);
|
||||
assert_eq!(missing.status, ToolStatus::Missing);
|
||||
assert!(missing.can_install);
|
||||
|
||||
env.script(&gh_bin, "gh", "echo 'gh version 2.106.0 (2026-11-20)'");
|
||||
let installed = env.tools().info("gh", &[]).unwrap();
|
||||
assert_eq!(installed.status, ToolStatus::Installed);
|
||||
assert_eq!(installed.version.as_deref(), Some("2.106.0"));
|
||||
assert!(installed.can_uninstall);
|
||||
|
||||
let http = env.tools().http().unwrap();
|
||||
assert_eq!(http.gh_path(), Some(gh_bin.join("gh").as_path()));
|
||||
}
|
||||
@@ -156,10 +156,12 @@ With tabs placed left or right, the tab column is as wide as its longest name, u
|
||||
| **Scroll Down** | — | `Ctrl+Down` |
|
||||
| **Scroll Up and Move if Necessary** | — | — |
|
||||
| **Scroll Down and Move if Necessary** | — | — |
|
||||
| **Move Up and Scroll** | — | — |
|
||||
| **Move Down and Scroll** | — | — |
|
||||
| **Scroll to Top** | — | — |
|
||||
| **Scroll to Bottom** | — | — |
|
||||
|
||||
**Scroll Up** and **Scroll Down** move the view by one line and leave the caret where it is, even when it scrolls out of sight. **Scroll Up and Move if Necessary** and **Scroll Down and Move if Necessary** also move the view by one line, but bring a caret the view doesn't show to its first or last line. **Scroll to Top** and **Scroll to Bottom** show the start and the end of the file; the caret stays where it is too. They have no default shortcut: run them from Find Action or assign one in **Settings › Keymap**.
|
||||
**Scroll Up** and **Scroll Down** move the view by one line and leave the caret where it is, even when it scrolls out of sight. **Scroll Up and Move if Necessary** and **Scroll Down and Move if Necessary** also move the view by one line, but bring a caret the view doesn't show to its first or last line. **Move Up and Scroll** and **Move Down and Scroll** move the caret one line and the view with it, so the caret stays in the same place on screen; their **with Selection** variants select as they go. **Scroll to Top** and **Scroll to Bottom** show the start and the end of the file; the caret stays where it is too. They have no default shortcut: run them from Find Action or assign one in **Settings › Keymap**.
|
||||
|
||||
- **View › Active Editor › Soft-Wrap** wraps long lines in the current editor. To wrap some file types by default, use **Settings › Editor › General**, section **Soft Wraps**.
|
||||
- **View › Reset Font Size** undoes font zoom in the active editor or focused surface (**View › Reset Font Size in All Editors** resets every open editor). Changing the font size with `⌘` / `Ctrl` + mouse wheel (scoped to **Active editor** by default, or **All editors**) can be turned on in **Settings › Editor › General**, section **Mouse Control**.
|
||||
|
||||
@@ -9,9 +9,11 @@ OpenIDEA works with GitHub through the [GitHub CLI](https://cli.github.com) (`gh
|
||||
|
||||
<Steps>
|
||||
<Step title="Install gh">
|
||||
Install the GitHub CLI. OpenIDEA looks for it in `OPENIDEA_GH` (a full path), then on `PATH`, then in
|
||||
`/opt/homebrew/bin`, `/usr/local/bin`, `/usr/bin`, `/snap/bin` (macOS/Linux) or `C:\Program Files\GitHub CLI\gh.exe`
|
||||
(Windows).
|
||||
Install the GitHub CLI, either from OpenIDEA's **Install GitHub CLI** button (in the **Pull Requests** tool window,
|
||||
**Clone Repository › GitHub**, **Settings › Agents › GitHub Copilot**, or **Settings › Languages & Frameworks ›
|
||||
Language Servers › Other Tools**) or manually. OpenIDEA looks for it in `OPENIDEA_GH` (a full path), then on `PATH`
|
||||
(including IDE-managed tools), then in `/opt/homebrew/bin`, `/usr/local/bin`, `/usr/bin`, `/snap/bin` (macOS/Linux)
|
||||
or `C:\Program Files\GitHub CLI\gh.exe` (Windows).
|
||||
</Step>
|
||||
<Step title="Sign in">
|
||||
Run `gh auth login` in a terminal. If you open the **Pull Requests** tool window while signed out, it shows **Not
|
||||
|
||||
@@ -31,7 +31,7 @@ Scratch files are saved in a `scratches` folder in OpenIDEA's application data d
|
||||
| Windows | `%APPDATA%\ai.l0ng.openidea\scratches` |
|
||||
| Linux | `~/.local/share/ai.l0ng.openidea/scratches` |
|
||||
|
||||
They are listed under **Scratches** in the Project view, where you can open, rename and delete them like other files.
|
||||
They are listed under **Scratches** in the Project view, where you can open, rename and delete them like other files. To hide that node, turn off **Show Scratches and Consoles** in the Project view's **Options › Appearance** menu; the **Scratches and Consoles** view still lists them.
|
||||
|
||||
Because a scratch file is outside every project, some language servers give it only syntax checks; completion and navigation may be limited. A banner at the top of the editor says so when the server reports it.
|
||||
|
||||
|
||||
@@ -154,10 +154,12 @@ description: "多光标与选区、行编辑、剪贴板历史、代码折叠、
|
||||
| **向下滚动** | — | `Ctrl+Down` |
|
||||
| **向上滚动并在必要时移动光标** | — | — |
|
||||
| **向下滚动并在必要时移动光标** | — | — |
|
||||
| **向上移动并滚动** | — | — |
|
||||
| **向下移动并滚动** | — | — |
|
||||
| **滚动到顶部** | — | — |
|
||||
| **滚动到底部** | — | — |
|
||||
|
||||
**向上滚动** 和 **向下滚动** 把视图移动一行,光标保持原位,即使它因此移出可见区域。**向上滚动并在必要时移动光标** 和 **向下滚动并在必要时移动光标** 同样把视图移动一行,但会把不在视图中的光标移到视图的第一行或最后一行。**滚动到顶部** 和 **滚动到底部** 显示文件的开头和结尾;光标同样保持原位。它们默认没有快捷键:在查找操作中运行,或在 **设置 › 按键映射** 中指定。
|
||||
**向上滚动** 和 **向下滚动** 把视图移动一行,光标保持原位,即使它因此移出可见区域。**向上滚动并在必要时移动光标** 和 **向下滚动并在必要时移动光标** 同样把视图移动一行,但会把不在视图中的光标移到视图的第一行或最后一行。**向上移动并滚动** 和 **向下移动并滚动** 把光标移动一行,视图随之滚动同样的距离,光标在屏幕上的位置保持不变;对应的 **并选择** 版本边移动边选择。**滚动到顶部** 和 **滚动到底部** 显示文件的开头和结尾;光标同样保持原位。它们默认没有快捷键:在查找操作中运行,或在 **设置 › 按键映射** 中指定。
|
||||
|
||||
- **视图 › 活动编辑器 › 软换行** 让当前编辑器的长行自动折行。想让某些文件类型默认软换行,在 **设置 › 编辑器 › 常规** 的 **软换行** 一节中设置。
|
||||
- **视图 › 重置字体大小** 撤销当前编辑器或焦点区域的字体缩放(**视图 › 重置所有编辑器中的字体大小** 会重置所有打开的编辑器)。用 `⌘` / `Ctrl` + 鼠标滚轮调整字号的功能默认关闭,可在 **设置 › 编辑器 › 常规** 的 **鼠标控制** 一节中打开,并可选择作用于 **当前编辑器**(默认)或 **所有编辑器**。
|
||||
|
||||
@@ -9,9 +9,10 @@ OpenIDEA 通过 [GitHub CLI](https://cli.github.com)(`gh`)对接 GitHub:
|
||||
|
||||
<Steps>
|
||||
<Step title="安装 gh">
|
||||
安装 GitHub CLI。OpenIDEA 依次在 `OPENIDEA_GH`(完整路径)、`PATH`,以及
|
||||
`/opt/homebrew/bin`、`/usr/local/bin`、`/usr/bin`、`/snap/bin`(macOS/Linux)或 `C:\Program Files\GitHub
|
||||
CLI\gh.exe`(Windows)中查找。
|
||||
安装 GitHub CLI:可以直接点击 OpenIDEA 里的 **安装 GitHub CLI** 按钮(位于 **拉取请求** 工具窗口、**克隆仓库 ›
|
||||
GitHub**、**设置 › 智能体 › GitHub Copilot** 或 **设置 › 语言与框架 › 语言服务器 › 其他工具**),也可以手动安装。
|
||||
OpenIDEA 依次在 `OPENIDEA_GH`(完整路径)、`PATH`(包含 IDE 管理的工具目录),以及 `/opt/homebrew/bin`、
|
||||
`/usr/local/bin`、`/usr/bin`、`/snap/bin`(macOS/Linux)或 `C:\Program Files\GitHub CLI\gh.exe`(Windows)中查找。
|
||||
</Step>
|
||||
<Step title="登录">
|
||||
在终端运行 `gh auth login`。未登录时打开 **拉取请求** 工具窗口,会显示 **未登录 GitHub** 和 **运行 gh auth login**
|
||||
|
||||
@@ -31,7 +31,7 @@ description: "在项目之外保留临时文件,并在 TODO 工具窗口中汇
|
||||
| Windows | `%APPDATA%\ai.l0ng.openidea\scratches` |
|
||||
| Linux | `~/.local/share/ai.l0ng.openidea/scratches` |
|
||||
|
||||
它们列在项目视图的 **临时文件** 节点下,可以像其他文件一样打开、重命名和删除。
|
||||
它们列在项目视图的 **临时文件** 节点下,可以像其他文件一样打开、重命名和删除。要隐藏这个节点,可在项目视图的 **选项 › 外观** 菜单中关闭 **显示临时文件和控制台**;**临时文件和控制台** 视图仍会列出它们。
|
||||
|
||||
临时文件不属于任何项目,所以部分语言服务器只对它做语法检查,补全和导航可能受限;服务器报告这种情况时,编辑器顶部会显示横幅说明。
|
||||
|
||||
|
||||
@@ -97,7 +97,14 @@ import {
|
||||
} from "./cm/caretCommands";
|
||||
import { isOverwrite, toggleOverwrite } from "./cm/overwrite";
|
||||
import { isColumnMode, toggleColumnMode } from "./cm/columnMode";
|
||||
import { cloneCaretAbove, cloneCaretBelow } from "./cm/verticalMotion";
|
||||
import {
|
||||
cloneCaretAbove,
|
||||
cloneCaretBelow,
|
||||
moveDownAndScroll,
|
||||
moveDownAndScrollWithSelection,
|
||||
moveUpAndScroll,
|
||||
moveUpAndScrollWithSelection,
|
||||
} from "./cm/verticalMotion";
|
||||
import { pasteAsPlainText, pasteFromHistory, unwrapAtCaret } from "./extras";
|
||||
import { cyclicExpandWord } from "./wordCompletion";
|
||||
import { copyReferenceToClipboard, declaredName, qualifiedReference, referenceOffset } from "./copyReference";
|
||||
@@ -1067,6 +1074,22 @@ export function registerEditorActions(): () => void {
|
||||
caret("editor.scrollDownAndMove", "Scroll Down and Move if Necessary", (v) => scrollDownAndMove(v), {
|
||||
category: "Editor Actions",
|
||||
}),
|
||||
caret("editor.moveUpAndScroll", "Move Up and Scroll", (v) => moveUpAndScroll(v), { category: "Editor Actions" }),
|
||||
caret("editor.moveDownAndScroll", "Move Down and Scroll", (v) => moveDownAndScroll(v), {
|
||||
category: "Editor Actions",
|
||||
}),
|
||||
caret(
|
||||
"editor.moveUpAndScrollWithSelection",
|
||||
"Move Up and Scroll with Selection",
|
||||
(v) => moveUpAndScrollWithSelection(v),
|
||||
{ category: "Editor Actions" },
|
||||
),
|
||||
caret(
|
||||
"editor.moveDownAndScrollWithSelection",
|
||||
"Move Down and Scroll with Selection",
|
||||
(v) => moveDownAndScrollWithSelection(v),
|
||||
{ category: "Editor Actions" },
|
||||
),
|
||||
caret("editor.scrollToTop", "Scroll to Top", (v) => scrollToTop(v), { category: "Editor Actions" }),
|
||||
caret("editor.scrollToBottom", "Scroll to Bottom", (v) => scrollToBottom(v), { category: "Editor Actions" }),
|
||||
caret("editor.moveToPageTop", "Move Caret to Page Top", (v) => cursorPageTop(v), { category: "Editor Actions" }),
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
// @vitest-environment jsdom
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { EditorState } from "@codemirror/state";
|
||||
import { EditorView } from "@codemirror/view";
|
||||
import { EditorSelection, EditorState, StateEffect } from "@codemirror/state";
|
||||
import { Decoration, EditorView, WidgetType } from "@codemirror/view";
|
||||
import {
|
||||
cloneCaretAbove,
|
||||
cloneCaretBelow,
|
||||
cursorLineDown,
|
||||
cursorLineUp,
|
||||
moveDownAndScroll,
|
||||
moveDownAndScrollWithSelection,
|
||||
moveUpAndScroll,
|
||||
moveUpAndScrollWithSelection,
|
||||
selectLineDown,
|
||||
visibleGoalColumns,
|
||||
} from "./verticalMotion";
|
||||
@@ -106,3 +110,122 @@ describe("Clone Caret Above / Below in visible columns", () => {
|
||||
expect(cloneCaretAbove(v)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Move Up / Down and Scroll", () => {
|
||||
/** jsdom has no layout: record what the command asks the scroller for, and whether it scrolled to the caret. */
|
||||
function track(v: EditorView, start: number) {
|
||||
let top = start;
|
||||
Object.defineProperty(v.scrollDOM, "scrollTop", {
|
||||
configurable: true,
|
||||
get: () => top,
|
||||
set: (x: number) => (top = x),
|
||||
});
|
||||
const scrolledToCaret: boolean[] = [];
|
||||
v.dispatch({
|
||||
effects: StateEffect.appendConfig.of(
|
||||
EditorView.updateListener.of((u) => u.transactions.forEach((tr) => scrolledToCaret.push(tr.scrollIntoView))),
|
||||
),
|
||||
});
|
||||
scrolledToCaret.length = 0;
|
||||
return { top: () => top, scrolledToCaret };
|
||||
}
|
||||
const rowGap = (v: EditorView, from: number, to: number) =>
|
||||
v.lineBlockAt(v.state.doc.line(to).from).top - v.lineBlockAt(v.state.doc.line(from).from).top;
|
||||
|
||||
it("moves the caret one line and scrolls the view by the same amount", () => {
|
||||
const v = make("abcdef\nabcdef\nabcdef\nabcdef", 7 + 3);
|
||||
const t = track(v, 100);
|
||||
const gap = rowGap(v, 2, 3);
|
||||
expect(gap).toBeGreaterThan(0);
|
||||
expect(moveDownAndScroll(v)).toBe(true);
|
||||
expect(heads(v)).toEqual([14 + 3]);
|
||||
expect(t.top()).toBe(100 + gap);
|
||||
expect(moveUpAndScroll(v)).toBe(true);
|
||||
expect(moveUpAndScroll(v)).toBe(true);
|
||||
expect(heads(v)).toEqual([3]);
|
||||
expect(t.top()).toBe(100 - rowGap(v, 1, 2));
|
||||
expect(v.state.selection.main.empty).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps the goal column across a short line", () => {
|
||||
const v = make("abcdefgh\n张\nabcdefgh", 6);
|
||||
track(v, 0);
|
||||
moveDownAndScroll(v);
|
||||
moveDownAndScroll(v);
|
||||
expect(heads(v)).toEqual([11 + 6]);
|
||||
});
|
||||
|
||||
it("with Selection extends from the anchor", () => {
|
||||
const v = make("abcd\nabcd\nabcd", 5 + 2);
|
||||
const t = track(v, 40);
|
||||
moveDownAndScrollWithSelection(v);
|
||||
expect([v.state.selection.main.anchor, v.state.selection.main.head]).toEqual([7, 12]);
|
||||
moveUpAndScrollWithSelection(v);
|
||||
moveUpAndScrollWithSelection(v);
|
||||
expect([v.state.selection.main.anchor, v.state.selection.main.head]).toEqual([7, 2]);
|
||||
expect(t.top()).toBe(40 - rowGap(v, 1, 2));
|
||||
});
|
||||
|
||||
it("moves every caret and scrolls with the primary one", () => {
|
||||
const v = make("ab\nab\nab\nab", 0);
|
||||
v.dispatch({ selection: EditorSelection.create([EditorSelection.cursor(1), EditorSelection.cursor(7)], 1) });
|
||||
const t = track(v, 0);
|
||||
moveDownAndScroll(v);
|
||||
expect(heads(v)).toEqual([4, 10]);
|
||||
expect(v.state.selection.mainIndex).toBe(1);
|
||||
expect(t.top()).toBe(rowGap(v, 3, 4));
|
||||
});
|
||||
|
||||
it("leaves scrolling to itself: never scrolls a caret out of view back into it", () => {
|
||||
const v = make("ab\nab\nab", 1);
|
||||
const t = track(v, 500);
|
||||
moveDownAndScroll(v);
|
||||
expect(t.scrolledToCaret).toEqual([false]);
|
||||
expect(t.top()).toBe(500 + rowGap(v, 1, 2));
|
||||
});
|
||||
|
||||
it("drops a selection and moves one line from its caret", () => {
|
||||
const v = make("abcd\nabcd\nabcd\nabcd", 0);
|
||||
v.dispatch({ selection: { anchor: 15 + 2, head: 2 } });
|
||||
const t = track(v, 0);
|
||||
moveDownAndScroll(v);
|
||||
expect(v.state.selection.main.empty).toBe(true);
|
||||
expect(heads(v)).toEqual([5 + 2]);
|
||||
expect(t.top()).toBe(rowGap(v, 1, 2));
|
||||
});
|
||||
|
||||
it("measures to the text of a line below a block widget (code lens)", () => {
|
||||
class Lens extends WidgetType {
|
||||
toDOM() {
|
||||
return document.createElement("div");
|
||||
}
|
||||
get estimatedHeight() {
|
||||
return 40;
|
||||
}
|
||||
}
|
||||
const v = make("ab\nab\nab", 1);
|
||||
const lens = Decoration.widget({ widget: new Lens(), block: true, side: -1 }).range(3);
|
||||
v.dispatch({ effects: StateEffect.appendConfig.of(EditorView.decorations.of(Decoration.set([lens]))) });
|
||||
const t = track(v, 0);
|
||||
const line = v.lineBlockAt(0).height;
|
||||
expect(v.lineBlockAt(3).height).toBeGreaterThan(line);
|
||||
moveDownAndScroll(v);
|
||||
expect(heads(v)).toEqual([4]);
|
||||
expect(t.top()).toBe(v.lineBlockAt(3).bottom - line);
|
||||
moveUpAndScroll(v);
|
||||
expect(t.top()).toBe(0);
|
||||
});
|
||||
|
||||
it("does not scroll at the document edge", () => {
|
||||
const v = make("ab\ncd", 1);
|
||||
const t = track(v, 0);
|
||||
expect(moveUpAndScroll(v)).toBe(true);
|
||||
expect(heads(v)).toEqual([0]);
|
||||
expect(moveUpAndScroll(v)).toBe(false);
|
||||
v.dispatch({ selection: { anchor: 4 } });
|
||||
expect(moveDownAndScroll(v)).toBe(true);
|
||||
expect(moveDownAndScroll(v)).toBe(false);
|
||||
expect(heads(v)).toEqual([5]);
|
||||
expect(t.top()).toBe(0);
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,7 @@
|
||||
* CodeMirror's pixel motion between their visual rows.
|
||||
*/
|
||||
import { EditorSelection, StateEffect, StateField, type EditorState, type SelectionRange } from "@codemirror/state";
|
||||
import type { Command, EditorView } from "@codemirror/view";
|
||||
import { BlockType, type BlockInfo, type Command, type EditorView } from "@codemirror/view";
|
||||
import { offsetAtVisibleColumn, visibleColumn } from "./visibleColumn";
|
||||
|
||||
/** Goal visible column per caret head, kept while only these commands move the carets. */
|
||||
@@ -52,11 +52,12 @@ export function verticalHead(view: EditorView, head: number, forward: boolean, g
|
||||
return moved === head ? null : moved;
|
||||
}
|
||||
|
||||
function moveCarets(view: EditorView, forward: boolean, extend: boolean): boolean {
|
||||
/** `fromHead`: drop a selection and move its caret on from the head, as IDEA's caret-relative moves do. */
|
||||
function moveCarets(view: EditorView, forward: boolean, extend: boolean, fromHead = false): boolean {
|
||||
const { state } = view;
|
||||
const goals = new Map<number, number>();
|
||||
const ranges = state.selection.ranges.map((r): SelectionRange => {
|
||||
if (!extend && !r.empty) return EditorSelection.cursor(forward ? r.to : r.from);
|
||||
if (!extend && !fromHead && !r.empty) return EditorSelection.cursor(forward ? r.to : r.from);
|
||||
const goal = goalOf(state, r.head);
|
||||
let head = verticalHead(view, r.head, forward, goal);
|
||||
if (head === null) head = forward ? state.doc.lineAt(r.head).to : state.doc.lineAt(r.head).from;
|
||||
@@ -65,7 +66,8 @@ function moveCarets(view: EditorView, forward: boolean, extend: boolean): boolea
|
||||
});
|
||||
const selection = EditorSelection.create(ranges, state.selection.mainIndex);
|
||||
if (selection.eq(state.selection)) return false;
|
||||
view.dispatch({ selection, effects: setGoals.of(goals), scrollIntoView: true, userEvent: "select" });
|
||||
// The caret-relative moves scroll the view themselves and may leave the caret out of view.
|
||||
view.dispatch({ selection, effects: setGoals.of(goals), scrollIntoView: !fromHead, userEvent: "select" });
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -74,6 +76,41 @@ export const cursorLineDown: Command = (view) => moveCarets(view, true, false);
|
||||
export const selectLineUp: Command = (view) => moveCarets(view, false, true);
|
||||
export const selectLineDown: Command = (view) => moveCarets(view, true, true);
|
||||
|
||||
/** Top of the text of the line at `pos`, in document coordinates: below any block widgets (code lens, inline diff) joined to its line block. */
|
||||
function lineTextTop(view: EditorView, pos: number): number {
|
||||
const block = view.lineBlockAt(pos);
|
||||
if (!Array.isArray(block.type)) return block.top;
|
||||
const parts = block.type as readonly BlockInfo[];
|
||||
return (parts.find((b) => b.type === BlockType.Text && b.from <= pos && pos <= b.to) ?? block).top;
|
||||
}
|
||||
|
||||
/** Screen top of the caret's visual row when soft wrap splits lines into rows and the caret is drawn; otherwise null. */
|
||||
function caretRowTop(view: EditorView): number | null {
|
||||
if (!view.lineWrapping) return null;
|
||||
const { head, assoc } = view.state.selection.main;
|
||||
return view.coordsAtPos(head, assoc || 1)?.top ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move Up / Down and Scroll (with Selection), as IDEA: the carets move one line and
|
||||
* the view scrolls by as much, so the primary caret keeps its place on screen.
|
||||
*/
|
||||
function moveAndScroll(view: EditorView, forward: boolean, extend: boolean): boolean {
|
||||
const before = { row: caretRowTop(view), line: lineTextTop(view, view.state.selection.main.head) };
|
||||
if (!moveCarets(view, forward, extend, true)) return false;
|
||||
const row = before.row === null ? null : caretRowTop(view);
|
||||
view.scrollDOM.scrollTop +=
|
||||
row !== null && before.row !== null
|
||||
? row - before.row
|
||||
: lineTextTop(view, view.state.selection.main.head) - before.line;
|
||||
return true;
|
||||
}
|
||||
|
||||
export const moveUpAndScroll: Command = (view) => moveAndScroll(view, false, false);
|
||||
export const moveDownAndScroll: Command = (view) => moveAndScroll(view, true, false);
|
||||
export const moveUpAndScrollWithSelection: Command = (view) => moveAndScroll(view, false, true);
|
||||
export const moveDownAndScrollWithSelection: Command = (view) => moveAndScroll(view, true, true);
|
||||
|
||||
/** Clone Caret Above / Below: a caret on the next line at each caret's goal column. */
|
||||
function cloneCaret(view: EditorView, forward: boolean): boolean {
|
||||
const { state } = view;
|
||||
|
||||
@@ -2,13 +2,18 @@ import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
|
||||
const ghAccountRepos = vi.fn();
|
||||
const toolsList = vi.fn();
|
||||
vi.mock("@/platform/ipc", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@/platform/ipc")>()),
|
||||
isTauri: () => true,
|
||||
commands: { ghAccountRepos: () => ghAccountRepos() },
|
||||
commands: {
|
||||
ghAccountRepos: () => ghAccountRepos(),
|
||||
toolsList: () => toolsList(),
|
||||
},
|
||||
}));
|
||||
|
||||
import type { GhAccountRepo } from "@/bindings";
|
||||
import { registerAction } from "@/platform/actions";
|
||||
import { GitHubCloneSource, matchRepos } from "./GitHubCloneSource";
|
||||
|
||||
const repo = (nameWithOwner: string, extra: Partial<GhAccountRepo> = {}): GhAccountRepo => ({
|
||||
@@ -25,6 +30,7 @@ const repos = [repo("me/app", { private: true, description: "The app" }), repo("
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
ghAccountRepos.mockReset();
|
||||
toolsList.mockReset();
|
||||
});
|
||||
|
||||
describe("GitHub clone source", () => {
|
||||
@@ -64,4 +70,21 @@ describe("GitHub clone source", () => {
|
||||
fireEvent.click(screen.getByRole("button", { name: "Retry" }));
|
||||
await waitFor(() => expect(screen.getByRole("option", { name: /me\/app/ })).toBeInTheDocument());
|
||||
});
|
||||
|
||||
it("installs GitHub CLI in-app when missing and reloads repositories", async () => {
|
||||
const install = vi.fn().mockResolvedValue(undefined);
|
||||
const dispose = registerAction({ id: "tools.install", title: "Install", run: install });
|
||||
ghAccountRepos.mockResolvedValueOnce({ status: "ok", data: { kind: "notInstalled" } });
|
||||
toolsList.mockResolvedValue({ status: "ok", data: [{ name: "gh", status: "installed" }] });
|
||||
ghAccountRepos.mockResolvedValueOnce({ status: "ok", data: { kind: "ready", login: "me", repos } });
|
||||
try {
|
||||
render(<GitHubCloneSource url="" onUrl={() => {}} onClone={() => {}} disabled={false} />);
|
||||
expect(await screen.findByText("GitHub CLI is not installed")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Install GitHub CLI" }));
|
||||
await waitFor(() => expect(install).toHaveBeenCalledWith(expect.objectContaining({ arg: "gh" })));
|
||||
await waitFor(() => expect(screen.getByRole("option", { name: /me\/app/ })).toBeInTheDocument());
|
||||
} finally {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,9 @@
|
||||
/** Clone Repository › GitHub: the repositories of the account gh is signed in to. */
|
||||
import { useEffect, useMemo, useState, type KeyboardEvent } from "react";
|
||||
import type { GhAccountRepo, GhAccountRepos } from "@/bindings";
|
||||
import { GH_MANUAL_INSTALL_URL, installGhTool } from "@/platform/ghTool";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { call, commands } from "@/platform/ipc";
|
||||
import { call, commands, isCancelled } from "@/platform/ipc";
|
||||
import {
|
||||
Button,
|
||||
EmptyState,
|
||||
@@ -37,6 +38,8 @@ export function GitHubCloneSource({ url, onUrl, onClone, disabled }: CloneSource
|
||||
const [state, setState] = useState<GhAccountRepos | null>(null);
|
||||
const [query, setQuery] = useState("");
|
||||
const [attempt, setAttempt] = useState(0);
|
||||
const [installingGh, setInstallingGh] = useState(false);
|
||||
const [installError, setInstallError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
@@ -50,14 +53,26 @@ export function GitHubCloneSource({ url, onUrl, onClone, disabled }: CloneSource
|
||||
|
||||
const rows = useMemo(() => (state?.kind === "ready" ? matchRepos(state.repos, query) : []), [state, query]);
|
||||
const active = rows.findIndex((r) => r.repo.cloneUrl === url);
|
||||
const reload = () => {
|
||||
setInstallError(null);
|
||||
setState(null);
|
||||
setAttempt((n) => n + 1);
|
||||
};
|
||||
const installGh = () => {
|
||||
if (installingGh) return;
|
||||
setInstallingGh(true);
|
||||
setInstallError(null);
|
||||
void installGhTool()
|
||||
.promise.then((installed) => {
|
||||
if (installed) reload();
|
||||
})
|
||||
.catch((e: unknown) => {
|
||||
if (!isCancelled(e)) setInstallError(e instanceof Error ? e.message : String(e));
|
||||
})
|
||||
.finally(() => setInstallingGh(false));
|
||||
};
|
||||
const retry = (
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() => {
|
||||
setState(null);
|
||||
setAttempt((n) => n + 1);
|
||||
}}
|
||||
>
|
||||
<Button size="small" onClick={reload}>
|
||||
<T>Retry</T>
|
||||
</Button>
|
||||
);
|
||||
@@ -77,15 +92,24 @@ export function GitHubCloneSource({ url, onUrl, onClone, disabled }: CloneSource
|
||||
title="GitHub CLI is not installed"
|
||||
actions={
|
||||
<>
|
||||
<Button size="small" onClick={() => void openInBrowser("https://cli.github.com")}>
|
||||
<T>Install gh…</T>
|
||||
<Button size="small" variant="primary" disabled={installingGh} onClick={installGh}>
|
||||
{installingGh ? (
|
||||
<>
|
||||
<Spinner size={12} /> <T>Installing…</T>
|
||||
</>
|
||||
) : (
|
||||
<T>Install GitHub CLI</T>
|
||||
)}
|
||||
</Button>
|
||||
<Button size="small" onClick={() => void openInBrowser(GH_MANUAL_INSTALL_URL)}>
|
||||
<T>Download manually…</T>
|
||||
</Button>
|
||||
{retry}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<T>GitHub repositories are listed with the</T> <code>gh</code> <T>command line tool. Install it, then run</T>{" "}
|
||||
<code>gh auth login</code>.
|
||||
<code>gh auth login</code>.{installError && <div className={styles.muted}>{installError}</div>}
|
||||
</EmptyState>
|
||||
);
|
||||
if (state.kind === "notLoggedIn")
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
import { useEffect, useRef, useState, type RefObject } from "react";
|
||||
import type { GhAvailability } from "@/platform/ipc";
|
||||
import { executeAction } from "@/platform/actions";
|
||||
import { GH_MANUAL_INSTALL_URL, installGhTool } from "@/platform/ghTool";
|
||||
import { isCancelled } from "@/platform/ipc";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { Button, EmptyState, IconButton, Select, Spinner, Tabs, T, showContextMenu, type MenuItem } from "@/ui";
|
||||
import { CreatePanel } from "../create/CreatePanel";
|
||||
@@ -28,6 +30,21 @@ import { closeTab, selectTab, tabId, useGhTabs, type GhTabId } from "./store";
|
||||
import styles from "./ToolWindow.module.css";
|
||||
|
||||
function Unavailable({ availability }: { availability: GhAvailability }) {
|
||||
const [installingGh, setInstallingGh] = useState(false);
|
||||
const [installError, setInstallError] = useState<string | null>(null);
|
||||
const installGh = () => {
|
||||
if (installingGh) return;
|
||||
setInstallingGh(true);
|
||||
setInstallError(null);
|
||||
void installGhTool()
|
||||
.promise.then((installed) => {
|
||||
if (installed) void refreshConnection();
|
||||
})
|
||||
.catch((e: unknown) => {
|
||||
if (!isCancelled(e)) setInstallError(e instanceof Error ? e.message : String(e));
|
||||
})
|
||||
.finally(() => setInstallingGh(false));
|
||||
};
|
||||
const retry = (
|
||||
<Button size="small" onClick={() => void refreshConnection()}>
|
||||
<T>Retry</T>
|
||||
@@ -40,15 +57,24 @@ function Unavailable({ availability }: { availability: GhAvailability }) {
|
||||
title="GitHub CLI is not installed"
|
||||
actions={
|
||||
<>
|
||||
<Button size="small" onClick={() => void openInBrowser("https://cli.github.com")}>
|
||||
<T>Install gh…</T>
|
||||
<Button size="small" variant="primary" disabled={installingGh} onClick={installGh}>
|
||||
{installingGh ? (
|
||||
<>
|
||||
<Spinner size={12} /> <T>Installing…</T>
|
||||
</>
|
||||
) : (
|
||||
<T>Install GitHub CLI</T>
|
||||
)}
|
||||
</Button>
|
||||
<Button size="small" onClick={() => void openInBrowser(GH_MANUAL_INSTALL_URL)}>
|
||||
<T>Download manually…</T>
|
||||
</Button>
|
||||
{retry}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<T>Pull requests use the</T> <code>gh</code> <T>command line tool. Install it, then run</T>{" "}
|
||||
<code>gh auth login</code>.
|
||||
<code>gh auth login</code>.{installError && <div className={styles.hint}>{installError}</div>}
|
||||
</EmptyState>
|
||||
);
|
||||
case "notLoggedIn":
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { act, render, screen } from "@testing-library/react";
|
||||
import { getAction } from "@/platform/actions";
|
||||
import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { getAction, registerAction } from "@/platform/actions";
|
||||
import { getContext } from "@/platform/context";
|
||||
import * as ipc from "@/platform/ipc";
|
||||
import { provideToolWindowService, useContributions, type ToolWindowService } from "@/workbench/contributions";
|
||||
import { activate } from "../index";
|
||||
import { setCurrentRepository } from "../api/client";
|
||||
import type { GHRepository, GHUser } from "../api/types";
|
||||
import * as repositoryData from "../data/repository";
|
||||
import { useGhRepository } from "../data/repository";
|
||||
import { PullRequestsTabs, PullRequestsToolWindow } from "./PullRequestsToolWindow";
|
||||
import {
|
||||
@@ -122,10 +123,21 @@ describe("tool window", () => {
|
||||
expect(show).toHaveBeenCalledWith("pullRequests", true);
|
||||
});
|
||||
|
||||
it("shows gh's state when it is not ready", () => {
|
||||
useGhRepository.setState({ availability: { kind: "notInstalled" } });
|
||||
render(<PullRequestsToolWindow />);
|
||||
expect(screen.getByText("GitHub CLI is not installed")).toBeTruthy();
|
||||
it("shows gh's state when it is not ready and installs gh on click", async () => {
|
||||
const install = vi.fn().mockResolvedValue(undefined);
|
||||
const dispose = registerAction({ id: "tools.install", title: "Install", run: install });
|
||||
const refresh = vi.spyOn(repositoryData, "refreshConnection").mockResolvedValue(undefined);
|
||||
try {
|
||||
useGhRepository.setState({ availability: { kind: "notInstalled" } });
|
||||
render(<PullRequestsToolWindow />);
|
||||
expect(screen.getByText("GitHub CLI is not installed")).toBeTruthy();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Install GitHub CLI" }));
|
||||
await waitFor(() => expect(install).toHaveBeenCalledWith(expect.objectContaining({ arg: "gh" })));
|
||||
await waitFor(() => expect(refresh).toHaveBeenCalledOnce());
|
||||
} finally {
|
||||
refresh.mockRestore();
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
it("offers the repository selector for several GitHub remotes", () => {
|
||||
|
||||
@@ -71,6 +71,7 @@ const APPEARANCE_OPTIONS: Array<[ToggleOption, string]> = [
|
||||
["showHidden", "Show Hidden Files"],
|
||||
["showExcluded", "Show Excluded Files"],
|
||||
["showMembers", "Show Members"],
|
||||
["showScratches", "Show Scratches and Consoles"],
|
||||
["showRootPaths", "Show Root Paths"],
|
||||
["horizontalScroll", "Horizontal Scrolling"],
|
||||
["compact", "Compact Middle Packages"],
|
||||
|
||||
@@ -113,7 +113,9 @@ function showProjectView(focus: boolean) {
|
||||
export function selectInProjectView(path?: string | null, focus = true, expand = false) {
|
||||
const target = path ?? maybeEditorService()?.activePath() ?? null;
|
||||
if (!target) return false;
|
||||
if (!modeShows(target)) setViewMode("project");
|
||||
// Hidden from the Project pane (Show Scratches and Consoles off), a scratch shows in its own pane.
|
||||
if (!modeShows(target))
|
||||
setViewMode(modeShows(target, "project") || !modeShows(target, "scratches") ? "project" : "scratches");
|
||||
showProjectView(focus);
|
||||
return revealPath(target, focus, true, expand);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ export interface ViewOptions extends TreeOptions {
|
||||
showMembers: boolean;
|
||||
/** Show the location of each project root beside its name. */
|
||||
showRootPaths: boolean;
|
||||
/** List Scratches and Consoles below the project in the Project pane. */
|
||||
showScratches: boolean;
|
||||
/** Rows wider than the pane scroll sideways; off clips long names (VS Code's horizontal scrolling). */
|
||||
horizontalScroll: boolean;
|
||||
}
|
||||
@@ -78,6 +80,7 @@ export const DEFAULT_VIEW_OPTIONS: ViewOptions = {
|
||||
singleClickExpand: false,
|
||||
showMembers: false,
|
||||
showRootPaths: true,
|
||||
showScratches: true,
|
||||
horizontalScroll: true,
|
||||
};
|
||||
|
||||
@@ -313,7 +316,14 @@ export function selectModel(s: ProjectTreeState): TreeModel {
|
||||
files,
|
||||
s.options.foldersFirst,
|
||||
);
|
||||
else model = withExtraRoots(project(), contributed, s.listings, options, placeholder);
|
||||
else
|
||||
model = withExtraRoots(
|
||||
project(),
|
||||
s.options.showScratches ? contributed : contributed.filter((r) => r.scope !== "scratches"),
|
||||
s.listings,
|
||||
options,
|
||||
placeholder,
|
||||
);
|
||||
if (s.unity && s.mode === "unity" && model.roots[0])
|
||||
model.roots[0].detail = s.unity.editorVersion ? `Unity ${s.unity.editorVersion}` : "Unity";
|
||||
if (s.unreal && s.mode === "unreal" && model.roots[0])
|
||||
@@ -921,23 +931,30 @@ export function extraRootOf(path: string): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
const inScratches = (path: string) =>
|
||||
projectViewRoots(useProjectViewRoots.getState().roots).some(
|
||||
(r) => r.scope === "scratches" && r.path !== undefined && isSameOrInside(path, r.path),
|
||||
);
|
||||
|
||||
/** A scratch the Project pane leaves out (Show Scratches and Consoles off); ones inside the project stay. */
|
||||
const hiddenScratch = (path: string, { options, root }: ProjectTreeState) =>
|
||||
!options.showScratches && inScratches(path) && memberRootOf(path) === null && !isSameOrInside(path, root!);
|
||||
|
||||
/** Whether a pane can show `path`. */
|
||||
export function modeShows(path: string, mode = get().mode): boolean {
|
||||
const state = get();
|
||||
if (!state.root) return false;
|
||||
switch (mode) {
|
||||
case "unity":
|
||||
return !!state.unity && unityPathVisible(path, treeOptions({ ...state, mode }));
|
||||
return !!state.unity && unityPathVisible(path, treeOptions({ ...state, mode })) && !hiddenScratch(path, state);
|
||||
case "unreal":
|
||||
return !!state.unreal && unrealPathVisible(path, treeOptions({ ...state, mode }));
|
||||
return !!state.unreal && unrealPathVisible(path, treeOptions({ ...state, mode })) && !hiddenScratch(path, state);
|
||||
case "project":
|
||||
return true;
|
||||
return !hiddenScratch(path, state);
|
||||
case "projectFiles":
|
||||
return memberRootOf(path) !== null || (!state.members && isSameOrInside(path, state.root));
|
||||
case "scratches":
|
||||
return projectViewRoots(useProjectViewRoots.getState().roots).some(
|
||||
(r) => r.scope === "scratches" && r.path !== undefined && isSameOrInside(path, r.path),
|
||||
);
|
||||
return inScratches(path);
|
||||
default: {
|
||||
if (mode === state.mode) return currentModel().keyOfPath.has(path);
|
||||
const pane = { ...state, mode };
|
||||
|
||||
@@ -186,6 +186,47 @@ describe("project view modes", () => {
|
||||
expect(localStorage.getItem("openidea.projectTree.mode")).toBe(JSON.stringify("scratches"));
|
||||
});
|
||||
|
||||
it("hides Scratches and Consoles from the Project pane only when the option is off", () => {
|
||||
store.setViewOption("showScratches", false);
|
||||
expect(labels()).toEqual(["proj", "External Libraries"]);
|
||||
expect(modeShows("/data/scratches/s.py")).toBe(false);
|
||||
expect(modeShows("/data/scratches/s.py", "scratches")).toBe(true);
|
||||
expect(modeShows("/p/src/App.kt")).toBe(true);
|
||||
// A scratches folder inside the project stays under the project root.
|
||||
const inner = registerProjectViewRoot({
|
||||
id: "inner",
|
||||
label: "Inner",
|
||||
icon: "scratches",
|
||||
path: "/p/tmp",
|
||||
scope: "scratches",
|
||||
});
|
||||
expect(modeShows("/p/tmp/a.txt")).toBe(true);
|
||||
inner();
|
||||
// The Scratches and Consoles pane and the Open Files pane still list them.
|
||||
setViewMode("scratches");
|
||||
expect(labels()).toEqual(["Scratches"]);
|
||||
setOpenFiles(["/data/scratches/s.py"]);
|
||||
setViewMode("openFiles");
|
||||
expect(labels()).toEqual(["Scratches"]);
|
||||
setViewMode("project");
|
||||
store.setViewOption("showScratches", true);
|
||||
expect(labels()).toEqual(["proj", "External Libraries", "Scratches"]);
|
||||
expect(modeShows("/data/scratches/s.py")).toBe(true);
|
||||
});
|
||||
|
||||
it("selects a hidden scratch in the Scratches and Consoles pane", async () => {
|
||||
const { selectInProjectView } = await import("./actions");
|
||||
store.setViewOption("showScratches", false);
|
||||
expect(selectInProjectView("/data/scratches/s.py", false)).toBe(true);
|
||||
expect(useProjectTree.getState().mode).toBe("scratches");
|
||||
// Project files go back to the Project pane.
|
||||
expect(selectInProjectView("/p/src/App.kt", false)).toBe(true);
|
||||
expect(useProjectTree.getState().mode).toBe("project");
|
||||
store.setViewOption("showScratches", true);
|
||||
expect(selectInProjectView("/data/scratches/s.py", false)).toBe(true);
|
||||
expect(useProjectTree.getState().mode).toBe("project");
|
||||
});
|
||||
|
||||
it("keeps each pane's expansion", () => {
|
||||
store.setExpanded(new Set(["/p", "/p/src"]));
|
||||
setViewMode("projectFiles");
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Optional GitHub CLI (`gh`) installer shared by GitHub Pull Requests,
|
||||
* Clone Repository › GitHub, and Settings › Agents › GitHub Copilot.
|
||||
* Uses the `tools.install` action when available (workbench window, for
|
||||
* status-bar progress and notifications) and falls back to `commands.toolsInstall`
|
||||
* directly in standalone windows such as Settings.
|
||||
*/
|
||||
import { Channel } from "@tauri-apps/api/core";
|
||||
import { executeAction, getAction } from "./actions";
|
||||
import { call, commands, isTauri, nextRequestId, type InstallEvent, type ToolInfo } from "./ipc";
|
||||
|
||||
const GH_TOOL_NAME = "gh";
|
||||
export const GH_MANUAL_INSTALL_URL = "https://cli.github.com";
|
||||
|
||||
interface GhInstallHandle {
|
||||
promise: Promise<boolean>;
|
||||
/** Cancels a direct install; null when delegated to the `tools.install` task queue. */
|
||||
cancel: (() => void) | null;
|
||||
}
|
||||
|
||||
/** Returns the `ide-tools` entry for `gh`, or null outside the desktop app or on lookup error. */
|
||||
async function getGhToolInfo(): Promise<ToolInfo | null> {
|
||||
if (!isTauri()) return null;
|
||||
try {
|
||||
const tools = await call(commands.toolsList());
|
||||
return tools.find((tool) => tool.name === GH_TOOL_NAME) ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs `gh` into OpenIDEA's managed tools directory. Resolves to `true` when
|
||||
* `gh` is available afterwards, or `false` if cancelled or not installed.
|
||||
* Propagates errors when running directly (the `tools.install` action reports
|
||||
* its own errors via notifications).
|
||||
*/
|
||||
export function installGhTool(onEvent?: (event: InstallEvent) => void): GhInstallHandle {
|
||||
if (getAction("tools.install")) {
|
||||
const promise = (async () => {
|
||||
await executeAction("tools.install", GH_TOOL_NAME);
|
||||
const info = await getGhToolInfo();
|
||||
return info ? info.status !== "missing" : true;
|
||||
})();
|
||||
return { promise, cancel: null };
|
||||
}
|
||||
const request = nextRequestId();
|
||||
const channel = new Channel<InstallEvent>();
|
||||
channel.onmessage = (event) => onEvent?.(event);
|
||||
const promise = call(commands.toolsInstall(GH_TOOL_NAME, request, channel)).then((info) => info.status !== "missing");
|
||||
return {
|
||||
promise,
|
||||
cancel: () => void commands.cancelRequest(request).catch(() => {}),
|
||||
};
|
||||
}
|
||||
@@ -122,6 +122,10 @@ export const IDEA_ACTIONS: Readonly<Record<string, string>> = {
|
||||
EditorScrollDown: "editor.scrollDown",
|
||||
EditorScrollUpAndMove: "editor.scrollUpAndMove",
|
||||
EditorScrollDownAndMove: "editor.scrollDownAndMove",
|
||||
EditorMoveUpAndScroll: "editor.moveUpAndScroll",
|
||||
EditorMoveDownAndScroll: "editor.moveDownAndScroll",
|
||||
EditorMoveUpAndScrollWithSelection: "editor.moveUpAndScrollWithSelection",
|
||||
EditorMoveDownAndScrollWithSelection: "editor.moveDownAndScrollWithSelection",
|
||||
EditorScrollTop: "editor.scrollToTop",
|
||||
EditorScrollBottom: "editor.scrollToBottom",
|
||||
EditorMoveToPageTop: "editor.moveToPageTop",
|
||||
|
||||
@@ -101,6 +101,17 @@ describe("IntelliJ IDEA keymap import", () => {
|
||||
expect(k.unknownActions).toEqual([]);
|
||||
});
|
||||
|
||||
it("maps Move Up / Down and Scroll (with Selection)", () => {
|
||||
const k = parseIdeaKeymap(
|
||||
`<keymap name="E" parent="$default"><action id="EditorMoveUpAndScroll"><keyboard-shortcut first-keystroke="ctrl alt UP"/></action><action id="EditorMoveDownAndScroll"><keyboard-shortcut first-keystroke="ctrl alt DOWN"/></action><action id="EditorMoveUpAndScrollWithSelection"><keyboard-shortcut first-keystroke="ctrl alt shift UP"/></action><action id="EditorMoveDownAndScrollWithSelection"><keyboard-shortcut first-keystroke="ctrl alt shift DOWN"/></action></keymap>`,
|
||||
);
|
||||
expect(k.overrides["editor.moveUpAndScroll"]).toEqual([normalizeBinding("Ctrl+Alt+Up")]);
|
||||
expect(k.overrides["editor.moveDownAndScroll"]).toEqual([normalizeBinding("Ctrl+Alt+Down")]);
|
||||
expect(k.overrides["editor.moveUpAndScrollWithSelection"]).toEqual([normalizeBinding("Ctrl+Alt+Shift+Up")]);
|
||||
expect(k.overrides["editor.moveDownAndScrollWithSelection"]).toEqual([normalizeBinding("Ctrl+Alt+Shift+Down")]);
|
||||
expect(k.unknownActions).toEqual([]);
|
||||
});
|
||||
|
||||
it("maps Scroll to Top / Scroll to Bottom", () => {
|
||||
const k = parseIdeaKeymap(
|
||||
`<keymap name="X" parent="Mac OS X 10.5+"><action id="EditorScrollTop"><keyboard-shortcut first-keystroke="HOME"/></action><action id="EditorScrollBottom"><keyboard-shortcut first-keystroke="END"/></action></keymap>`,
|
||||
|
||||
@@ -66,6 +66,10 @@ describe("IDEA keymap parity", () => {
|
||||
["editor.scrollDown", [], ["Ctrl+Down"]],
|
||||
["editor.scrollUpAndMove", [], []],
|
||||
["editor.scrollDownAndMove", [], []],
|
||||
["editor.moveUpAndScroll", [], []],
|
||||
["editor.moveDownAndScroll", [], []],
|
||||
["editor.moveUpAndScrollWithSelection", [], []],
|
||||
["editor.moveDownAndScrollWithSelection", [], []],
|
||||
// Only IDEA's Xcode keymap binds these (Home / End).
|
||||
["editor.scrollToTop", [], []],
|
||||
["editor.scrollToBottom", [], []],
|
||||
|
||||
@@ -140,6 +140,10 @@ export const intellijMacos: Record<string, string[]> = {
|
||||
"editor.scrollDown": [],
|
||||
"editor.scrollUpAndMove": [],
|
||||
"editor.scrollDownAndMove": [],
|
||||
"editor.moveUpAndScroll": [],
|
||||
"editor.moveDownAndScroll": [],
|
||||
"editor.moveUpAndScrollWithSelection": [],
|
||||
"editor.moveDownAndScrollWithSelection": [],
|
||||
"editor.scrollToTop": [],
|
||||
"editor.scrollToBottom": [],
|
||||
"editor.moveToPageTop": ["Meta+PageUp"],
|
||||
|
||||
@@ -141,6 +141,10 @@ export const intellijWindows: Record<string, string[]> = {
|
||||
"editor.scrollDown": ["Ctrl+Down"],
|
||||
"editor.scrollUpAndMove": [],
|
||||
"editor.scrollDownAndMove": [],
|
||||
"editor.moveUpAndScroll": [],
|
||||
"editor.moveDownAndScroll": [],
|
||||
"editor.moveUpAndScrollWithSelection": [],
|
||||
"editor.moveDownAndScrollWithSelection": [],
|
||||
"editor.scrollToTop": [],
|
||||
"editor.scrollToBottom": [],
|
||||
"editor.moveToPageTop": ["Ctrl+PageUp"],
|
||||
|
||||
@@ -256,6 +256,10 @@ export const vscodeMacos: Record<string, string[]> = {
|
||||
"editor.scrollDown": [],
|
||||
"editor.scrollUpAndMove": [],
|
||||
"editor.scrollDownAndMove": [],
|
||||
"editor.moveUpAndScroll": [],
|
||||
"editor.moveDownAndScroll": [],
|
||||
"editor.moveUpAndScrollWithSelection": [],
|
||||
"editor.moveDownAndScrollWithSelection": [],
|
||||
"editor.scrollToTop": [],
|
||||
"editor.scrollToBottom": [],
|
||||
"editor.moveToPageTop": [],
|
||||
|
||||
@@ -4183,5 +4183,8 @@
|
||||
"Copy command": "Copy command",
|
||||
"Sign In to {name}": "Sign In to {name}",
|
||||
"Complete sign-in in your browser or the terminal above…": "Complete sign-in in your browser or the terminal above…",
|
||||
"Sign-in exited with code {exitCode}.": "Sign-in exited with code {exitCode}."
|
||||
"Sign-in exited with code {exitCode}.": "Sign-in exited with code {exitCode}.",
|
||||
"Install GitHub CLI": "Install GitHub CLI",
|
||||
"Download manually…": "Download manually…",
|
||||
"Show Scratches and Consoles": "Show Scratches and Consoles"
|
||||
}
|
||||
@@ -1080,7 +1080,6 @@
|
||||
"Install a plugin folder with": "Instala una carpeta de complemento con",
|
||||
"Install and Debug": "Instalar y depurar",
|
||||
"Reinstall and Debug": "Reinstalar y depurar",
|
||||
"Install gh…": "Instalar gh…",
|
||||
"Installed": "Instalados",
|
||||
"Installed packages": "Paquetes instalados",
|
||||
"Installed plugins": "Complementos instalados",
|
||||
|
||||
@@ -1019,7 +1019,6 @@
|
||||
"Install a plugin folder with": "Installez un dossier de plugin avec",
|
||||
"Install and Debug": "Installer et déboguer",
|
||||
"Reinstall and Debug": "Réinstaller et déboguer",
|
||||
"Install gh…": "Installer gh…",
|
||||
"Installed": "Installés",
|
||||
"Installed packages": "Paquets installés",
|
||||
"Installed plugins": "Plugins installés",
|
||||
|
||||
@@ -1116,7 +1116,6 @@
|
||||
"Install a plugin folder with": "다음으로 플러그인 폴더 설치",
|
||||
"Install and Debug": "설치 및 디버그",
|
||||
"Reinstall and Debug": "다시 설치 및 디버그",
|
||||
"Install gh…": "gh 설치…",
|
||||
"Installed": "설치됨",
|
||||
"Installed packages": "설치된 패키지",
|
||||
"Installed plugins": "설치된 플러그인",
|
||||
|
||||
@@ -1072,7 +1072,6 @@
|
||||
"Install a plugin folder with": "Zainstaluj folder wtyczki za pomocą",
|
||||
"Install and Debug": "Zainstaluj i debuguj",
|
||||
"Reinstall and Debug": "Zainstaluj ponownie i debuguj",
|
||||
"Install gh…": "Zainstaluj gh…",
|
||||
"Installed": "Zainstalowane",
|
||||
"Installed packages": "Zainstalowane pakiety",
|
||||
"Installed plugins": "Zainstalowane wtyczki",
|
||||
|
||||
@@ -1072,7 +1072,6 @@
|
||||
"Install a plugin folder with": "Instalar uma pasta de plugin com",
|
||||
"Install and Debug": "Instalar e depurar",
|
||||
"Reinstall and Debug": "Reinstalar e depurar",
|
||||
"Install gh…": "Instalar gh…",
|
||||
"Installed": "Instalados",
|
||||
"Installed packages": "Pacotes instalados",
|
||||
"Installed plugins": "Plugins instalados",
|
||||
|
||||
@@ -2143,7 +2143,6 @@
|
||||
"Install a plugin folder with": "Установить папку плагина с",
|
||||
"Install and Debug": "Установить и отладить",
|
||||
"Reinstall and Debug": "Переустановить и отладить",
|
||||
"Install gh…": "Установить gh…",
|
||||
"Installed": "Установлено",
|
||||
"Installed packages": "Установленные пакеты",
|
||||
"Installed plugins": "Установленные плагины",
|
||||
|
||||
@@ -3838,7 +3838,6 @@
|
||||
"Install a plugin folder with": "Şu klasörden eklenti yükle:",
|
||||
"Install and Debug": "Yükle ve Hata Ayıkla",
|
||||
"Reinstall and Debug": "Yeniden Yükle ve Hata Ayıkla",
|
||||
"Install gh…": "gh Yükle…",
|
||||
"Installed": "Yüklü",
|
||||
"Installed packages": "Yüklü paketler",
|
||||
"Installed plugins": "Yüklü eklentiler",
|
||||
|
||||
@@ -694,6 +694,10 @@
|
||||
"Scroll Down": "向下捲動",
|
||||
"Scroll Up and Move if Necessary": "向上捲動並在必要時移動游標",
|
||||
"Scroll Down and Move if Necessary": "向下捲動並在必要時移動游標",
|
||||
"Move Up and Scroll": "向上移動並捲動",
|
||||
"Move Down and Scroll": "向下移動並捲動",
|
||||
"Move Up and Scroll with Selection": "向上移動並捲動並選擇",
|
||||
"Move Down and Scroll with Selection": "向下移動並捲動並選擇",
|
||||
"Scroll to Top": "捲動到頂部",
|
||||
"Scroll to Bottom": "捲動到底部",
|
||||
"Move Caret to Page Top": "將游標移至頁面頂部",
|
||||
@@ -1760,7 +1764,6 @@
|
||||
"Install a plugin folder with": "安裝外掛資料夾:",
|
||||
"Install and Debug": "安裝並偵錯",
|
||||
"Reinstall and Debug": "重新安裝並偵錯",
|
||||
"Install gh…": "安裝 gh…",
|
||||
"Installed": "已安裝",
|
||||
"Installed packages": "已安裝的軟體包",
|
||||
"Installed plugins": "已安裝的外掛",
|
||||
|
||||
@@ -1055,6 +1055,10 @@
|
||||
"Scroll Down": "向下滚动",
|
||||
"Scroll Up and Move if Necessary": "向上滚动并在必要时移动光标",
|
||||
"Scroll Down and Move if Necessary": "向下滚动并在必要时移动光标",
|
||||
"Move Up and Scroll": "向上移动并滚动",
|
||||
"Move Down and Scroll": "向下移动并滚动",
|
||||
"Move Up and Scroll with Selection": "向上移动并滚动并选择",
|
||||
"Move Down and Scroll with Selection": "向下移动并滚动并选择",
|
||||
"Scroll to Top": "滚动到顶部",
|
||||
"Scroll to Bottom": "滚动到底部",
|
||||
"Move Caret to Page Top": "将光标移至页面顶部",
|
||||
@@ -2215,7 +2219,6 @@
|
||||
"Install a plugin folder with": "安装插件文件夹:",
|
||||
"Install and Debug": "安装并调试",
|
||||
"Reinstall and Debug": "重新安装并调试",
|
||||
"Install gh…": "安装 gh…",
|
||||
"Installed": "已安装",
|
||||
"Installed packages": "已安装的软件包",
|
||||
"Installed plugins": "已安装的插件",
|
||||
@@ -10628,5 +10631,8 @@
|
||||
"Copy command": "复制命令",
|
||||
"Sign In to {name}": "登录 {name}",
|
||||
"Complete sign-in in your browser or the terminal above…": "请在浏览器或上方终端中完成登录…",
|
||||
"Sign-in exited with code {exitCode}.": "登录已退出,代码为 {exitCode}。"
|
||||
"Sign-in exited with code {exitCode}.": "登录已退出,代码为 {exitCode}。",
|
||||
"Install GitHub CLI": "安装 GitHub CLI",
|
||||
"Download manually…": "手动下载…",
|
||||
"Show Scratches and Consoles": "显示临时文件和控制台"
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача