Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 8662f341d7 fix(settings): change the local data directory without an open project
The Caches settings were trusted-only, so the welcome window could neither
show the current location nor apply a custom directory. The directory is an
app-wide setting: reading it now runs everywhere, and changing it runs
outside Restricted Mode. The Linux GTK file chooser and the global hotkey
probe had the same gate and failed in the welcome window too.

Fixes #6886
2026-11-30 11:15:30 +08:00
Bert Verhelstтаbertyhell 69cec11761 ci: run the release jobs that read secrets in the release environment (#6873)
The signing keys and tokens are repository secrets, readable by any workflow on any branch, and secrets: inherit hands them all to the called release workflows. The jobs that read a secret other than GITHUB_TOKEN now name environment: release (plugins, plugin-keys, build, server-signatures, mirror, cask). secrets: inherit stays until the secrets move into the environment, so releases build and sign as before; the environment is created on first use with no rules. Refs #6701.

Co-authored-by: bertyhell <[email protected]>
2026-11-30 10:52:02 +08:00
l0ng-ai 6c76cfd316 fix(editor): keep the run gutter from loading the editor preferences (#6912)
runGutter, which the Language smoke loads, imported gutterIconsOn from cm/prefs, pulling about 40 editor modules into the smoke inputs and failing scripts/smoke-paths.test.ts on main. The gutter icon groups and the per-editor appearance override move to cm/localAppearance, which prefs re-exports; the gutter providers import it directly and language-smoke.yml lists the new file.
2026-11-30 10:51:33 +08:00
audichuang 66496221b9 fix(ci): run Language smoke for every language when ide-http changes (#6905)
Since #6893 ide-tools depends on ide-http on macOS, so ide-http is an input of the Language smoke, but the Changes step still listed it as unused and scripts/smoke-paths.test.ts failed on main. Removes ide-http from that list.

Co-authored-by: audichuang <[email protected]>
2026-11-30 10:49:13 +08:00
l0ng-ai e9f3aef5ae fix(markdown): keep the preview painted while scrolling (#6908)
Trackpad scrolling in the Markdown preview could leave a large part of it blank until the next scroll. The preview moves itself on each wheel event with scrollBy, and in WebKit a run of scrollBy calls can leave the compositor at an older, never-painted offset than the page's. Setting scrollTop/scrollLeft keeps them in step; the source editor's large wheel jumps and the diff divider's wheel did the same and now set offsets too.

A fenced code block overflowing by a pixel no longer counts as a vertical scroller, and a nested scroller keeps the wheel only while it can still move in that direction, so scrolling no longer stops over code blocks.
2026-11-30 10:31:45 +08:00
LU XIANGRUIтаwildcatDownstairs 4ca46032c4 feat(run): debug Xcode run configurations on the iOS Simulator (#6889)
Debug on an Xcode run configuration builds and installs the app as Run does, launches it suspended on the iOS Simulator (simctl launch --wait-for-debugger) and attaches lldb-dap to its pid, so breakpoints in the app's Swift sources hit while its output stays in the Run console; stopping the debug session stops the run. simctl holds back its <bundle id>: <pid> line when stdout is a pipe, so the launch script prints it once the suspended process under the installed bundle appears. Detected and new Xcode configurations get debugAdapter lldb-dap. Closes #6885.

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-30 10:27:53 +08:00
Muuтаmuutot 8d8f66dfe5 feat(editor): add active-editor appearance toggles (#6891)
Show Line Numbers, Show Whitespaces, Show Gutter Icons and Show Indent Guides can be toggled for the active editor without changing the global setting. Overrides live in each CodeMirror EditorState, so split panes on one document can differ and untouched editors keep following the settings; line numbers, whitespace marks, indent guides and gutter providers reconfigure through one appearance path, and a local Gutter Icons override can enable providers even when the global setting is off. The toggles are in View > Active Editor, with IdeaVim aliases and unbound keymap entries.

Co-authored-by: muutot <[email protected]>
2026-11-30 10:26:06 +08:00
LU XIANGRUIтаwildcatDownstairs 5229e44a9c feat(swift): resolve and update Swift packages from the IDE (#6899)
Resolve Swift Packages and Update Swift Packages run swift package resolve / update in the Run tool window from the folder of Package.swift, like Go Mod Tidy, using the swiftpm run kind. They are in Find Action (category Swift) and on a single Package.swift in the Project view, editor and tab menus; when the run ends, run configurations and external libraries reload. sourcekit-lsp already reloads on Package.resolved changes through its file watcher, so no restart is added. Documented on the Swift page.

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-30 10:17:00 +08:00
audichuang 7be55e4eec fix(tools): follow the macOS PAC script for tool downloads in Auto proxy mode (#6893)
Tool downloads run through the system curl, which in Auto proxy mode only got the manual macOS proxy from Matcher::from_system(), never the PAC script, so on a PAC-only network language-server installs went direct while the rest of the IDE followed the PAC.

Http::base now asks the same PacResolver the HTTP client uses (ide_http::system_pac_route, evaluated inline with the per-host cache) and passes its proxy to curl as --proxy; while the script loads or fails it answers with the manual proxy, as before. Linux and Windows build the same command as before.

Co-authored-by: audichuang <[email protected]>
2026-11-30 10:14:57 +08:00
l0ng-ai ce206f74af fix(deps): update curve25519-dalek to 5.1.0 (RUSTSEC-2026-0620) (#6903)
cargo deny failed on RUSTSEC-2026-0620: curve25519-dalek 5.0.0, pulled in by ed25519-dalek for extension signature checks in ide-extension, has an AVX-512 backend bug in scalar multiplication. Our builds do not enable that backend; lock-only update to the fixed 5.1.0.
2026-11-30 10:13:10 +08:00
60 змінених файлів з 1345 додано та 156 видалено

No files matched your search

+1
Переглянути файл
@@ -21,6 +21,7 @@ concurrency:
jobs:
mirror:
environment: release
runs-on: ubuntu-latest
timeout-minutes: 120
env:
+1
Переглянути файл
@@ -23,6 +23,7 @@ concurrency:
jobs:
cask:
environment: release
runs-on: ubuntu-latest
timeout-minutes: 30
env:
+3 -2
Переглянути файл
@@ -34,6 +34,7 @@ on:
- "src/editor/relatedProviders.ts"
- "src/editor/core/cm/cornerInset.ts"
- "src/editor/core/cm/iconArea.ts"
- "src/editor/core/cm/localAppearance.ts"
- "src/editor/lsp/availability.ts"
- "src/editor/lsp/diagnostics.ts"
- "src/editor/lsp/files.ts"
@@ -106,9 +107,9 @@ jobs:
# SDKs, build tools, the project model, Find Usages candidates, debug stream traces):
# cargo metadata, ide-host's direct deps ide-search/ide-streams and the deps of
# ide-lsp/dap/run/sdk/tools.
unused='^crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-http|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-spell|ide-ssh|ide-vcs|ide-web)/'
unused='^crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-spell|ide-ssh|ide-vcs|ide-web)/'
# The workflow's paths, less those handled per language below.
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|navigationProviders|refactorProviders|relatedProviders|core/cm/(cornerInset|iconArea)|lsp/(availability|diagnostics|files|hint|lsp|positions|snippet))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src-tauri/icons/128x128\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|navigationProviders|refactorProviders|relatedProviders|core/cm/(cornerInset|iconArea|localAppearance)|lsp/(availability|diagnostics|files|hint|lsp|positions|snippet))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src-tauri/icons/128x128\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
langs=""
while read -r f; do
case "$f" in
+3
Переглянути файл
@@ -19,6 +19,7 @@ env:
jobs:
plugin-keys:
permissions: {}
environment: release
runs-on: ubuntu-latest
outputs:
keys: ${{ steps.keys.outputs.keys }}
@@ -43,6 +44,7 @@ jobs:
contents: write
needs: plugin-keys
name: Build (${{ matrix.name }})
environment: release
env:
OPENIDEA_OFFICIAL_PLUGIN_KEYS: ${{ needs.plugin-keys.outputs.keys }}
strategy:
@@ -227,6 +229,7 @@ jobs:
permissions:
contents: write
needs: server
environment: release
runs-on: ubuntu-latest
steps:
- name: Signing configured
+3
Переглянути файл
@@ -20,6 +20,8 @@ env:
TAG: ${{ github.event.inputs.tag || github.ref_name }}
COMMUNITY_PLUGINS_INDEX: https://github.com/l0ng-ai/openidea-plugins/releases/download/index/index.json
# The jobs that read a signing key or token, here and in the workflows called below, run in
# the `release` environment, which holds those secrets.
jobs:
# Creates (or reuses) one draft release that every platform build uploads into.
create-release:
@@ -96,6 +98,7 @@ jobs:
contents: write
needs: create-release
name: Official plugins
environment: release
runs-on: ubuntu-22.04
env:
SIGNING_KEY: ${{ secrets.PLUGIN_SIGNING_KEY }}
Створено
+4 -3
Переглянути файл
@@ -1552,9 +1552,9 @@ dependencies = [
[[package]]
name = "curve25519-dalek"
version = "5.0.0"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eed333089e2e1c1ac8c6c0398e5e2497b4c9926ca6d0365ed1e099afa5bc23"
checksum = "94c1aa5a9b7626ed65ac0cf5ea9d4f1547af89017fbac20bd4de40022fff516f"
dependencies = [
"cfg-if",
"cpufeatures 0.3.1",
@@ -5023,6 +5023,7 @@ dependencies = [
"http",
"hyper-util",
"ide-core",
"ide-http",
"ide-language",
"libc",
"minisign-verify",
@@ -9859,7 +9860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom 0.4.3",
"getrandom 0.3.4",
"once_cell",
"rustix",
"windows-sys 0.61.2",
+5
Переглянути файл
@@ -425,6 +425,11 @@ pub fn spec(os: Os) -> Vec<Entry> {
vec![
act("editor.toggleSoftWrap", "Soft-Wrap"),
act("editor.toggleRenderedDocs", "Render Documentation Comments"),
SEP,
act("editor.toggleLocalWhitespaces", "Show Whitespaces"),
act("editor.toggleLocalLineNumbers", "Show Line Numbers"),
act("editor.toggleLocalGutterIcons", "Show Gutter Icons"),
act("editor.toggleLocalIndentGuides", "Show Indent Guides"),
],
),
SEP,
+1 -1
Переглянути файл
@@ -414,7 +414,7 @@ pub fn register(dispatcher: &mut Dispatcher, shell: Arc<WebShellState>) {
});
// Caches & LSP & Web & Workspace & HTTP helpers already available through ide-host dependencies.
dispatcher.add("caches_local_data_info", TrustClass::Trusted, |c| async move {
dispatcher.add("caches_local_data_info", TrustClass::Always, |c| async move {
let current = c.host.local_data_dir.to_string_lossy().into_owned();
Ok(LocalDataInfo {
default_dir: current.clone(),
+2
Переглянути файл
@@ -12,6 +12,8 @@ pub mod exec;
pub mod history;
#[cfg(target_os = "macos")]
mod pac;
#[cfg(target_os = "macos")]
pub use pac::system_pac_route;
pub mod parse;
pub mod tunnel;
+112 -3
Переглянути файл
@@ -50,15 +50,41 @@ fn with_pac_from(
no_proxy: &str,
slot_for: impl FnOnce(String) -> Arc<ScriptSlot>,
) -> reqwest::ClientBuilder {
let Some((settings, url)) =
(!has_env_proxy).then(read_settings).flatten().and_then(|s| configured_pac(&s).map(|u| (s, u)))
else {
let Some((settings, url)) = active_pac(has_env_proxy, read_settings) else {
return builder;
};
let resolver = PacResolver::new(slot_for(url), manual_matcher(&settings, no_proxy), no_proxy);
builder.proxy(reqwest::Proxy::custom(move |url| resolver.resolve(url)))
}
fn active_pac(
has_env_proxy: bool,
read_settings: impl FnOnce() -> Option<CFRetained<CFDictionary>>,
) -> Option<(CFRetained<CFDictionary>, String)> {
(!has_env_proxy).then(read_settings).flatten().and_then(|s| configured_pac(&s).map(|u| (s, u)))
}
/// The route `with_system_pac` would give `url`, for one-shot callers such as `curl`, or `None`
/// when no PAC applies. A script still loading or failed never waits: the resolver then answers
/// with the manual proxy, i.e. the route `Matcher::from_system` gives.
pub fn system_pac_route(url: &str) -> Option<ProxyRoute> {
pac_route_from(url, env_proxy_set(), system_settings, &env_no_proxy(), ScriptSlot::shared)
}
fn pac_route_from(
url: &str,
has_env_proxy: bool,
read_settings: impl FnOnce() -> Option<CFRetained<CFDictionary>>,
no_proxy: &str,
slot_for: impl FnOnce(String) -> Arc<ScriptSlot>,
) -> Option<ProxyRoute> {
let url = reqwest::Url::parse(url).ok()?;
let (settings, pac) = active_pac(has_env_proxy, read_settings)?;
let slot = slot_for(pac);
let resolver = PacResolver::new(slot, manual_matcher(&settings, no_proxy), no_proxy);
Some(resolver.resolve(&url).map_or(ProxyRoute::Direct, ProxyRoute::Via))
}
/// Fingerprint of the active macOS PAC URL, or `None`.
pub(crate) fn system_pac_fingerprint() -> Option<String> {
(!env_proxy_set()).then(system_settings).flatten().and_then(|s| pac_fingerprint(&s))
@@ -447,6 +473,89 @@ mod tests {
}
}
/// Like `serve_pac`, but holds the answer until `gate` is set, so the script stays pending.
fn serve_gated_pac(body: String, gate: Arc<AtomicBool>) -> u16 {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let port = listener.local_addr().unwrap().port();
std::thread::spawn(move || {
for stream in listener.incoming() {
let Ok(mut stream) = stream else { continue };
let mut reader = BufReader::new(stream.try_clone().unwrap());
loop {
let mut line = String::new();
if reader.read_line(&mut line).unwrap_or(0) == 0 || line == "\r\n" {
break;
}
}
while !gate.load(Ordering::SeqCst) {
std::thread::sleep(Duration::from_millis(5));
}
let head = format!("HTTP/1.1 200 OK\r\nContent-Length: {}\r\nConnection: close\r\n\r\n", body.len());
let _ = stream.write_all(head.as_bytes());
let _ = stream.write_all(body.as_bytes());
}
});
port
}
#[test]
fn one_shot_route_keeps_the_manual_route_until_the_script_loads() {
let pac_proxy = "http://127.0.0.1:3128";
let pac_script = r#"function FindProxyForURL(url, host) {
if (host == "github.com") return "PROXY 127.0.0.1:3128";
return "DIRECT";
}"#
.to_owned();
let gate = Arc::new(AtomicBool::new(false));
let pac_url = format!("http://127.0.0.1:{}/proxy.pac", serve_gated_pac(pac_script, Arc::clone(&gate)));
let slot = ScriptSlot::new(pac_url.clone(), SCRIPT_TTL, RETRY_BACKOFF, ROUTE_TTL);
let route = |url: &str, env: bool, enabled: bool, manual: bool| {
let settings = || {
let mut entries = vec![
(
unsafe { cf::kCFNetworkProxiesProxyAutoConfigEnable },
as_cf_type(CFNumber::new_i32(i32::from(enabled))),
),
(
unsafe { cf::kCFNetworkProxiesProxyAutoConfigURLString },
as_cf_type(CFString::from_str(&pac_url)),
),
];
if manual {
entries.push((unsafe { cf::kCFNetworkProxiesHTTPSEnable }, as_cf_type(CFNumber::new_i32(1))));
entries.push((
unsafe { cf::kCFNetworkProxiesHTTPSProxy },
as_cf_type(CFString::from_str("127.0.0.1")),
));
entries.push((unsafe { cf::kCFNetworkProxiesHTTPSPort }, as_cf_type(CFNumber::new_i32(7890))));
}
Some(settings_dict(entries))
};
pac_route_from(url, env, settings, "", |_| Arc::clone(&slot))
};
let github = "https://github.com/o/r/releases/download/v1/x.zip";
let manual = Some(ProxyRoute::Via("http://127.0.0.1:7890/".into()));
// Pending: no waiting, the manual proxy main used is answered.
let started = Instant::now();
assert_eq!(route(github, false, true, true), manual);
assert!(started.elapsed() < Duration::from_secs(2), "must not wait for the script");
gate.store(true, Ordering::SeqCst);
let deadline = Instant::now() + Duration::from_secs(5);
while slot.script().is_none() {
assert!(Instant::now() < deadline, "PAC script did not finish loading in time");
std::thread::sleep(Duration::from_millis(5));
}
assert_eq!(route(github, false, true, true), Some(ProxyRoute::Via(pac_proxy.into())));
// A DIRECT answer falls through to the manual proxy as in the HTTP client, else goes direct.
assert_eq!(route("https://elsewhere.example/x", false, true, true), manual);
assert_eq!(route("https://elsewhere.example/x", false, true, false), Some(ProxyRoute::Direct));
// No PAC applies: the caller keeps its own lookup.
assert_eq!(route(github, false, false, true), None);
assert_eq!(route(github, true, true, true), None);
}
#[tokio::test]
async fn pac_file_urls_read_the_original_script() {
let dir = tempfile::tempdir().unwrap();
+4 -2
Переглянути файл
@@ -2,7 +2,7 @@
//! Simulator (see [`crate::xcode::prepare`]). A workspace next to the projects builds them all,
//! so its schemes and theirs are built through it.
use super::config;
use super::{ConfigExt, config};
use crate::RunConfig;
use crate::xcode::{XcodeScheme, schemes};
use std::path::Path;
@@ -34,7 +34,8 @@ fn scheme_config(scheme: &XcodeScheme, container: &str) -> RunConfig {
args.extend(["-configuration", configuration]);
}
let mut c =
config(format!("xcode:run:{container}:{}", scheme.name), scheme.name.clone(), "xcode", "xcodebuild", &args);
config(format!("xcode:run:{container}:{}", scheme.name), scheme.name.clone(), "xcode", "xcodebuild", &args)
.debug("lldb-dap");
let params = &mut c.extras.params;
params.insert("container".into(), container.to_owned());
params.insert("scheme".into(), scheme.name.clone());
@@ -68,6 +69,7 @@ mod tests {
let app = &out[0];
assert_eq!((app.kind.as_str(), app.command.as_str()), ("xcode", "xcodebuild"));
assert_eq!(app.debug_adapter.as_deref(), Some("lldb-dap"));
assert_eq!(app.args, ["-workspace", "App.xcworkspace", "-scheme", "App", "-configuration", "Staging"]);
assert_eq!(app.extras.params["container"], "App.xcworkspace");
assert_eq!(app.extras.params["configuration"], "Staging");
+79 -6
Переглянути файл
@@ -210,6 +210,10 @@ fn pick_simulator(json: &str) -> Option<String> {
/// [`default_simulator`]: the one place a device selector can feed its choice into.
pub const SIMULATOR_PARAM: &str = "simulator";
/// Set (to anything but empty) by Debug: the app is launched suspended
/// (`simctl launch --wait-for-debugger`) until the debugger attaches to the pid simctl prints.
pub const WAIT_FOR_DEBUGGER_PARAM: &str = "waitForDebugger";
/// The `xcodebuild` arguments that pick what is built, and where, for a `kind = "xcode"`
/// configuration: its `container`, `scheme` and `configuration` params and the simulator.
pub fn build_args(params: &BTreeMap<String, String>, udid: &str, derived_data: &Path) -> Result<Vec<String>, String> {
@@ -262,8 +266,16 @@ fn sh_quote(s: &str) -> String {
/// The script a run executes: build, boot the simulator and show it (Xcode 27 replaced the
/// Simulator app with DeviceHub), install, then launch with the app's output on the console.
/// The app's arguments follow the script as `$@`. `simctl` passes SIGTERM on to the app but not
/// the SIGINT a Stop sends, so the script turns that into a SIGTERM.
pub fn launch_script(build_args: &[String], udid: &str, app: &Path, bundle_id: &str) -> String {
/// the SIGINT a Stop sends, so the script turns that into a SIGTERM. With `wait_for_debugger` the
/// app stays suspended until a debugger attaches; the script prints `<bundle id>: <pid>` for it
/// (simctl prints that line too, but holds it back until it exits when its output is a pipe).
pub fn launch_script(
build_args: &[String],
udid: &str,
app: &Path,
bundle_id: &str,
wait_for_debugger: bool,
) -> String {
let build: Vec<String> = build_args.iter().map(|a| sh_quote(a)).collect();
let (udid, app, bundle_id) = (sh_quote(udid), sh_quote(&app.to_string_lossy()), sh_quote(bundle_id));
format!(
@@ -273,13 +285,29 @@ pub fn launch_script(build_args: &[String], udid: &str, app: &Path, bundle_id: &
open -a Simulator 2>/dev/null || open -a DeviceHub 2>/dev/null || true\n\
xcrun simctl install {udid} {app}\n\
set +e\n\
xcrun simctl launch --console-pty --terminate-running-process {udid} {bundle_id} \"$@\" &\n\
xcrun simctl launch --console-pty --terminate-running-process{wait} {udid} {bundle_id} \"$@\" &\n\
launch=$!\n\
trap 'kill -TERM $launch 2>/dev/null' INT TERM\n\
{announce}\
wait $launch; status=$?\n\
while kill -0 $launch 2>/dev/null; do wait $launch; status=$?; done\n\
exit $status\n",
build.join(" ")
build.join(" "),
wait = if wait_for_debugger { " --wait-for-debugger" } else { "" },
announce = if wait_for_debugger { announce_suspended(&udid, &bundle_id) } else { String::new() },
)
}
/// Script lines that wait for the app to show up suspended (`ps` state `T`) under its installed
/// bundle, then print `<bundle id>: <pid>` (both already quoted for `sh`).
fn announce_suspended(udid: &str, bundle_id: &str) -> String {
format!(
"app_dir=$(xcrun simctl get_app_container {udid} {bundle_id} app)/\n\
while kill -0 $launch 2>/dev/null; do\n\
pid=$(ps -axo pid=,stat=,command= | awk -v dir=\"$app_dir\" '$2 ~ /^T/ && index($0, dir) {{ print $1; exit }}')\n\
if [ -n \"$pid\" ]; then echo {bundle_id}\": $pid\"; break; fi\n\
sleep 0.2\n\
done\n"
)
}
@@ -312,8 +340,9 @@ pub fn prepare(dir: &Path, cache_dir: &Path, config: &mut crate::RunConfig) -> I
let settings = output("xcodebuild", &[args.as_slice(), &["-showBuildSettings".into(), "-json".into()]].concat())?;
let (app, bundle_id) = built_app(&settings).map_err(IdeError::invalid)?;
let app_args = crate::import::split_args(params.get("arguments").map_or("", String::as_str));
let wait = params.get(WAIT_FOR_DEBUGGER_PARAM).is_some_and(|v| !v.trim().is_empty());
config.command = "/bin/sh".into();
config.args = ["-c".to_owned(), launch_script(&args, &udid, &app, &bundle_id), "xcode-run".to_owned()]
config.args = ["-c".to_owned(), launch_script(&args, &udid, &app, &bundle_id, wait), "xcode-run".to_owned()]
.into_iter()
.chain(app_args)
.collect();
@@ -515,7 +544,7 @@ mod tests {
"[ \"$2\" = launch ] || exit 0\ntrap 'echo terminated >> \"$LOG\"; exit 0' TERM\nwhile :; do sleep 0.05; done\n",
);
let build = ["-project".to_owned(), "My App.xcodeproj".to_owned(), "-scheme".to_owned(), "It's".to_owned()];
let script = launch_script(&build, "U1", Path::new("/dd/My App.app"), "dev.example.App");
let script = launch_script(&build, "U1", Path::new("/dd/My App.app"), "dev.example.App", false);
let mut child = std::process::Command::new("/bin/sh")
.args(["-c", &script, "xcode-run", "--greeting", "hi there"])
.env("PATH", format!("{}:/usr/bin:/bin", dir.path().display()))
@@ -540,4 +569,48 @@ mod tests {
terminated\n"
);
}
/// A debug launch passes `--wait-for-debugger` and prints the pid of the suspended app (not of
/// a running copy, nor of a process outside its bundle) right away, while simctl keeps running.
#[cfg(unix)]
#[test]
fn a_debug_launch_waits_for_the_debugger_and_prints_the_apps_pid() {
use std::io::{BufRead, BufReader};
use std::os::unix::fs::PermissionsExt;
let dir = tempfile::tempdir().unwrap();
let stub = |tool: &str, body: &str| {
let path = dir.path().join(tool);
fs::write(&path, format!("#!/bin/sh\n{body}")).unwrap();
fs::set_permissions(&path, fs::Permissions::from_mode(0o755)).unwrap();
};
stub("xcodebuild", "");
stub("open", "");
stub(
"xcrun",
"case \"$2\" in\n\
get_app_container) echo /apps/A.app ;;\n\
launch) echo \"$@\" > \"$LOG\"; trap 'exit 0' TERM; while :; do sleep 0.05; done ;;\n\
esac\n",
);
stub("ps", "printf ' 41 S /apps/A.app/A\\n 42 Ts /apps/B.app/B\\n 43 Ts /apps/A.app/A\\n'\n");
let script = launch_script(&[], "U1", Path::new("/dd/A.app"), "dev.example.App", true);
let log = dir.path().join("log");
let mut child = std::process::Command::new("/bin/sh")
.args(["-c", &script, "xcode-run"])
.env("PATH", format!("{}:/usr/bin:/bin", dir.path().display()))
.env("LOG", &log)
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap();
let mut line = String::new();
BufReader::new(child.stdout.take().unwrap()).read_line(&mut line).unwrap();
assert_eq!(line, "dev.example.App: 43\n");
assert_eq!(
fs::read_to_string(&log).unwrap(),
"simctl launch --console-pty --terminate-running-process --wait-for-debugger U1 dev.example.App\n"
);
unsafe { libc::kill(child.id() as i32, libc::SIGINT) };
assert!(child.wait().unwrap().success());
assert!(!launch_script(&[], "U1", Path::new("/A.app"), "a.b", false).contains("--wait-for-debugger"));
}
}
+4
Переглянути файл
@@ -26,5 +26,9 @@ base64.workspace = true
minisign-verify = "0.3"
tempfile.workspace = true
# The macOS PAC route curl can't read (see `Http::base`).
[target.'cfg(target_os = "macos")'.dependencies]
ide-http.workspace = true
[target.'cfg(unix)'.dev-dependencies]
libc = "0.2"
+35 -6
Переглянути файл
@@ -367,8 +367,18 @@ fn environment_names_proxy() -> bool {
/// `--proxy` for `url` from the system proxy `matcher` reads (macOS and Windows settings),
/// which the IDE's HTTP client follows in Auto mode but curl doesn't read: without it a proxy
/// app's system proxy reaches every request but the tool downloads.
fn system_proxy_args(url: &str, matcher: &hyper_util::client::proxy::matcher::Matcher) -> Vec<String> {
/// app's system proxy reaches every request but the tool downloads. A macOS PAC `pac` route
/// comes first, as in the HTTP client.
fn system_proxy_args(
url: &str,
pac: Option<ide_core::proxy_settings::ProxyRoute>,
matcher: &hyper_util::client::proxy::matcher::Matcher,
) -> Vec<String> {
match pac {
Some(ide_core::proxy_settings::ProxyRoute::Via(proxy)) => return vec!["--proxy".into(), proxy],
Some(_) => return Vec::new(),
None => {}
}
let Ok(uri) = url.parse::<http::Uri>() else { return Vec::new() };
match matcher.intercept(&uri) {
Some(proxy) => vec!["--proxy".into(), proxy.uri().to_string()],
@@ -490,7 +500,12 @@ impl Http {
let proxy = ide_core::proxy_settings::proxy();
cmd.args(proxy.curl_args(url));
if proxy.route_for_url(url) == ide_core::proxy_settings::ProxyRoute::System && !environment_names_proxy() {
cmd.args(system_proxy_args(url, &hyper_util::client::proxy::matcher::Matcher::from_system()));
// macOS PAC, which the matcher doesn't read; a script still loading answers with the matcher's route.
#[cfg(target_os = "macos")]
let pac = ide_http::system_pac_route(url);
#[cfg(not(target_os = "macos"))]
let pac = None;
cmd.args(system_proxy_args(url, pac, &hyper_util::client::proxy::matcher::Matcher::from_system()));
}
if self.https_only {
cmd.args(["--proto", "=https", "--proto-redir", "=https"]);
@@ -827,11 +842,25 @@ mod tests {
use hyper_util::client::proxy::matcher::Matcher;
let system = Matcher::builder().http("127.0.0.1:7890").https("127.0.0.1:7890").no("internal.test").build();
assert_eq!(
system_proxy_args("https://github.com/o/r/releases/download/v1/x.zip", &system),
system_proxy_args("https://github.com/o/r/releases/download/v1/x.zip", None, &system),
["--proxy", "http://127.0.0.1:7890/"]
);
assert!(system_proxy_args("https://internal.test/x.zip", &system).is_empty());
assert!(system_proxy_args("https://github.com/x", &Matcher::builder().build()).is_empty());
assert!(system_proxy_args("https://internal.test/x.zip", None, &system).is_empty());
assert!(system_proxy_args("https://github.com/x", None, &Matcher::builder().build()).is_empty());
}
#[test]
fn curl_follows_the_pac_route_over_the_manual_proxy() {
use hyper_util::client::proxy::matcher::Matcher;
use ide_core::proxy_settings::ProxyRoute;
let system = Matcher::builder().http("127.0.0.1:7890").https("127.0.0.1:7890").build();
let url = "https://github.com/o/r/releases/download/v1/x.zip";
assert_eq!(
system_proxy_args(url, Some(ProxyRoute::Via("http://127.0.0.1:3128".into())), &system),
["--proxy", "http://127.0.0.1:3128"]
);
// The PAC route already applied the manual proxy fallback and NO_PROXY.
assert!(system_proxy_args(url, Some(ProxyRoute::Direct), &system).is_empty());
}
#[test]
+9
Переглянути файл
@@ -28,6 +28,15 @@ sourcekit-lsp then reads the build settings for that root:
- **Build server**: a `.bsp/*.json` file or a `buildServer.json` in the root points sourcekit-lsp at a Build Server Protocol server. Xcode projects use this (see [Xcode projects](#xcode-projects)).
- **`compile_commands.json`**: a compilation database, for example from CMake.
### Package dependencies
Right-click `Package.swift` in the Project view or the editor, or use **Find Action** (`⇧⌘A` / `Ctrl+Shift+A`):
- **Resolve Swift Packages** runs `swift package resolve`: it fetches the dependencies and writes `Package.resolved`.
- **Update Swift Packages** runs `swift package update`: it moves the dependencies to the newest versions `Package.swift` allows.
Both run in the **Run** tool window in the folder of `Package.swift`. sourcekit-lsp watches `Package.swift` and `Package.resolved` and reloads the package when either changes, including after `git pull`, so completion for a new dependency works without restarting the server.
`.sourcekit-lsp/config.json` holds sourcekit-lsp's own options; see the [sourcekit-lsp configuration reference](https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Configuration%20File.md).
### Xcode projects
+9
Переглянути файл
@@ -28,6 +28,15 @@ sourcekit-lsp 从当前文件向上查找以下文件来确定工作区根目录
- **构建服务器**:根目录中的 `.bsp/*.json` 或 `buildServer.json` 让 sourcekit-lsp 连接一个 Build Server Protocol 服务器。Xcode 项目就用这种方式(见 [Xcode 项目](#xcode-项目))。
- **`compile_commands.json`**:编译数据库,例如由 CMake 生成。
### 包依赖
在项目视图或编辑器里右键 `Package.swift`,或者在查找操作(`⇧⌘A` / `Ctrl+Shift+A`)中执行:
- **解析 Swift 包依赖**执行 `swift package resolve`:拉取依赖并写入 `Package.resolved`。
- **更新 Swift 包依赖**执行 `swift package update`:把依赖升级到 `Package.swift` 允许的最新版本。
两者都在 `Package.swift` 所在目录执行,输出显示在运行工具窗口。sourcekit-lsp 会监听 `Package.swift` 和 `Package.resolved`,任一变化(包括 `git pull` 之后)都会重新加载包,所以新依赖的补全不用重启语言服务器就能用。
`.sourcekit-lsp/config.json` 存放 sourcekit-lsp 自己的选项,见 [sourcekit-lsp 配置文件说明](https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Configuration%20File.md)。
### Xcode 项目
+150
Переглянути файл
@@ -0,0 +1,150 @@
import type { Locator, Page } from "@playwright/test";
import { expect, test } from "./fixtures";
const source = "export function outer() {\n function inner() {\n return 1;\n }\n return inner();\n}\n";
const path = "/dev/acme-api/local-appearance.ts";
const initial = { lineNumbers: true, whitespaces: false, gutterIcons: true, indentGuides: true };
const local = { lineNumbers: false, whitespaces: true, gutterIcons: false, indentGuides: false };
const controls = [
{ key: "lineNumbers", id: "editor.toggleLocalLineNumbers", alias: "EditorToggleShowLineNumbers" },
{ key: "whitespaces", id: "editor.toggleLocalWhitespaces", alias: "EditorToggleShowWhitespaces" },
{ key: "gutterIcons", id: "editor.toggleLocalGutterIcons", alias: "EditorToggleShowGutterIcons" },
{ key: "indentGuides", id: "editor.toggleLocalIndentGuides", alias: "EditorToggleShowIndentLines" },
] as const;
type Appearance = typeof initial;
async function setGlobalAppearance(page: Page, value: Appearance) {
await page.evaluate(async (value) => {
const projectPath = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ projectPath);
const current = useProject.getState().settings;
useProject.setState({
settings: {
...current,
editor: {
...current?.editor,
showWhitespace: value.whitespaces,
showGutterIcons: value.gutterIcons,
appearance: {
...current?.editor.appearance,
lineNumbers: value.lineNumbers,
indentGuides: value.indentGuides,
},
},
},
});
}, value);
}
async function runIdeaAction(page: Page, alias: string) {
const ran = await page.evaluate(async (alias) => {
const actionsPath = "/src/platform/actions.ts";
const rcPath = "/src/features/vim/rc.ts";
const { executeAction } = await import(/* @vite-ignore */ actionsPath);
const { resolveActionId } = await import(/* @vite-ignore */ rcPath);
return executeAction(resolveActionId(alias));
}, alias);
expect(ran).toBe(true);
}
async function toggled(page: Page, id: string) {
return page.evaluate(async (id) => {
const actionsPath = "/src/platform/actions.ts";
const { actionToggled, getAction } = await import(/* @vite-ignore */ actionsPath);
return actionToggled(getAction(id));
}, id);
}
async function rendered(pane: Locator): Promise<Appearance> {
return {
lineNumbers: (await pane.locator(".cm-lineNumbers").count()) > 0,
whitespaces: (await pane.locator(".cm-highlightSpace").count()) > 0,
gutterIcons: await pane.locator(".cm-openidea-bookmark").isVisible(),
indentGuides: (await pane.locator(".cm-openidea-guides").count()) > 0,
};
}
test("IDEA appearance actions toggle only the active split and survive settings reconfiguration", async ({
workbench: page,
}) => {
await setGlobalAppearance(page, initial);
await page.evaluate(
async ({ path, source }) => {
const backendPath = "/src/editor/core/backend.ts";
const servicesPath = "/src/workbench/contributions.ts";
const { docBackend } = await import(/* @vite-ignore */ backendPath);
const { editorService } = await import(/* @vite-ignore */ servicesPath);
docBackend().files.set(path, source);
await editorService().openFile(path);
},
{ path, source },
);
await expect(page.locator(".cm-content")).toBeVisible();
await page.evaluate(async () => {
const actionsPath = "/src/platform/actions.ts";
const { executeAction } = await import(/* @vite-ignore */ actionsPath);
await executeAction("editor.splitRight");
});
const panes = page.locator("[data-pane-id]");
await expect(panes).toHaveCount(2);
const left = panes.first();
const right = panes.last();
await right.locator(".cm-content").focus();
await page.keyboard.press("F3");
await expect(left.locator(".cm-openidea-bookmark")).toBeVisible();
await expect(right.locator(".cm-openidea-bookmark")).toBeVisible();
expect(await rendered(left)).toEqual(initial);
const settingsBefore = await page.evaluate(async () => {
const projectPath = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ projectPath);
return structuredClone(useProject.getState().settings);
});
for (const control of controls) {
await runIdeaAction(page, control.alias);
expect(await toggled(page, control.id)).toBe(local[control.key]);
}
expect(await rendered(right)).toEqual(local);
expect(await rendered(left)).toEqual(initial);
expect(
await page.evaluate(async () => {
const projectPath = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ projectPath);
return useProject.getState().settings;
}),
).toEqual(settingsBefore);
// Match the globals to the local values, then move them back: only the untouched split follows.
for (const value of [local, initial]) {
await setGlobalAppearance(page, value);
await page.evaluate(async () => {
const controllerPath = "/src/editor/core/controller.ts";
const { editorController } = await import(/* @vite-ignore */ controllerPath);
editorController().manager.applySettings();
});
expect(await rendered(right)).toEqual(local);
expect(await rendered(left)).toEqual(value);
}
await left.locator(".cm-content").focus();
for (const control of controls) await expect.poll(() => toggled(page, control.id)).toBe(initial[control.key]);
await right.locator(".cm-content").focus();
for (const control of controls) await expect.poll(() => toggled(page, control.id)).toBe(local[control.key]);
for (const control of controls) await runIdeaAction(page, control.alias);
expect(await rendered(right)).toEqual(initial);
expect(await rendered(left)).toEqual(initial);
await setGlobalAppearance(page, { ...initial, gutterIcons: false });
await page.evaluate(async () => {
const controllerPath = "/src/editor/core/controller.ts";
const { editorController } = await import(/* @vite-ignore */ controllerPath);
editorController().manager.applySettings();
});
await expect(right.locator(".cm-openidea-bookmark")).toBeVisible();
await expect(left.locator(".cm-openidea-bookmark")).toBeHidden();
expect(await toggled(page, "editor.toggleLocalGutterIcons")).toBe(true);
});
+5 -3
Переглянути файл
@@ -48,7 +48,8 @@ pub struct LocalDataInfo {
pub env_override: bool,
}
#[desktop_command(trust = trusted)]
/// Read-only, and the welcome window shows it too: no project needed.
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub fn caches_local_data_info(app: AppHandle, state: State<'_, AppState>) -> IdeResult<LocalDataInfo> {
@@ -65,8 +66,9 @@ pub fn caches_local_data_info(app: AppHandle, state: State<'_, AppState>) -> Ide
/// Stores (`Some`) or clears (`None`, an empty string counts) the custom
/// local-data root; with `migrate`, the current tree moves at the next start.
/// Returns the directory that takes effect after a restart. The caller
/// restarts the IDE (see `app_restart`).
#[desktop_command(trust = trusted)]
/// restarts the IDE (see `app_restart`). An app-wide setting, so it works from
/// the welcome window too; a Restricted Mode project window can't change it.
#[desktop_command(trust = outside_restricted)]
#[tauri::command]
#[specta::specta]
pub fn caches_set_local_data_dir(
+4 -3
Переглянути файл
@@ -33,8 +33,9 @@ pub struct GtkPickOptions {
}
/// True when the plugin's dialogs can't be shown here: Linux with no portal service on the session
/// bus (running or activatable) and no `zenity`.
#[desktop_command(trust = trusted)]
/// bus (running or activatable) and no `zenity`. Every window picks files (the welcome
/// window opens projects with it), so no trust check.
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub async fn file_dialog_needs_gtk() -> bool {
@@ -51,7 +52,7 @@ pub async fn file_dialog_needs_gtk() -> bool {
}
/// Shows a GTK file chooser attached to `window`. `None` when the user cancels.
#[desktop_command(trust = trusted)]
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub async fn gtk_pick_paths(window: tauri::Window, options: GtkPickOptions) -> IdeResult<Option<Vec<IpcPath>>> {
+1 -1
Переглянути файл
@@ -11,7 +11,7 @@ use ide_core::IdeResult;
/// Reports which of `combos` (single-stroke `Alt+Shift+R`-style bindings) are
/// already registered to another app. Empty everywhere but Windows.
#[desktop_command(trust = trusted)]
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub fn system_probe_hotkeys(combos: Vec<String>) -> IdeResult<Vec<String>> {
+5 -5
Переглянути файл
@@ -103,9 +103,9 @@ build_compile_file trusted project_host bin
build_model trusted project_host bindings async
build_run trusted project_host bindings async
build_sync trusted project_host bindings async
caches_local_data_info trusted desktop bindings sync
caches_local_data_info always desktop bindings sync
caches_schedule_invalidation always desktop bindings sync
caches_set_local_data_dir trusted desktop bindings sync
caches_set_local_data_dir outside_restricted desktop bindings sync
cancel_request always project_host bindings sync
cancel_task always project_host bindings sync
clear_caches always desktop bindings async
@@ -307,7 +307,7 @@ docker_snapshot trusted project_host bin
docker_volume_sizes trusted project_host bindings async
end_process trusted desktop bindings async
env_reload always project_host bindings async
file_dialog_needs_gtk trusted desktop bindings async
file_dialog_needs_gtk always desktop bindings async
find_dirs always project_host bindings async
find_files always project_host bindings async
find_files_named always project_host bindings async
@@ -359,7 +359,7 @@ gradle_dependencies trusted project_host bin
gradle_link_projects trusted project_host bindings async
gradle_published_catalog trusted project_host bindings async
gradle_unlink_projects trusted project_host bindings async
gtk_pick_paths trusted desktop bindings async
gtk_pick_paths always desktop bindings async
history_content always project_host bindings async
history_list always project_host bindings async
history_list_dir always project_host bindings async
@@ -749,7 +749,7 @@ syntax_node_at always project_host bin
syntax_structural_ranges always project_host bindings async
syntax_support always project_host bindings sync
system_font_families always desktop bindings async
system_probe_hotkeys trusted desktop bindings sync
system_probe_hotkeys always desktop bindings sync
term_attach always project_host bindings async
term_available_shells always project_host bindings sync
term_default_shell always project_host bindings sync
+5 -2
Переглянути файл
@@ -329,6 +329,7 @@ export const commands = {
* Returns the refreshed model; a failed build is reported in its `syncError`.
*/
buildSync: (tool: BuildTool, request: RequestId, offline: boolean, profiles: string[], buildDir: string | null, onProgress: Channel<SyncProgress>) => typedError<BuildModel, IdeError>(__TAURI_INVOKE("build_sync", { tool, request, offline, profiles, buildDir, onProgress })),
/** Read-only, and the welcome window shows it too: no project needed. */
cachesLocalDataInfo: () => typedError<LocalDataInfo, IdeError>(__TAURI_INVOKE("caches_local_data_info")),
/** Schedules the invalidation for the next start (`None` cancels a pending one). */
cachesScheduleInvalidation: (options: {
@@ -343,7 +344,8 @@ export const commands = {
* Stores (`Some`) or clears (`None`, an empty string counts) the custom
* local-data root; with `migrate`, the current tree moves at the next start.
* Returns the directory that takes effect after a restart. The caller
* restarts the IDE (see `app_restart`).
* restarts the IDE (see `app_restart`). An app-wide setting, so it works from
* the welcome window too; a Restricted Mode project window can't change it.
*/
cachesSetLocalDataDir: (path: string | null, migrate: boolean) => typedError<string, IdeError>(__TAURI_INVOKE("caches_set_local_data_dir", { path, migrate })),
cancelRequest: (id: RequestId) => __TAURI_INVOKE<void>("cancel_request", { id }),
@@ -782,7 +784,8 @@ export const commands = {
envReload: () => typedError<EnvReloaded, IdeError>(__TAURI_INVOKE("env_reload")),
/**
* True when the plugin's dialogs can't be shown here: Linux with no portal service on the session
* bus (running or activatable) and no `zenity`.
* bus (running or activatable) and no `zenity`. Every window picks files (the welcome
* window opens projects with it), so no trust check.
*/
fileDialogNeedsGtk: () => __TAURI_INVOKE<boolean>("file_dialog_needs_gtk"),
/** Folders holding indexed files, for `@` references. */
+22 -1
Переглянути файл
@@ -139,7 +139,7 @@ import { togglePinSelectedContent } from "@/workbench/toolwindows/content";
import { useToolWindowLayout } from "@/workbench/toolwindows/store";
import { toggleReadOnly } from "./fileAttributes";
import { codeVisionShown, toggleCodeVision } from "./codeVision";
import { appearanceSwitches, toggleAppearance, type AppearanceSwitch } from "./gutterMenu";
import { appearanceSwitches, localAppearanceSwitches, toggleAppearance, type AppearanceSwitch } from "./gutterMenu";
import { openNavBarPopup } from "./view/NavBarPopup";
import {
cachedStructureQueries,
@@ -819,6 +819,23 @@ const appearanceSwitch = (id: string, s: AppearanceSwitch, keywords: string[]):
run: () => toggleAppearance(s),
});
const localAppearanceSwitch = (id: string, key: keyof typeof localAppearanceSwitches): Action => {
const s = localAppearanceSwitches[key];
return {
id,
title: s.title,
description: "Toggle this appearance setting for the active editor without changing the global setting.",
category: "View",
keywords: s.keywords,
when: "textEditorActive",
enabled: () => !focusedCellEditor() && !!activeSlot(),
toggled: () => !focusedCellEditor() && (activeSlot()?.appearanceOn(key) ?? false),
run: () => {
if (!focusedCellEditor()) activeSlot()?.toggleLocalAppearance(key);
},
};
};
const schemeSwitch = (id: string, title: string, key: SchemeSwitch, keywords: string[]): Action => ({
id,
title,
@@ -943,6 +960,10 @@ export function registerEditorActions(): () => void {
"spaces",
"tabs",
]),
localAppearanceSwitch("editor.toggleLocalLineNumbers", "lineNumbers"),
localAppearanceSwitch("editor.toggleLocalWhitespaces", "whitespaces"),
localAppearanceSwitch("editor.toggleLocalGutterIcons", "gutterIcons"),
localAppearanceSwitch("editor.toggleLocalIndentGuides", "indentGuides"),
{
id: "editor.toggleCodeVision",
title: "Code Vision",
+197 -2
Переглянути файл
@@ -1,8 +1,9 @@
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { useContextKeys } from "@/platform/context";
import type { EditorSlot } from "./model/slot";
import type { EditorSlot as EditorSlotType } from "./model/slot";
import type { DocModel } from "./model/document";
let activeSlot: Partial<EditorSlot> | null = null;
let activeSlot: Partial<EditorSlotType> | null = null;
vi.mock("./controller", async (importOriginal) => ({
...(await importOriginal<object>()),
editorController: () => ({ activeSlot }),
@@ -30,6 +31,12 @@ const { registerEditorActions } = await import("./actions");
const { gutterMenuItems } = await import("./gutterMenu");
const { useProject } = await import("@/platform/project");
const { resolveActionId } = await import("@/features/vim/rc");
const { createMemoryBackend } = await import("./backend");
const { DocumentManager } = await import("./model/document");
const { EditorSlot } = await import("./model/slot");
const { gutterIconsOn, localAppearanceField } = await import("./cm/prefs");
const { DEFAULT_SETTINGS } = await import("@/features/settings/model/schema");
const { resetDistractionFree } = await import("@/workbench/distractionFree");
let dispose: () => void;
beforeAll(() => {
@@ -40,6 +47,7 @@ afterEach(() => {
activeSlot = null;
useProject.setState({ settings: null });
useContextKeys.setState({}, true);
resetDistractionFree();
vi.clearAllMocks();
});
@@ -82,6 +90,193 @@ describe("editor appearance toggle actions", () => {
expect(resolveActionId("EditorGutterToggleGlobalIndentLines")).toBe("editor.toggleIndentGuides");
expect(resolveActionId("EditorGutterToggleGlobalStickyLines")).toBe("editor.toggleStickyLines");
expect(resolveActionId("EditorStickyLinesDisableForLang")).toBe("editor.disableStickyLinesForLanguage");
expect(resolveActionId("EditorToggleShowLineNumbers")).toBe("editor.toggleLocalLineNumbers");
expect(resolveActionId("EditorToggleShowWhitespaces")).toBe("editor.toggleLocalWhitespaces");
expect(resolveActionId("EditorToggleShowGutterIcons")).toBe("editor.toggleLocalGutterIcons");
expect(resolveActionId("EditorToggleShowIndentLines")).toBe("editor.toggleLocalIndentGuides");
});
});
describe("active editor appearance toggles", () => {
const source =
"export function outer() {\n function inner() {\n return 1;\n }\n return inner();\n}\n";
const path = "/p/local-appearance.ts";
const otherPath = "/p/local-appearance-other.ts";
const controls = [
{
key: "lineNumbers",
id: "editor.toggleLocalLineNumbers",
alias: "EditorToggleShowLineNumbers",
title: "Show Line Numbers",
},
{
key: "whitespaces",
id: "editor.toggleLocalWhitespaces",
alias: "EditorToggleShowWhitespaces",
title: "Show Whitespaces",
},
{
key: "gutterIcons",
id: "editor.toggleLocalGutterIcons",
alias: "EditorToggleShowGutterIcons",
title: "Show Gutter Icons",
},
{
key: "indentGuides",
id: "editor.toggleLocalIndentGuides",
alias: "EditorToggleShowIndentLines",
title: "Show Indent Guides",
},
] as const;
type RenderedAppearance = Record<(typeof controls)[number]["key"], boolean>;
let manager: InstanceType<typeof DocumentManager> | undefined;
const slots = new Set<EditorSlotType>();
const models = new Set<DocModel>();
const parents: HTMLElement[] = [];
const setGlobalAppearance = (value: RenderedAppearance) => {
const current = useProject.getState().settings ?? DEFAULT_SETTINGS;
useProject.setState({
settings: {
...current,
editor: {
...current.editor,
showWhitespace: value.whitespaces,
showGutterIcons: value.gutterIcons,
appearance: {
...current.editor?.appearance,
lineNumbers: value.lineNumbers,
indentGuides: value.indentGuides,
},
},
},
});
};
const rendered = (slot: EditorSlotType): RenderedAppearance => {
const view = slot.view;
if (!view) throw new Error("editor is not mounted");
return {
lineNumbers: !!view.dom.querySelector(".cm-lineNumbers"),
whitespaces: !!view.dom.querySelector(".cm-highlightSpace"),
gutterIcons: !view.dom.classList.contains("cm-openidea-hideGutter-run"),
indentGuides: !!view.contentDOM.querySelector(".cm-openidea-guides"),
};
};
const openSlot = async (file = path) => {
manager ??= new DocumentManager(createMemoryBackend({ [path]: source, [otherPath]: source }), {
settings: () => useProject.getState().settings,
notify: vi.fn(),
});
const model = await manager.acquire(file);
models.add(model);
const slot = new EditorSlot(model, `${file}-${slots.size}`, {
onFocus: vi.fn(),
onBlur: vi.fn(),
onSelection: vi.fn(),
onUserEdit: vi.fn(),
onContextMenu: vi.fn(),
});
const parent = document.createElement("div");
document.body.appendChild(parent);
parents.push(parent);
slots.add(slot);
slot.mount(parent);
return slot;
};
beforeEach(() => {
setGlobalAppearance({ lineNumbers: true, whitespaces: false, gutterIcons: true, indentGuides: true });
useContextKeys.setState({ textEditorActive: true });
});
afterEach(() => {
activeSlot = null;
for (const slot of slots) slot.dispose();
slots.clear();
for (const model of models) model.dispose();
models.clear();
manager?.stop();
manager = undefined;
parents.splice(0).forEach((parent) => parent.remove());
});
it.each(controls)("$title reports effective state and changes only the active split", async (control) => {
const first = await openSlot();
const second = await openSlot();
expect(second.model).toBe(first.model);
activeSlot = first;
const initial = rendered(second);
const settingsBefore = structuredClone(useProject.getState().settings);
const action = getAction(control.id);
expect(action).toMatchObject({ title: control.title, category: "View", when: "textEditorActive" });
expect(resolveActionId(control.alias)).toBe(control.id);
expect(actionToggled(action)).toBe(initial[control.key]);
expect(await executeAction(control.id)).toBe(true);
expect(first.currentState().field(localAppearanceField)).toEqual({ [control.key]: !initial[control.key] });
expect(rendered(first)[control.key]).toBe(!initial[control.key]);
expect(rendered(second)).toEqual(initial);
expect(actionToggled(action)).toBe(!initial[control.key]);
expect(useProject.getState().settings).toEqual(settingsBefore);
expect(ipc.settingsSet).not.toHaveBeenCalled();
activeSlot = second;
expect(actionToggled(action)).toBe(initial[control.key]);
activeSlot = first;
expect(await executeAction(control.id)).toBe(true);
expect(rendered(first)[control.key]).toBe(initial[control.key]);
expect(rendered(second)).toEqual(initial);
});
it("keeps overrides across reconfiguration while untouched editors follow global changes", async () => {
const first = await openSlot();
const second = await openSlot();
activeSlot = first;
const initial = rendered(second);
expect(await Promise.all(controls.map((control) => executeAction(control.id)))).toEqual(controls.map(() => true));
const local = rendered(first);
setGlobalAppearance(local);
manager!.applySettings();
expect(rendered(first)).toEqual(local);
expect(rendered(second)).toEqual(local);
setGlobalAppearance(initial);
manager!.applySettings();
expect(rendered(first)).toEqual(local);
expect(rendered(second)).toEqual(initial);
activeSlot = second;
for (const control of controls) expect(actionToggled(getAction(control.id))).toBe(initial[control.key]);
activeSlot = first;
for (const control of controls) expect(actionToggled(getAction(control.id))).toBe(local[control.key]);
});
it("lets a local Gutter Icons override enable providers while the global setting is off", async () => {
setGlobalAppearance({ lineNumbers: true, whitespaces: false, gutterIcons: false, indentGuides: true });
const first = await openSlot();
const second = await openSlot();
activeSlot = first;
expect(gutterIconsOn(first.currentState(), "run")).toBe(false);
expect(gutterIconsOn(second.currentState(), "run")).toBe(false);
expect(await executeAction("editor.toggleLocalGutterIcons")).toBe(true);
expect(gutterIconsOn(first.currentState(), "run")).toBe(true);
expect(gutterIconsOn(second.currentState(), "run")).toBe(false);
expect(rendered(first).gutterIcons).toBe(true);
expect(rendered(second).gutterIcons).toBe(false);
});
it("does not run without an active text editor", async () => {
useContextKeys.setState({ textEditorActive: true });
expect(await Promise.all(controls.map((control) => executeAction(control.id)))).toEqual(controls.map(() => false));
await openSlot();
useContextKeys.setState({ textEditorActive: false });
expect(await Promise.all(controls.map((control) => executeAction(control.id)))).toEqual(controls.map(() => false));
expect(ipc.settingsSet).not.toHaveBeenCalled();
});
});
+53
Переглянути файл
@@ -0,0 +1,53 @@
/**
* Gutter icon groups and an editor's local appearance overrides, apart from the editor
* preferences so gutter providers can read them without loading the editor setup.
*/
import { StateEffect, StateField, type EditorState } from "@codemirror/state";
import { editorPrefs, type EditorExtras } from "@/platform/editorSettings";
/**
* Gutter icon groups of Settings › Editor › General › Gutter Icons. A hidden group sets
* `cm-openidea-hideGutter-<id>` on the editor (the theme hides the bookmark, color and
* script/compose run columns by it); the icon area's run and inheritance icons read the
* setting themselves.
*/
export const GUTTER_ICON_GROUPS = [
{ id: "run" },
{ id: "bookmarks" },
{ id: "inheritors" },
{ id: "supers" },
{ id: "colors" },
] as const;
export type GutterIconGroup = (typeof GUTTER_ICON_GROUPS)[number]["id"];
/** The four IDEA decoration switches that can be overridden on one editor. */
export interface EffectiveAppearance {
lineNumbers: boolean;
whitespaces: boolean;
gutterIcons: boolean;
indentGuides: boolean;
}
export type LocalAppearanceKey = keyof EffectiveAppearance;
export type LocalAppearanceOverride = Partial<EffectiveAppearance>;
/** Per-editor decoration overrides live in EditorState, outside the reconfigurable compartments. */
export const setLocalAppearance = StateEffect.define<LocalAppearanceOverride | null>();
export const localAppearanceField = StateField.define<LocalAppearanceOverride | null>({
create: () => null,
update(value, tr) {
for (const effect of tr.effects) if (effect.is(setLocalAppearance)) value = effect.value;
return value;
},
});
/** Gutter providers use the editor's effective value, including a local override. */
export function gutterIconsOn(
state: EditorState | undefined,
group?: GutterIconGroup,
prefs: Pick<EditorExtras, "showGutterIcons" | "gutterIconsDisabled"> = editorPrefs(),
): boolean {
const local = state?.field(localAppearanceField, false)?.gutterIcons;
return (local ?? prefs.showGutterIcons) && (!group || !prefs.gutterIconsDisabled.includes(group));
}
+30 -16
Переглянути файл
@@ -72,6 +72,17 @@ import { LINE_INSET } from "./lineInset";
import { codeLensPositions } from "./codeLens";
import { stickyMove } from "./stickySelection";
import { wheelZoomStep } from "@/platform/wheelZoom";
export {
GUTTER_ICON_GROUPS,
gutterIconsOn,
localAppearanceField,
setLocalAppearance,
type EffectiveAppearance,
type GutterIconGroup,
type LocalAppearanceKey,
type LocalAppearanceOverride,
} from "./localAppearance";
import { GUTTER_ICON_GROUPS, type EffectiveAppearance, type LocalAppearanceOverride } from "./localAppearance";
// --- soft wraps ---------------------------------------------------------------
@@ -586,20 +597,6 @@ const noSurround = EditorView.inputHandler.of((view, from, to, text) => {
return true;
});
/**
* Gutter icon groups of Settings › Editor › General › Gutter Icons. A hidden group sets
* `cm-openidea-hideGutter-<id>` on the editor (the theme hides the bookmark, color and
* script/compose run columns by it); the icon area's run and inheritance icons read the
* setting themselves.
*/
export const GUTTER_ICON_GROUPS = [
{ id: "run" },
{ id: "bookmarks" },
{ id: "inheritors" },
{ id: "supers" },
{ id: "colors" },
] as const;
/**
* Languages whose outer parser is `@lezer/html`, plus JSX / TSX, where
* simultaneous `<tag></tag>` editing works from the syntax tree. Angular
@@ -617,6 +614,20 @@ const LINKED_TAG_LANGUAGES = new Set([
"javascriptreact",
]);
/** Editor settings values after applying this editor's optional local overrides. */
export function effectiveAppearance(
prefs: EditorExtras,
showWhitespace: boolean | undefined,
override?: LocalAppearanceOverride | null,
): EffectiveAppearance {
return {
lineNumbers: override?.lineNumbers ?? prefs.appearance.lineNumbers,
whitespaces: override?.whitespaces ?? !!showWhitespace,
gutterIcons: override?.gutterIcons ?? prefs.showGutterIcons,
indentGuides: override?.indentGuides ?? prefs.appearance.indentGuides,
};
}
export interface PrefsOptions {
prefs: EditorExtras;
path: string;
@@ -625,6 +636,8 @@ export interface PrefsOptions {
wrapOverride?: boolean | null;
/** Rendered doc comments toggled for the file, overriding `appearance.renderDocComments`. */
renderedDocsOverride?: boolean | null;
/** Decoration switches toggled on this editor only; unset keys follow the global settings. */
appearanceOverride?: LocalAppearanceOverride | null;
showWhitespace: boolean | undefined;
/** Hard wrap column for this file's language. */
hardWrapAt: number;
@@ -788,6 +801,7 @@ export function prefsExtension(o: PrefsOptions): Extension {
const { prefs } = o;
const g = prefs.general;
const k = prefs.smartKeys;
const appearance = effectiveAppearance(prefs, o.showWhitespace, o.appearanceOverride);
const out: Extension[] = [
codeLensPositions.of({
usages: prefs.inlay.codeVisionUsagesPosition,
@@ -798,7 +812,7 @@ export function prefsExtension(o: PrefsOptions): Extension {
out.push(markdownImages({ path: o.path, folder: g.markdownImageFolder, pattern: g.markdownImageNamePattern }));
if (g.scrollPastEnd) out.push(scrollPastEnd());
if ((o.wrapOverride ?? softWrapActive(o.softWrap, prefs, o.path)) && g.softWrapIndent) out.push(wrapIndent);
if (o.showWhitespace) {
if (appearance.whitespaces) {
const a = prefs.appearance;
out.push(
whitespaceMarks({ leading: a.whitespaceLeading, inner: a.whitespaceInner, trailing: a.whitespaceTrailing }),
@@ -810,7 +824,7 @@ export function prefsExtension(o: PrefsOptions): Extension {
out.push(EditorView.editorAttributes.of({ class: "cm-openidea-methodSeparators" }));
if (o.renderedDocsOverride ?? prefs.appearance.renderDocComments) out.push(renderDocComments.of(true));
const hidden = GUTTER_ICON_GROUPS.filter(
(grp) => !prefs.showGutterIcons || prefs.gutterIconsDisabled.includes(grp.id),
(grp) => !appearance.gutterIcons || prefs.gutterIconsDisabled.includes(grp.id),
);
if (hidden.length)
out.push(
+53 -6
Переглянути файл
@@ -2,7 +2,7 @@
* The base extension set of every text editor, with compartments for the
* parts that change at runtime (language, settings, contributions).
*/
import { Compartment, EditorState, Facet, Prec, type Extension, type Range } from "@codemirror/state";
import { Compartment, EditorState, Facet, Prec, type StateEffect, type Extension, type Range } from "@codemirror/state";
import {
Decoration,
EditorView,
@@ -45,7 +45,16 @@ import { findExtension } from "./find";
import { codeLensExtension } from "./codeLens";
import { iconAreaExtension } from "./iconArea";
import { renderedDocsExtension } from "./renderedDocs";
import { caretExtension, fontZoom, methodLinesField, prefsExtension, softWrapActive } from "./prefs";
import {
caretExtension,
effectiveAppearance,
fontZoom,
localAppearanceField,
methodLinesField,
prefsExtension,
softWrapActive,
type LocalAppearanceOverride,
} from "./prefs";
import { bracketSyntax, commentTokens } from "./languages";
import { multiCaretMouse } from "./multiCaret";
import { columnModeExtension } from "./columnMode";
@@ -252,12 +261,17 @@ function renderMatch(match: MatchResult, state: EditorState): readonly Range<Dec
return out;
}
export function heavyExtension(docLength: number, settings?: EditorSettings): Extension {
export function heavyExtension(
docLength: number,
settings?: EditorSettings,
appearanceOverride?: LocalAppearanceOverride | null,
): Extension {
if (docLength > HEAVY_LIMIT) return [];
const prefs = prefsOf(settings);
const appearance = effectiveAppearance(prefs, settings?.showWhitespace, appearanceOverride);
return [
prefs.codeEditing.highlightBraces ? [bracketMatching({ renderMatch }), scopeContext] : [],
prefs.appearance.indentGuides ? (prefs.appearance.rainbowIndentGuides ? rainbowIndentGuides : indentGuides) : [],
appearance.indentGuides ? (prefs.appearance.rainbowIndentGuides ? rainbowIndentGuides : indentGuides) : [],
prefs.rainbowBrackets
? rainbowBrackets({ ...prefs.rainbowBracketKinds, colors: prefs.rainbowBracketColors, syntax: bracketSyntax() })
: [],
@@ -265,9 +279,9 @@ export function heavyExtension(docLength: number, settings?: EditorSettings): Ex
];
}
export function lineNumbersExtension(settings: EditorSettings | undefined): Extension {
export function lineNumbersExtension(settings: EditorSettings | undefined, override?: boolean | null): Extension {
const a = prefsOf(settings).appearance;
if (!a.lineNumbers || isDistractionFree()) return [];
if (!(override ?? a.lineNumbers) || isDistractionFree()) return [];
return a.lineNumberMode === "relative" || a.lineNumberMode === "hybrid"
? relativeLineNumbers(a.lineNumberMode === "hybrid")
: lineNumbers();
@@ -305,6 +319,7 @@ export function prefsFor(o: {
readOnly: boolean;
wrapOverride?: boolean | null;
renderedDocsOverride?: boolean | null;
appearanceOverride?: LocalAppearanceOverride | null;
}): Extension {
return prefsExtension({
prefs: prefsOf(o.settings),
@@ -312,6 +327,7 @@ export function prefsFor(o: {
softWrap: o.settings?.softWrap,
wrapOverride: o.wrapOverride,
renderedDocsOverride: o.renderedDocsOverride,
appearanceOverride: o.appearanceOverride,
showWhitespace: o.settings?.showWhitespace,
hardWrapAt: hardWrapAt(o.settings, o.info),
readOnly: o.readOnly,
@@ -321,6 +337,36 @@ export function prefsFor(o: {
});
}
export interface AppearanceOptions {
settings: EditorSettings | undefined;
path: string;
info: LanguageInfo | undefined;
readOnly: boolean;
docLength: number;
appearanceOverride?: LocalAppearanceOverride | null;
wrapOverride?: boolean | null;
renderedDocsOverride?: boolean | null;
}
/** The single reconfiguration path for all four active-editor appearance overrides. */
export function appearanceEffects(o: AppearanceOptions): StateEffect<unknown>[] {
return [
compartments.lineNumbers.reconfigure(lineNumbersExtension(o.settings, o.appearanceOverride?.lineNumbers)),
compartments.heavy.reconfigure(heavyExtension(o.docLength, o.settings, o.appearanceOverride)),
compartments.prefs.reconfigure(
prefsFor({
settings: o.settings,
path: o.path,
info: o.info,
readOnly: o.readOnly,
appearanceOverride: o.appearanceOverride,
wrapOverride: o.wrapOverride,
renderedDocsOverride: o.renderedDocsOverride,
}),
),
];
}
export function contributionExtensions(ctx: EditorDocContext): Extension {
const out: Extension[] = [];
for (const c of editorContributions()) {
@@ -385,6 +431,7 @@ const tooltipSpace = tooltips({
export function baseExtensions(o: SetupOptions): Extension {
return [
tooltipSpace,
localAppearanceField,
compartments.font.of(fontExtension(o.settings)),
openideaTheme,
compartments.lineNumbers.of(lineNumbersExtension(o.settings)),
+31
Переглянути файл
@@ -6,6 +6,7 @@ import { useProject } from "@/platform/project";
import { menuGroupItems } from "@/workbench/contributions";
import type { MenuItem } from "@/ui";
import type { EditorSlot } from "./model/slot";
import type { LocalAppearanceKey } from "./cm/prefs";
/** Whether a right-click on `target` belongs to the gutter menu (contributed gutters with their own menu handle theirs). */
export function inGutterMenuArea(target: EventTarget | null): boolean {
@@ -49,6 +50,36 @@ export const appearanceSwitches = {
export const toggleAppearance = (s: AppearanceSwitch): Promise<void> => setEditorSetting(s.key, !s.on());
/** IDEA's EditorToggleShow* actions: the same labels, scoped to the active editor. */
export interface LocalAppearanceSwitch {
title: string;
key: LocalAppearanceKey;
keywords: string[];
}
export const localAppearanceSwitches = {
lineNumbers: {
title: appearanceSwitches.lineNumbers.title,
key: "lineNumbers",
keywords: ["gutter", "hide line numbers", "active editor"],
},
whitespaces: {
title: appearanceSwitches.whitespaces.title,
key: "whitespaces",
keywords: ["render whitespace", "spaces", "tabs", "active editor"],
},
gutterIcons: {
title: "Show Gutter Icons",
key: "gutterIcons",
keywords: ["gutter", "icons", "active editor"],
},
indentGuides: {
title: appearanceSwitches.indentGuides.title,
key: "indentGuides",
keywords: ["indent lines", "indentation", "active editor"],
},
} satisfies Record<LocalAppearanceKey, LocalAppearanceSwitch>;
const switchItem = (s: AppearanceSwitch) => toggle(s.title, s.key, s.on());
function appearanceItems(): MenuItem[] {
+22 -16
Переглянути файл
@@ -42,6 +42,7 @@ import { foldEffect } from "@codemirror/language";
import { backendFolds, compactFoldFits, setBackendFolds, type BackendFold } from "../cm/folding";
import { setSyntaxHighlights } from "../cm/syntaxHighlight";
import {
appearanceEffects,
caretFor,
compartments,
detectIndent,
@@ -52,7 +53,6 @@ import {
hardWrapAt,
heavyExtension,
indentExtension,
lineNumbersExtension,
prefsFor,
prefsOf,
readOnlyExtension,
@@ -60,7 +60,7 @@ import {
wrapExtension,
HEAVY_LIMIT,
} from "../cm/setup";
import { setMethodLines, softWrapActive } from "../cm/prefs";
import { localAppearanceField, setMethodLines, softWrapActive } from "../cm/prefs";
import type { EditorSlot } from "./slot";
import { tx } from "@/platform/i18n";
import { logError } from "@/platform/errorLog";
@@ -628,21 +628,9 @@ export class DocModel {
compartments.sticky.reconfigure(stickyExtension(editor, this.meta.language)),
compartments.font.reconfigure(fontExtension(editor)),
compartments.comments.reconfigure(commentTokens(this.info, this.meta.language)),
compartments.lineNumbers.reconfigure(lineNumbersExtension(editor)),
compartments.folding.reconfigure(foldingFor(editor)),
compartments.caret.reconfigure(caretFor(editor)),
compartments.heavy.reconfigure(heavyExtension(this.sync.localText.length, editor)),
compartments.distractionFree.reconfigure(distractionFreeExtension(editor)),
compartments.prefs.reconfigure(
prefsFor({
settings: editor,
path: this.path,
info: this.info,
readOnly: this.meta.readOnly,
wrapOverride: this.softWrapOverride,
renderedDocsOverride: this.renderedDocsOverride,
}),
),
];
// LSP contributions read completion / hover timings when they are built.
const p = prefsOf(editor);
@@ -650,7 +638,19 @@ export class DocModel {
const rebuild = !!this.contributionPrefs && sig !== this.contributionPrefs;
this.contributionPrefs = sig;
for (const s of this.slots) {
s.reconfigure(effects);
s.reconfigure([
...effects,
...appearanceEffects({
settings: editor,
path: this.path,
info: this.info,
readOnly: this.meta.readOnly,
docLength: this.sync.localText.length,
appearanceOverride: s.currentState().field(localAppearanceField, false),
wrapOverride: this.softWrapOverride,
renderedDocsOverride: this.renderedDocsOverride,
}),
]);
if (rebuild) s.syncContributions(true);
}
}
@@ -677,6 +677,7 @@ export class DocModel {
readOnly,
wrapOverride: this.softWrapOverride,
renderedDocsOverride: this.renderedDocsOverride,
appearanceOverride: s.currentState().field(localAppearanceField, false),
}),
),
]);
@@ -686,7 +687,12 @@ export class DocModel {
setHeavy() {
const len = this.sync.localText.length;
for (const s of this.slots) s.reconfigure([compartments.heavy.reconfigure(heavyExtension(len, this.settings()))]);
for (const s of this.slots)
s.reconfigure([
compartments.heavy.reconfigure(
heavyExtension(len, this.settings(), s.currentState().field(localAppearanceField, false)),
),
]);
}
// --- background refresh (folding ranges, outline) -------------------------
+31 -1
Переглянути файл
@@ -32,7 +32,8 @@ import {
type TextEditorHandle,
} from "@/editor/api";
import { showContextMenu } from "@/ui";
import { baseExtensions, compartments, contributionExtensions } from "../cm/setup";
import { appearanceEffects, baseExtensions, compartments, contributionExtensions, prefsOf } from "../cm/setup";
import { effectiveAppearance, localAppearanceField, setLocalAppearance, type LocalAppearanceKey } from "../cm/prefs";
import { markdownImageFolds } from "../cm/folding";
import { gutterMenuItems, inGutterMenuArea } from "../gutterMenu";
import { offerMakeWritable } from "../fileAttributes";
@@ -163,6 +164,35 @@ export class EditorSlot {
return this.model.ctx();
}
/** Effective state of one IDEA decoration switch on this editor, not its split siblings. */
appearanceOn(key: LocalAppearanceKey): boolean {
const settings = this.model.settings();
return effectiveAppearance(
prefsOf(settings),
settings?.showWhitespace,
this.currentState().field(localAppearanceField, false),
)[key];
}
/** Toggle one decoration on this editor and rebuild all appearance compartments together. */
toggleLocalAppearance(key: LocalAppearanceKey): void {
const previous = this.currentState().field(localAppearanceField, false);
const next = { ...(previous ?? {}), [key]: !this.appearanceOn(key) };
this.reconfigure([
setLocalAppearance.of(next),
...appearanceEffects({
settings: this.model.settings(),
path: this.model.path,
info: this.model.info,
readOnly: this.model.getMeta().readOnly,
docLength: this.model.sync.localText.length,
appearanceOverride: next,
wrapOverride: this.model.softWrapOverride,
renderedDocsOverride: this.model.renderedDocsOverride,
}),
]);
}
/** The visible or kept view: the one holding the tab's state. */
get live(): EditorView | null {
return this.view ?? this.kept;
+14 -6
Переглянути файл
@@ -15,9 +15,10 @@
* implementation search walks the whole workspace, so asking again is costly.
* Library sources ask no inheritors from the server (`isLibrarySource`).
*/
import { RangeSet, StateEffect, StateField, type Extension, type Text } from "@codemirror/state";
import { RangeSet, StateEffect, StateField, type EditorState, type Extension, type Text } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, mapLineStart } from "@/editor/core/cm/iconArea";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/localAppearance";
import { isLibrarySource, shownAgain, type EditorDocContext } from "@/editor/api";
import { docOf, debounce, isUnavailable, lspRequest } from "@/editor/lsp/lsp";
import { featureBackoff, onServerSettled } from "@/editor/lsp/availability";
@@ -161,9 +162,13 @@ export function noteOtherChanges() {
}
/** Settings › Editor › General › Gutter Icons groups that are on. */
export function enabledGroups(prefs: Pick<EditorExtras, "showGutterIcons" | "gutterIconsDisabled">): Set<MarkerGroup> {
if (!prefs.showGutterIcons) return new Set();
return new Set((["inheritors", "supers"] as const).filter((g) => !prefs.gutterIconsDisabled.includes(g)));
export function enabledGroups(
prefs: Pick<EditorExtras, "showGutterIcons" | "gutterIconsDisabled">,
state?: EditorState,
): Set<MarkerGroup> {
const on = (group: MarkerGroup) =>
state ? gutterIconsOn(state, group, prefs) : prefs.showGutterIcons && !prefs.gutterIconsDisabled.includes(group);
return new Set((["inheritors", "supers"] as const).filter(on));
}
export interface MarkerDeps {
@@ -742,6 +747,9 @@ class MarkersPlugin {
changes++;
this.refresh();
} else if (u.viewportChanged || (this.skipped && shownAgain(u))) this.refresh();
// A local Gutter Icons override can enable requests the global setting suppresses.
else if (u.startState.field(localAppearanceField, false) !== u.state.field(localAppearanceField, false))
this.refresh();
// Other files may have changed meanwhile (a new implementation).
else if (u.focusChanged && u.view.hasFocus) {
const ctx = docOf(u.view);
@@ -772,7 +780,7 @@ class MarkersPlugin {
}
const gen = ++this.generation;
this.cancelRequest();
const groups = enabledGroups(editorPrefs());
const groups = enabledGroups(editorPrefs(), view.state);
if (!groups.size || gutterBackoff.active(ctx.doc)) {
if (!groups.size) this.show([]);
return;
@@ -902,7 +910,7 @@ export function implementationGutter(ctx: EditorDocContext): Extension {
// In the shared icon area, beside run icons and the rendered-doc toggle.
iconAreaSource.of({
order: 50,
markers: (view) => markerSet(view.state.field(markersField)),
markers: (view) => (gutterIconsOn(view.state) ? markerSet(view.state.field(markersField)) : RangeSet.empty),
mousedown: (view, block, e) => {
if (e.button !== 0) return false;
const target = e.target instanceof Element ? e.target.closest<HTMLElement>(`.${styles.marker}`) : null;
+23 -16
Переглянути файл
@@ -15,6 +15,7 @@ import {
} from "@/editor/api";
import { onServerSettled } from "@/editor/lsp/availability";
import { comparePos } from "@/editor/lsp/positions";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/localAppearance";
import { editorPrefs } from "@/platform/editorSettings";
import { call, commands, type DocumentColor } from "@/platform/ipc";
import { useProject } from "@/platform/project";
@@ -32,9 +33,8 @@ const colors = StateField.define<DocumentColor[]>({
});
/** Settings › Editor › General › Gutter Icons › Color preview. */
function colorsShown(settings?: unknown): boolean {
const prefs = editorPrefs(settings);
return prefs.showGutterIcons && !prefs.gutterIconsDisabled.includes("colors");
function colorsShown(state: EditorState, settings?: unknown): boolean {
return gutterIconsOn(state, "colors", editorPrefs(settings));
}
/**
@@ -68,15 +68,17 @@ export function lspColorPreview(ctx: EditorDocContext): Extension {
gutter({
class: `${styles.gutter} cm-openidea-gutter-colors cm-lsp-color-preview`,
markers: (view) =>
RangeSet.of(
view.state.field(colors).map((c) =>
new ProviderSwatch(`lsp:${c.server}`, c, view, async (chosen) => {
const list = await call(commands.lspColorPresentations(ctx.doc, chosen));
return list.map((p) => ({ label: p.label, changes: textEditsToChanges(view.state.doc, p.edits) }));
}).range(view.state.doc.line(c.range.start.line + 1).from),
),
true,
),
gutterIconsOn(view.state, "colors")
? RangeSet.of(
view.state.field(colors).map((c) =>
new ProviderSwatch(`lsp:${c.server}`, c, view, async (chosen) => {
const list = await call(commands.lspColorPresentations(ctx.doc, chosen));
return list.map((p) => ({ label: p.label, changes: textEditsToChanges(view.state.doc, p.edits) }));
}).range(view.state.doc.line(c.range.start.line + 1).from),
),
true,
)
: RangeSet.empty,
}),
ViewPlugin.define(
(view) =>
@@ -84,13 +86,13 @@ export function lspColorPreview(ctx: EditorDocContext): Extension {
timer: ReturnType<typeof setTimeout> | undefined;
generation = 0;
skipped = false;
shown = colorsShown();
shown = colorsShown(view.state);
off: () => void;
constructor() {
const offs = [
onServerSettled(() => this.schedule()),
useProject.subscribe((s, prev) => {
if (s.settings !== prev.settings && colorsShown(s.settings) !== this.shown) this.schedule();
if (s.settings !== prev.settings && colorsShown(view.state, s.settings) !== this.shown) this.schedule();
}),
];
this.off = () => offs.forEach((f) => f());
@@ -102,7 +104,12 @@ export function lspColorPreview(ctx: EditorDocContext): Extension {
this.timer = setTimeout(() => void this.run(), 300);
}
update(u: ViewUpdate) {
if (u.docChanged || (this.skipped && shownAgain(u))) this.schedule();
if (
u.docChanged ||
(this.skipped && shownAgain(u)) ||
u.startState.field(localAppearanceField, false) !== u.state.field(localAppearanceField, false)
)
this.schedule();
}
clear() {
if (view.dom.isConnected && view.state.field(colors).length) view.dispatch({ effects: setColors.of([]) });
@@ -110,7 +117,7 @@ export function lspColorPreview(ctx: EditorDocContext): Extension {
async run() {
const gen = this.generation;
const text = view.state.doc;
this.shown = colorsShown();
this.shown = colorsShown(view.state);
if (!this.shown) return this.clear();
try {
await whenSynced(view);
+8 -5
Переглянути файл
@@ -7,7 +7,7 @@
import { RangeSet, StateEffect, StateField, type Extension } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, rangeToOffsets, registerEditorContribution } from "@/editor/api";
import { editorPrefs } from "@/platform/editorSettings";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/localAppearance";
import { useProject } from "@/platform/project";
import type { FileMarkers, IndexedMarker, Location } from "@/platform/ipc";
import { markerIcon } from "./lineMarkerGutter";
@@ -65,7 +65,7 @@ export function markersOf(
entry: FileMarkers | undefined,
icons: ReadonlyMap<string, IndexedMarkerIcon> = new Map(),
): RangeSet<GutterMarker> {
if (!entry || !editorPrefs().showGutterIcons) return RangeSet.empty;
if (!entry || !gutterIconsOn(view.state)) return RangeSet.empty;
const doc = view.state.doc;
const rows = new Map<number, { targets: Location[]; icon?: IndexedMarkerIcon }>();
for (const marker of entry.markers) {
@@ -104,8 +104,8 @@ export function indexedMarkers(path: string): Extension {
// In the shared icon area, after the plugins' line markers and gutter actions.
iconAreaSource.of({
order: 70,
markers: (view) => view.state.field(markersField),
reserve: (state) => state.field(markersField).size > 0,
markers: (view) => (gutterIconsOn(view.state) ? view.state.field(markersField) : RangeSet.empty),
reserve: (state) => gutterIconsOn(state) && state.field(markersField).size > 0,
}),
INDEXED_MARKERS_THEME,
ViewPlugin.fromClass(
@@ -134,7 +134,10 @@ export function indexedMarkers(path: string): Extension {
this.schedule();
}
update(update: ViewUpdate) {
if (update.docChanged) this.last = undefined;
const appearanceChanged =
update.startState.field(localAppearanceField, false) !== update.state.field(localAppearanceField, false);
if (appearanceChanged) this.schedule();
if (update.docChanged || appearanceChanged) this.last = undefined;
}
schedule() {
if (this.queued || this.disposed) return;
+8
Переглянути файл
@@ -43,6 +43,7 @@ import {
import { runWithExecutor } from "./executors";
import { notifyCwdError, withExpandedCwd } from "./cwdMacros";
import { debugWithAgent, jdwpLaunch } from "./javaDebug";
import { debugXcodeApp } from "./xcodeDebug";
import { attachesToChild, debugAttachingToChild } from "./pluginAttach";
import { RunDialogsOverlay } from "./dialogs";
import { registerExternalTools } from "./externalTools";
@@ -51,6 +52,7 @@ import { registerComposerInstall } from "./composerInstall";
import { registerNpmInstall } from "./npmInstall";
import { registerPubspecCommands } from "./pubspec";
import { registerGoActions } from "./goActions";
import { registerSwiftPackageActions } from "./swiftpmActions";
import { registerRunTabActions } from "./runTabs";
import { invalidateGoModules } from "./goModules";
import { invalidatePythonPackages } from "./pythonPackages";
@@ -218,6 +220,11 @@ async function debugLaunch(config: RunConfig, chain: readonly string[], show?: b
await debugAttachingToChild(config, { show, prepared: true });
return;
}
// An Xcode scheme: the app is launched suspended on the simulator and lldb-dap attaches to it.
if (config.kind === "xcode" && getAction("debug.attach")) {
await debugXcodeApp(config, show);
return;
}
// Remote JVM Debug, Go Remote…: the debugger attaches, nothing is launched here.
if (isDebugOnly(config) && getAction("debug.startConfig")) {
await executeAction("debug.startConfig", show === false ? { config, show: false } : config);
@@ -475,6 +482,7 @@ export function activate(): () => void {
registerBuiltinTypes(),
registerRunConfigType(junitType),
registerGoActions(),
registerSwiftPackageActions(),
registerFlutterBuildActions(),
registerRunTabActions(),
registerComposerInstall(),
+2 -2
Переглянути файл
@@ -399,13 +399,13 @@ export function entryGutter(
iconAreaSource.of({
order: 10,
markers: (view) =>
runIconsShown()
runIconsShown(view.state)
? RangeSet.of(
view.state.field(entriesField).map((e) => new ScriptMarker(e, path, menu, title).range(e.pos)),
true,
)
: RangeSet.empty,
reserve: (state) => runIconsShown() && state.field(entriesField).length > 0,
reserve: (state) => runIconsShown(state) && state.field(entriesField).length > 0,
// The marker's own click opens the menu; keep the press from moving the caret.
mousedown: (_view, _block, event) => {
if (event.button !== 0 || !(event.target as HTMLElement).closest?.(`.${styles.runMarker}`)) return false;
+6 -7
Переглянути файл
@@ -7,7 +7,7 @@
import { RangeSet, StateEffect, StateField, type EditorState, type Extension } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, mapLineStart, type EditorDocContext } from "@/editor/api";
import { editorPrefs } from "@/platform/editorSettings";
import { gutterIconsOn } from "@/editor/core/cm/localAppearance";
import { useProject } from "@/platform/project";
import { isVirtualUri } from "@/platform/virtualDocs";
import { shortcutLabel } from "@/platform/keymap";
@@ -200,9 +200,8 @@ class RunMarker extends GutterMarker {
}
/** Settings › Editor › General › Gutter Icons › Run icons (on with the gutter icons). */
export function runIconsShown(): boolean {
const prefs = editorPrefs();
return prefs.showGutterIcons && !prefs.gutterIconsDisabled.includes("run");
export function runIconsShown(state: EditorState): boolean {
return gutterIconsOn(state, "run");
}
/** The gutter asks for markers on every update: rebuild only when targets or test results changed. */
@@ -294,11 +293,11 @@ export function runGutter(ctx: EditorDocContext): Extension {
// In the shared icon area, beside the inheritance icons and the rendered-doc toggle.
iconAreaSource.of({
order: 10,
markers: (view) => (runIconsShown() ? markers(view.state, path) : RangeSet.empty),
markers: (view) => (runIconsShown(view.state) ? markers(view.state, path) : RangeSet.empty),
// One icon of width while the file has run targets, so icons don't shift the text as they load.
reserve: (state) => runIconsShown() && state.field(targetsField).length > 0,
reserve: (state) => runIconsShown(state) && state.field(targetsField).length > 0,
mousedown: (view, block, event) => {
if (event.button !== 0 || !runIconsShown()) return false;
if (event.button !== 0 || !runIconsShown(view.state)) return false;
const el = (event.target as HTMLElement).closest?.(`.${styles.runMarker}`) as HTMLElement | null;
const target = el && view.state.field(targetsField).find((t) => t.pos === block.from);
if (!el || !target) return false;
+38
Переглянути файл
@@ -0,0 +1,38 @@
import { describe, expect, it } from "vitest";
import { swiftPackageCommand, swiftPackageManifest, swiftPackageMenu } from "./swiftpmActions";
describe("SwiftPM package commands", () => {
it("runs resolve and update in the manifest's folder", () => {
for (const operation of ["resolve", "update"] as const) {
expect(swiftPackageCommand(operation, "/work/app/Package.swift")).toMatchObject({
kind: "swiftpm",
command: "swift",
args: ["package", operation],
cwd: "/work/app",
isTest: false,
});
}
});
it("rejects other files and NULs", () => {
expect(swiftPackageCommand("resolve", "/work/app/main.swift")).toBeNull();
expect(swiftPackageCommand("resolve", "/work/app/Package.resolved")).toBeNull();
expect(swiftPackageCommand("update", "/work/a\0b/Package.swift")).toBeNull();
});
it("offers the actions only on a single Package.swift", () => {
expect(swiftPackageMenu({ paths: ["/p/Package.swift"] }).map((m) => m.action)).toEqual([
"swift.package.resolve",
"swift.package.update",
]);
expect(swiftPackageMenu({ paths: ["/p/Package.swift", "/q/Package.swift"] })).toEqual([]);
expect(swiftPackageMenu({ paths: ["/p/Sources/main.swift"] })).toEqual([]);
});
it("falls back to the project root's Package.swift when another file is active", async () => {
const has = (paths: string[]) => async (p: string) => paths.includes(p);
expect(await swiftPackageManifest("/p/sub/Package.swift", "/p", has([]))).toBe("/p/sub/Package.swift");
expect(await swiftPackageManifest("/p/Sources/main.swift", "/p", has(["/p/Package.swift"]))).toBe(
"/p/Package.swift",
);
expect(await swiftPackageManifest("/p/Sources/main.swift", "/p", has([]))).toBeNull();
expect(await swiftPackageManifest("", undefined, has(["/Package.swift"]))).toBeNull();
});
});
+101
Переглянути файл
@@ -0,0 +1,101 @@
import { executeAction, getAction, registerActions } from "@/platform/actions";
import { call, commands, type RunConfig } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { registerMenuGroup, maybeEditorService, notifications, type MenuGroupContext } from "@/workbench/contributions";
import { loadConfigs, startRun } from "./store";
export type SwiftPackageOperation = "resolve" | "update";
const ACTIONS = {
resolve: { id: "swift.package.resolve", title: "Resolve Swift Packages" },
update: { id: "swift.package.update", title: "Update Swift Packages" },
} as const;
/** `swift package resolve|update` in the folder of a `Package.swift`. */
export function swiftPackageCommand(operation: SwiftPackageOperation, path: string): RunConfig | null {
if (!path.endsWith("/Package.swift") || path.includes("\0")) return null;
return {
id: `swiftpm:${operation}:${path}`,
name: `swift package ${operation}`,
kind: "swiftpm",
command: "swift",
args: ["package", operation],
cwd: path.slice(0, path.lastIndexOf("/")),
env: {},
detected: true,
isTest: false,
debugAdapter: null,
};
}
const MANIFEST = "/Package.swift";
/**
* The manifest an action runs on: the given or active `Package.swift`, else the project root's
* one if `exists` finds it (Find Action from a source file).
*/
export async function swiftPackageManifest(
path: string,
root: string | undefined,
exists: (path: string) => Promise<boolean>,
): Promise<string | null> {
if (path.endsWith(MANIFEST)) return path;
const fallback = root ? `${root}${MANIFEST}` : "";
return fallback && (await exists(fallback)) ? fallback : null;
}
const fileExists = (path: string) =>
call(commands.fsReadDir(path.slice(0, path.lastIndexOf("/"))))
.then((entries) => entries.some((e) => e.name === "Package.swift"))
.catch(() => false);
export function swiftPackageMenu(ctx: MenuGroupContext) {
const path = ctx.paths.length === 1 ? ctx.paths[0]! : "";
if (!path.endsWith("/Package.swift")) return [];
return Object.values(ACTIONS).map((a) => ({ kind: "action" as const, action: a.id, arg: { path } }));
}
export function registerSwiftPackageActions(): () => void {
const actions = registerActions(
Object.entries(ACTIONS).map(([operation, spec]) => ({
...spec,
category: "Swift",
when: "projectOpen",
run: async ({ arg }: { arg?: unknown }) => {
const path =
typeof arg === "string"
? arg
: arg && typeof arg === "object" && "path" in arg && typeof arg.path === "string"
? arg.path
: (maybeEditorService()?.activePath() ?? "");
const root = useProject.getState().project?.root;
const manifest = await swiftPackageManifest(path, root, fileExists);
const config = manifest && swiftPackageCommand(operation as SwiftPackageOperation, manifest);
if (!config) {
notifications().notify({
group: "run",
level: "warning",
title: "No Package.swift found",
body: "Open a Package.swift, or a project with one in its root folder.",
});
return;
}
await startRun(config, undefined, undefined, {
onExit: () => {
// New products in resolved dependencies can change the detected run configurations.
void loadConfigs();
if (getAction("libraries.reload")) void executeAction("libraries.reload");
},
});
},
})),
);
const menu = registerMenuGroup({
id: "swift.packages",
menus: ["projectView", "editorTab", "editor"],
items: (_menu, ctx) => swiftPackageMenu(ctx),
});
return () => {
menu();
actions();
};
}
+55
Переглянути файл
@@ -0,0 +1,55 @@
import { beforeEach, expect, test, vi } from "vitest";
import type { RunConfig } from "@/platform/ipc";
const { startRun, executeAction } = vi.hoisted(() => ({ startRun: vi.fn(), executeAction: vi.fn() }));
vi.mock("./store", () => ({ startRun }));
vi.mock("@/platform/actions", () => ({ executeAction }));
import { debugXcodeApp, launchedPid } from "./xcodeDebug";
const config = {
id: "xcode:run:App.xcodeproj:App",
name: "App",
kind: "xcode",
params: { container: "App.xcodeproj", scheme: "App" },
} as unknown as RunConfig;
beforeEach(() => {
startRun.mockReset();
executeAction.mockReset();
});
test("simctl's launch line gives the pid", () => {
expect(launchedPid("dev.example.App: 4321")).toBe(4321);
expect(launchedPid("dev.example.App: 4321\r\n")).toBe(4321);
expect(launchedPid("note: 12")).toBeNull();
expect(launchedPid("** BUILD SUCCEEDED **")).toBeNull();
});
test("Debug launches the app suspended and attaches lldb-dap to its pid once", async () => {
startRun.mockImplementation(async (_c, _r, _b, options) => {
// The launch line can arrive before startRun returns the run's id.
options.onLine("Build succeeded");
options.onLine("dev.example.App: 4321");
options.onLine("dev.example.App: 9999");
return { runId: 7 };
});
await debugXcodeApp(config, false);
const [, , , options] = startRun.mock.calls[0]!;
expect(options.launch.params).toEqual({ container: "App.xcodeproj", scheme: "App", waitForDebugger: "1" });
expect(executeAction).toHaveBeenCalledTimes(1);
expect(executeAction).toHaveBeenCalledWith("debug.attach", {
attachable: {
pid: 4321,
name: "App",
commandLine: "",
kind: "native",
adapter: "lldb-dap",
host: null,
port: null,
},
process: 7,
runConfig: config,
show: false,
});
});
+47
Переглянути файл
@@ -0,0 +1,47 @@
/**
* Debug for an Xcode scheme: the run builds and installs the app as Run does, but launches it
* suspended (`simctl launch --wait-for-debugger`); lldb-dap then attaches to the pid simctl
* prints, and the app's console output stays in the run's console.
*/
import { executeAction } from "@/platform/actions";
import type { AttachableProcess, RunConfig } from "@/platform/ipc";
import { startRun } from "./store";
/** `simctl launch`'s first line, `<bundle id>: <pid>`. */
const LAUNCHED = /^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+: (\d+)$/;
export function launchedPid(line: string): number | null {
const m = LAUNCHED.exec(line.trim());
return m ? Number(m[1]) : null;
}
export async function debugXcodeApp(config: RunConfig, show?: boolean): Promise<void> {
let runId: number | null = null;
let pending: number | null = null;
let attached = false;
const attach = (pid: number) => {
attached = true;
const attachable: AttachableProcess = {
pid,
name: config.params?.scheme || config.name,
commandLine: "",
kind: "native",
adapter: "lldb-dap",
host: null,
port: null,
};
void executeAction("debug.attach", { attachable, process: runId, runConfig: config, show });
};
const session = await startRun(config, undefined, undefined, {
launch: { ...config, params: { ...config.params, waitForDebugger: "1" } },
show,
onLine: (line) => {
const pid = attached || pending !== null ? null : launchedPid(line);
if (pid === null) return;
if (runId === null) pending = pid;
else attach(pid);
},
});
runId = session?.runId ?? null;
if (runId !== null && pending !== null && !attached) attach(pending);
}
+2
Переглянути файл
@@ -10,6 +10,8 @@ export const xcodeType: RunConfigTypeContribution = {
label: "Xcode App",
icon: "file-swift",
description: "Build an Xcode scheme and run it on the iOS Simulator",
// Debug launches the app suspended and attaches lldb-dap to it (`debugXcodeApp`).
debugAdapter: "lldb-dap",
fields: [
{
key: "container",
+5 -6
Переглянути файл
@@ -6,8 +6,8 @@
import { RangeSet, StateEffect, StateField, type EditorState, type Extension } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, mapLineStart, type EditorDocContext } from "@/editor/api";
import { gutterIconsOn } from "@/editor/core/cm/localAppearance";
import { executeAction } from "@/platform/actions";
import { editorPrefs } from "@/platform/editorSettings";
import { useProject } from "@/platform/project";
import { gutterIconMarkup, showContextMenu, type MenuItem } from "@/ui";
import {
@@ -103,9 +103,8 @@ class Marker extends GutterMarker {
}
/** Settings › Editor › General › Gutter Icons › Run icons (on with the gutter icons). */
function runIconsShown(): boolean {
const prefs = editorPrefs();
return prefs.showGutterIcons && !prefs.gutterIconsDisabled.includes("run");
function runIconsShown(state: EditorState): boolean {
return gutterIconsOn(state, "run");
}
export function dockerGutter(ctx: EditorDocContext): Extension {
@@ -143,13 +142,13 @@ export function dockerGutter(ctx: EditorDocContext): Extension {
iconAreaSource.of({
order: 10,
markers: (view) =>
runIconsShown()
runIconsShown(view.state)
? RangeSet.of(
view.state.field(targetsField).map((p) => new Marker(p.target, path).range(p.pos)),
true,
)
: RangeSet.empty,
reserve: (state) => runIconsShown() && state.field(targetsField).length > 0,
reserve: (state) => runIconsShown(state) && state.field(targetsField).length > 0,
}),
];
}
+38 -22
Переглянути файл
@@ -207,6 +207,9 @@ describe("synchronized navigation scrolling", () => {
});
describe("wheel over a pane that cannot scroll further", () => {
const movedBy = new WeakMap<Element, ReturnType<typeof vi.fn>>();
const moved = (view: EditorView) => movedBy.get(view.scrollDOM)!;
let wheeling = false;
// Lines deleted at the end: the left pane is long, the right one fits without scrolling.
// `lead` lines come above those in the left pane only.
function panes(sync = true, { left = 200, right = 25, lead = 0 } = {}) {
@@ -220,9 +223,17 @@ describe("wheel over a pane that cannot scroll further", () => {
const scrollDOM = dom.appendChild(document.createElement("div"));
Object.defineProperty(scrollDOM, "scrollHeight", { value: lines * LINE });
Object.defineProperty(scrollDOM, "clientHeight", { value: 500 });
scrollDOM.scrollBy = vi.fn((_x: number, y: number) => {
scrollDOM.scrollTop = Math.max(0, Math.min(scrollDOM.scrollTop + y, lines * LINE - 500));
}) as unknown as typeof scrollDOM.scrollBy;
// A scroll made while handling a wheel is recorded as the distance asked for; any is clamped to the pane.
const moved = vi.fn();
let top = 0;
Object.defineProperty(scrollDOM, "scrollTop", {
get: () => top,
set: (to: number) => {
if (wheeling) moved(0, to - top);
top = Math.max(0, Math.min(to, lines * LINE - 500));
},
});
movedBy.set(scrollDOM, moved);
return {
dom,
scrollDOM,
@@ -243,7 +254,12 @@ describe("wheel over a pane that cannot scroll further", () => {
controller.attach({ a, b, chunks: Chunk.build(a.state.doc, b.state.doc) } as unknown as MergeView);
const wheel = (el: Element, deltaY: number, deltaMode = 0, init: WheelEventInit = {}) => {
const e = new WheelEvent("wheel", { deltaY, deltaMode, cancelable: true, ...init });
el.dispatchEvent(e);
wheeling = true;
try {
el.dispatchEvent(e);
} finally {
wheeling = false;
}
return e.defaultPrevented;
};
return { a, b, controller, wheel, divider: root.querySelector(".cm-diffDivider")! };
@@ -254,13 +270,13 @@ describe("wheel over a pane that cannot scroll further", () => {
const p = panes();
try {
expect(p.wheel(p.b.scrollDOM, 120)).toBe(false);
expect(p.a.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, 120);
expect(moved(p.a)).toHaveBeenLastCalledWith(0, 120);
p.wheel(p.divider, 80);
expect(p.a.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, 80);
expect(moved(p.a)).toHaveBeenLastCalledWith(0, 80);
// The left pane can still scroll down itself: nothing is passed on.
vi.mocked(p.b.scrollDOM.scrollBy).mockClear();
moved(p.b).mockClear();
p.wheel(p.a.scrollDOM, 120);
expect(p.b.scrollDOM.scrollBy).not.toHaveBeenCalled();
expect(moved(p.b)).not.toHaveBeenCalled();
} finally {
p.controller.destroy();
frame.mockRestore();
@@ -272,7 +288,7 @@ describe("wheel over a pane that cannot scroll further", () => {
const p = panes(true, { left: 25, right: 200 });
try {
expect(p.wheel(p.a.scrollDOM, 120)).toBe(false);
expect(p.b.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, 120);
expect(moved(p.b)).toHaveBeenLastCalledWith(0, 120);
p.b.scrollDOM.dispatchEvent(new Event("scroll"));
expect(p.b.scrollDOM.scrollTop).toBe(120);
} finally {
@@ -290,11 +306,11 @@ describe("wheel over a pane that cannot scroll further", () => {
expect(p.a.scrollDOM.scrollTop).toBe(3000);
// The right pane can't scroll at all: the left one comes back by the wheel's own distance.
expect(p.wheel(p.b.scrollDOM, -3, WheelEvent.DOM_DELTA_LINE)).toBe(false);
expect(p.a.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, -3 * LINE);
expect(moved(p.a)).toHaveBeenLastCalledWith(0, -3 * LINE);
p.a.scrollDOM.dispatchEvent(new Event("scroll"));
expect(p.a.scrollDOM.scrollTop).toBe(3000 - 3 * LINE);
p.wheel(p.divider, -80);
expect(p.a.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, -80);
expect(moved(p.a)).toHaveBeenLastCalledWith(0, -80);
p.a.scrollDOM.dispatchEvent(new Event("scroll"));
expect(p.a.scrollDOM.scrollTop).toBe(3000 - 3 * LINE - 80);
} finally {
@@ -311,9 +327,9 @@ describe("wheel over a pane that cannot scroll further", () => {
p.a.scrollDOM.dispatchEvent(new Event("scroll"));
p.a.scrollDOM.scrollTop = 2000;
p.a.scrollDOM.dispatchEvent(new Event("scroll"));
vi.mocked(p.a.scrollDOM.scrollBy).mockClear();
moved(p.a).mockClear();
expect(p.wheel(p.b.scrollDOM, -120)).toBe(false);
expect(p.a.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, -120);
expect(moved(p.a)).toHaveBeenLastCalledWith(0, -120);
} finally {
p.controller.destroy();
frame.mockRestore();
@@ -334,12 +350,12 @@ describe("wheel over a pane that cannot scroll further", () => {
p.b.scrollDOM.dispatchEvent(new Event("scroll"));
p.a.scrollDOM.dispatchEvent(new Event("scroll"));
expect(p.a.scrollDOM.scrollTop).toBeCloseTo(p.b.scrollDOM.scrollTop);
vi.mocked(p.a.scrollDOM.scrollBy).mockClear();
moved(p.a).mockClear();
expect(p.wheel(p.b.scrollDOM, -120)).toBe(false);
// Elsewhere again, by something other than a wheel passed on.
p.a.scrollDOM.scrollTop = 3000;
expect(p.wheel(p.b.scrollDOM, -120)).toBe(false);
expect(p.a.scrollDOM.scrollBy).not.toHaveBeenCalled();
expect(moved(p.a)).not.toHaveBeenCalled();
} finally {
p.controller.destroy();
frame.mockRestore();
@@ -360,7 +376,7 @@ describe("wheel over a pane that cannot scroll further", () => {
}
// The pointer moves to the left pane, which can still scroll: the wheel is its own.
expect(p.wheel(p.a.scrollDOM, 120)).toBe(false);
expect(p.b.scrollDOM.scrollBy).not.toHaveBeenCalled();
expect(moved(p.b)).not.toHaveBeenCalled();
expect(p.a.scrollDOM.scrollTop).toBe(mapped + 480);
} finally {
p.controller.destroy();
@@ -380,7 +396,7 @@ describe("wheel over a pane that cannot scroll further", () => {
expect(p.a.scrollDOM.scrollTop).toBe(mapped + 100);
// A wheel longer than what is left: the left pane stops where the right one will map it.
p.wheel(p.b.scrollDOM, -120);
expect(p.a.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, -220);
expect(moved(p.a)).toHaveBeenLastCalledWith(0, -220);
p.b.scrollDOM.scrollTop -= 120; // the native scroll
p.b.scrollDOM.dispatchEvent(new Event("scroll"));
p.a.scrollDOM.dispatchEvent(new Event("scroll"));
@@ -399,8 +415,8 @@ describe("wheel over a pane that cannot scroll further", () => {
try {
for (let i = 0; i < 3; i++) expect(p.wheel(p.b.scrollDOM, 120)).toBe(false);
expect(p.wheel(p.divider, 120)).toBe(true);
expect(p.b.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, 120);
expect(p.a.scrollDOM.scrollBy).not.toHaveBeenCalled();
expect(moved(p.b)).toHaveBeenLastCalledWith(0, 120);
expect(moved(p.a)).not.toHaveBeenCalled();
} finally {
p.controller.destroy();
frame.mockRestore();
@@ -417,7 +433,7 @@ describe("wheel over a pane that cannot scroll further", () => {
expect(p.b.scrollDOM.scrollLeft).toBe(40);
expect(p.a.scrollDOM.scrollLeft).toBe(40);
p.wheel(p.b.scrollDOM, 120, 0, { shiftKey: true });
expect(p.a.scrollDOM.scrollBy).not.toHaveBeenCalled();
expect(moved(p.a)).not.toHaveBeenCalled();
} finally {
p.controller.destroy();
frame.mockRestore();
@@ -429,7 +445,7 @@ describe("wheel over a pane that cannot scroll further", () => {
const p = panes();
try {
expect(p.wheel(p.b.scrollDOM, 120, 0, { deltaX: 10 })).toBe(false);
expect(p.a.scrollDOM.scrollBy).toHaveBeenLastCalledWith(0, 120);
expect(moved(p.a)).toHaveBeenLastCalledWith(0, 120);
p.a.scrollDOM.dispatchEvent(new Event("scroll"));
p.b.scrollDOM.scrollLeft = 10; // the native horizontal scroll
p.b.scrollDOM.dispatchEvent(new Event("scroll"));
@@ -530,7 +546,7 @@ describe("wheel over a pane that cannot scroll further", () => {
p.wheel(p.b.scrollDOM, 120);
p.a.scrollDOM.scrollTop = 3000;
p.wheel(p.b.scrollDOM, -120);
expect(p.a.scrollDOM.scrollBy).not.toHaveBeenCalled();
expect(moved(p.a)).not.toHaveBeenCalled();
} finally {
p.controller.destroy();
frame.mockRestore();
+5 -2
Переглянути файл
@@ -503,7 +503,10 @@ export class UnalignedPanes implements DiffPanes {
this.interruptScroll();
this.leadWheel("b");
this.passOn("b", e);
mv.b.scrollDOM.scrollBy(e.deltaX, e.deltaY);
// Offsets rather than scrollBy, which can leave WebKit's compositor at a stale, unpainted offset.
const scroller = mv.b.scrollDOM;
scroller.scrollLeft += e.deltaX;
scroller.scrollTop += e.deltaY;
};
this.divider.addEventListener("wheel", onWheel, { passive: false });
this.cleanup.push(() => this.divider.removeEventListener("wheel", onWheel));
@@ -616,7 +619,7 @@ export class UnalignedPanes implements DiffPanes {
const room = dy > 0 ? el.scrollHeight - el.clientHeight - el.scrollTop : el.scrollTop;
const scroll = (by: number, dir: number) => {
const before = other.scrollTop;
other.scrollBy(0, by);
other.scrollTop += by;
if (other.scrollTop !== before) this.passed[to] = { top: other.scrollTop, dir };
};
const passed = this.passed[to];
+10 -3
Переглянути файл
@@ -865,17 +865,24 @@ function MarkdownPreview({ path, tabId, sync }: { path: string; tabId: string; s
const max = root.scrollHeight - root.clientHeight;
if (max <= root.clientHeight || (e.deltaY > 0 ? root.scrollTop >= max : root.scrollTop <= 0)) return;
for (let el = e.target instanceof Element ? e.target : null; el && el !== root; el = el.parentElement) {
if (el.scrollHeight <= el.clientHeight && (!e.deltaX || el.scrollWidth <= el.clientWidth)) continue;
// A code block's last line can overflow it by a pixel; that doesn't make it a vertical scroller.
const vertical =
el.scrollHeight - el.clientHeight > 1 &&
(e.deltaY > 0 ? el.scrollTop + el.clientHeight < el.scrollHeight - 1 : el.scrollTop > 0);
if (!vertical && (!e.deltaX || el.scrollWidth <= el.clientWidth)) continue;
const style = getComputedStyle(el);
if (
(el.scrollHeight > el.clientHeight && /^(auto|scroll)$/.test(style.overflowY)) ||
(vertical && /^(auto|scroll)$/.test(style.overflowY)) ||
(e.deltaX && el.scrollWidth > el.clientWidth && /^(auto|scroll)$/.test(style.overflowX))
)
return;
}
// WebKit decides on the first wheel event whether it can scroll ahead of paint for the entire gesture.
e.preventDefault();
root.scrollBy(e.deltaX, e.deltaY);
// Set the offsets rather than scrollBy: WebKit's compositor can fall behind a run of
// scrollBy calls and show a stale offset whose content was never painted.
root.scrollLeft += e.deltaX;
root.scrollTop += e.deltaY;
};
root.addEventListener("wheel", onPreviewWheel, { passive: false });
root.addEventListener("wheel", onWheel, { capture: true, passive: false });
+11 -3
Переглянути файл
@@ -95,8 +95,13 @@ describe("Markdown source scroll", () => {
vi.spyOn(view, "viewportLineBlocks", "get").mockReturnValue([block]);
const measure = vi.spyOn(view, "requestMeasure").mockImplementation(() => {});
const lineAtHeight = vi.spyOn(view, "lineBlockAtHeight").mockReturnValue(block);
const scrollBy = vi.fn();
Object.defineProperty(view.scrollDOM, "scrollBy", { value: scrollBy });
const scrolled: [string, number][] = [];
for (const side of ["scrollTop", "scrollLeft"] as const)
Object.defineProperty(view.scrollDOM, side, {
configurable: true,
get: () => 0,
set: (v: number) => scrolled.push([side, v]),
});
const dispose = installMarkdownSourceScroll(view.dom);
const wheel = (init: WheelEventInit) =>
view.contentDOM.dispatchEvent(new WheelEvent("wheel", { bubbles: true, cancelable: true, ...init }));
@@ -106,7 +111,10 @@ describe("Markdown source scroll", () => {
expect(wheel({ deltaY: 100, ctrlKey: true })).toBe(true);
expect(wheel({ deltaX: 100, deltaY: 10 })).toBe(true);
expect(wheel({ deltaX: 3, deltaY: 100 })).toBe(false);
expect(scrollBy).toHaveBeenCalledExactlyOnceWith(3, 100);
expect(scrolled).toEqual([
["scrollLeft", 3],
["scrollTop", 100],
]);
expect(measure).toHaveBeenCalledTimes(1);
expect(lineAtHeight).toHaveBeenCalledExactlyOnceWith(100);
} finally {
+3 -1
Переглянути файл
@@ -230,7 +230,9 @@ export function installMarkdownSourceScroll(root: HTMLElement): () => void {
// A native jump can expose a virtual gap before CodeMirror redraws. Move and measure together.
event.preventDefault();
scroller.scrollBy(event.deltaX, target - current);
// Offsets rather than scrollBy, which can leave WebKit's compositor at a stale offset.
scroller.scrollLeft += event.deltaX;
scroller.scrollTop = target;
view.requestMeasure();
view.lineBlockAtHeight(nextTop);
};
+36 -4
Переглянути файл
@@ -81,7 +81,7 @@ describe("preview-only scroll position", () => {
second.unmount();
});
it("handles a long preview gesture from its first pixel and leaves nested scrolling native", () => {
it("handles a long preview gesture from its first pixel and leaves nested scrolling native while it can move", () => {
open(mdCtx);
act(() => useMarkdownModes.setState((s) => ({ byTab: { ...s.byTab, t: "preview" } })));
render(
@@ -96,10 +96,36 @@ describe("preview-only scroll position", () => {
});
const scrollBy = vi.fn();
preview.scrollBy = scrollBy;
const scrolled: [number, number][] = [];
let left = 0;
let top = 0;
Object.defineProperties(preview, {
scrollLeft: { configurable: true, get: () => left, set: (v: number) => void (left = v) },
scrollTop: {
configurable: true,
get: () => top,
set: (v: number) => {
scrolled.push([left, v]);
top = v;
},
},
});
const nested = document.createElement("pre");
nested.style.overflowY = "auto";
Object.defineProperties(nested, { clientHeight: { value: 30 }, scrollHeight: { value: 120 } });
preview.appendChild(nested);
const snug = document.createElement("pre");
snug.style.overflowY = "auto";
Object.defineProperties(snug, { clientHeight: { value: 75 }, scrollHeight: { value: 76 } });
preview.appendChild(snug);
const scrolledDown = document.createElement("pre");
scrolledDown.style.overflowY = "auto";
Object.defineProperties(scrolledDown, {
clientHeight: { value: 30 },
scrollHeight: { value: 120 },
scrollTop: { value: 90 },
});
preview.appendChild(scrolledDown);
const wheel = (target: Element, init: WheelEventInit) =>
target.dispatchEvent(
new WheelEvent("wheel", {
@@ -108,17 +134,23 @@ describe("preview-only scroll position", () => {
...init,
}),
);
expect(wheel(preview, { deltaY: 1 })).toBe(false);
expect(wheel(preview, { deltaY: -300 })).toBe(true);
expect(wheel(preview, { deltaY: 1 })).toBe(false);
expect(wheel(preview, { deltaY: 300, deltaMode: 1 })).toBe(true);
expect(wheel(preview, { deltaY: 300, deltaX: 400 })).toBe(true);
expect(wheel(nested, { deltaY: 300 })).toBe(true);
expect(wheel(preview, { deltaY: 300, deltaX: 1 })).toBe(false);
expect(wheel(snug, { deltaY: 10 })).toBe(false);
expect(wheel(scrolledDown, { deltaY: 10 })).toBe(false);
expect(wheel(scrolledDown, { deltaY: -10 })).toBe(true);
Object.defineProperty(preview, "scrollHeight", { value: 650 });
expect(wheel(preview, { deltaY: 1 })).toBe(true);
expect(scrollBy.mock.calls).toEqual([
expect(scrollBy).not.toHaveBeenCalled();
expect(scrolled).toEqual([
[0, 1],
[1, 300],
[1, 301],
[1, 311],
[1, 321],
]);
});
+1
Переглянути файл
@@ -331,6 +331,7 @@ describe("catalogs", () => {
"Go",
"Rust",
"Kotlin",
"Swift",
"Claude Code",
"GitHub Copilot",
"Codex",
+4
Переглянути файл
@@ -158,6 +158,10 @@ export const IDEA_ACTIONS: Readonly<Record<string, string>> = {
EditorGutterToggleGlobalLineNumbers: "editor.toggleLineNumbers",
EditorGutterToggleGlobalIndentLines: "editor.toggleIndentGuides",
EditorGutterToggleGlobalStickyLines: "editor.toggleStickyLines",
EditorToggleShowWhitespaces: "editor.toggleLocalWhitespaces",
EditorToggleShowLineNumbers: "editor.toggleLocalLineNumbers",
EditorToggleShowGutterIcons: "editor.toggleLocalGutterIcons",
EditorToggleShowIndentLines: "editor.toggleLocalIndentGuides",
EditorStickyLinesDisableForLang: "editor.disableStickyLinesForLanguage",
ActivateProjectToolWindow: "toolwindow.project",
HideAllWindows: "toolwindow.hideAll",
+5
Переглянути файл
@@ -102,6 +102,11 @@ describe("IDEA keymap parity", () => {
["editor.toggleStickySelection", [], []],
// EditorSelectLine has no shortcut.
["editor.selectLine", [], []],
// EditorToggleShow* actions have no shortcut.
["editor.toggleLocalLineNumbers", [], []],
["editor.toggleLocalWhitespaces", [], []],
["editor.toggleLocalGutterIcons", [], []],
["editor.toggleLocalIndentGuides", [], []],
// CopyAsPlainText / CopyAsRichText have no shortcut.
["code.copyAsPlainText", [], []],
["code.copyAsRichText", [], []],
+4
Переглянути файл
@@ -321,6 +321,10 @@ export const intellijMacos: Record<string, string[]> = {
"editor.toggleIndentGuides": [],
"editor.toggleStickyLines": [],
"editor.toggleWhitespaces": [],
"editor.toggleLocalLineNumbers": [],
"editor.toggleLocalWhitespaces": [],
"editor.toggleLocalGutterIcons": [],
"editor.toggleLocalIndentGuides": [],
// Build
"build.buildProject": ["Meta+F9"],
+4
Переглянути файл
@@ -315,6 +315,10 @@ export const intellijWindows: Record<string, string[]> = {
"editor.toggleIndentGuides": [],
"editor.toggleStickyLines": [],
"editor.toggleWhitespaces": [],
"editor.toggleLocalLineNumbers": [],
"editor.toggleLocalWhitespaces": [],
"editor.toggleLocalGutterIcons": [],
"editor.toggleLocalIndentGuides": [],
// Build
"build.buildProject": ["Ctrl+F9"],
+4
Переглянути файл
@@ -251,6 +251,10 @@ export const vscodeMacos: Record<string, string[]> = {
"editor.toggleIndentGuides": [],
"editor.toggleStickyLines": [],
"editor.toggleWhitespaces": [],
"editor.toggleLocalLineNumbers": [],
"editor.toggleLocalWhitespaces": [],
"editor.toggleLocalGutterIcons": [],
"editor.toggleLocalIndentGuides": [],
"window.toggleFullScreen": ["Meta+Ctrl+F"],
// Project window groups are an IntelliJ concept; VS Code has no counterpart.
"window.nextTab": [],
+4
Переглянути файл
@@ -125,6 +125,10 @@
"menu.activeEditor": "Active Editor",
"menu.editor.toggleSoftWrap": "Soft-Wrap",
"menu.editor.toggleRenderedDocs": "Render Documentation Comments",
"menu.editor.toggleLocalWhitespaces": "Show Whitespaces",
"menu.editor.toggleLocalLineNumbers": "Show Line Numbers",
"menu.editor.toggleLocalGutterIcons": "Show Gutter Icons",
"menu.editor.toggleLocalIndentGuides": "Show Indent Guides",
"menu.app": "OpenIDEA",
"menu.app.about": "About OpenIDEA",
"menu.app.checkForUpdates": "Check for Updates…",
+4
Переглянути файл
@@ -117,6 +117,10 @@
"menu.activeEditor": "Активный редактор",
"menu.editor.toggleSoftWrap": "Перенос строк",
"menu.editor.toggleRenderedDocs": "Отображать комментарии документации",
"menu.editor.toggleLocalWhitespaces": "Показывать пробелы",
"menu.editor.toggleLocalLineNumbers": "Показывать номера строк",
"menu.editor.toggleLocalGutterIcons": "Показывать значки на полях",
"menu.editor.toggleLocalIndentGuides": "Показывать направляющие отступов",
"menu.app": "OpenIDEA",
"menu.app.about": "О программе OpenIDEA",
"menu.app.checkForUpdates": "Проверить наличие обновлений…",
+7
Переглянути файл
@@ -3696,11 +3696,13 @@
"Soft Wraps": "软换行",
"Soft-Wrap": "软换行",
"Show Line Numbers": "显示行号",
"Show Gutter Icons": "显示 Gutter 图标",
"Show Indent Guides": "显示缩进参考线",
"Disable Sticky Lines for Language": "为当前语言禁用粘滞行",
"Disable sticky lines for the current document's language without changing the global setting.": "为当前文档的语言禁用粘滞行,不更改全局设置。",
"Show Sticky Lines": "显示粘滞行",
"Show Whitespaces": "显示空白",
"Toggle this appearance setting for the active editor without changing the global setting.": "切换活动编辑器的此项外观设置,而不更改全局设置。",
"Use Soft Wraps": "使用软换行",
"Soft-wrap": "软换行",
"Soft-wrap files": "软换行文件",
@@ -7423,6 +7425,11 @@
"Open a project to configure Go modules.": "打开项目以配置 Go 模块。",
"Go Mod Tidy": "整理 Go 模块依赖",
"Download Go Modules": "下载 Go 模块",
"Resolve Swift Packages": "解析 Swift 包依赖",
"Update Swift Packages": "更新 Swift 包依赖",
"No Package.swift found": "找不到 Package.swift",
"Open a Package.swift, or a project with one in its root folder.": "请打开一个 Package.swift,或打开根目录里有 Package.swift 的项目。",
"Swift": "Swift",
"Sync Go Workspace": "同步 Go 工作区",
"Add Directory to Go Workspace…": "添加目录到 Go 工作区…",
"Add Directory to Go Workspace": "添加目录到 Go 工作区",
+4
Переглянути файл
@@ -117,6 +117,10 @@
"menu.activeEditor": "Etkin Düzenleyici",
"menu.editor.toggleSoftWrap": "Satırları Otomatik Kaydır",
"menu.editor.toggleRenderedDocs": "Belgelendirme Yorumlarını Biçimlendir",
"menu.editor.toggleLocalWhitespaces": "Boşlukları Göster",
"menu.editor.toggleLocalLineNumbers": "Satır Numaralarını Göster",
"menu.editor.toggleLocalGutterIcons": "Kenar Simgelerini Göster",
"menu.editor.toggleLocalIndentGuides": "Girinti Kılavuzlarını Göster",
"menu.app": "OpenIDEA",
"menu.app.about": "OpenIDEA Hakkında",
"menu.app.checkForUpdates": "Güncellemeleri Denetle…",
+4
Переглянути файл
@@ -117,6 +117,10 @@
"menu.activeEditor": "活動編輯器",
"menu.editor.toggleSoftWrap": "軟換行",
"menu.editor.toggleRenderedDocs": "渲染文件註解",
"menu.editor.toggleLocalWhitespaces": "顯示空白",
"menu.editor.toggleLocalLineNumbers": "顯示行號",
"menu.editor.toggleLocalGutterIcons": "顯示 Gutter 圖示",
"menu.editor.toggleLocalIndentGuides": "顯示縮排參考線",
"menu.app": "OpenIDEA",
"menu.app.about": "關於 OpenIDEA",
"menu.app.checkForUpdates": "檢查更新…",
+4
Переглянути файл
@@ -125,6 +125,10 @@
"menu.activeEditor": "活动编辑器",
"menu.editor.toggleSoftWrap": "软换行",
"menu.editor.toggleRenderedDocs": "渲染文档注释",
"menu.editor.toggleLocalWhitespaces": "显示空白",
"menu.editor.toggleLocalLineNumbers": "显示行号",
"menu.editor.toggleLocalGutterIcons": "显示 Gutter 图标",
"menu.editor.toggleLocalIndentGuides": "显示缩进参考线",
"menu.app": "OpenIDEA",
"menu.app.about": "关于 OpenIDEA",
"menu.app.checkForUpdates": "检查更新…",