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

..
Автор SHA1 Повідомлення Дата
l0ng-ai 3f57f1795b feat(java): suggest variable names from the declared type 2026-11-27 04:54:02 +08:00
40 змінених файлів з 53 додано та 989 видалено

No files matched your search

-10
Переглянути файл
@@ -486,16 +486,6 @@ pub struct LanguageCodeStyle {
/// SQL › Case › Identifiers (unquoted names): `upper` | `lower` | `keep`.
#[serde(skip_serializing_if = "Option::is_none")]
pub identifier_case: Option<String>,
/// Java: organize imports switches to a wildcard import once this many
/// classes of one package are used (jdtls `starThreshold`; IDEA's default
/// 5; unset keeps the language server's default).
#[serde(skip_serializing_if = "Option::is_none")]
pub class_count_to_use_import_with_star: Option<u32>,
/// Java: organize imports switches to a wildcard static import once this
/// many statically imported names are used (jdtls `staticStarThreshold`;
/// IDEA's default 3; unset keeps the language server's default).
#[serde(skip_serializing_if = "Option::is_none")]
pub names_count_to_use_static_import_with_star: Option<u32>,
/// JavaScript / TypeScript › Punctuation › Semicolons: `ignore` | `insert` | `remove`.
#[serde(skip_serializing_if = "Option::is_none")]
pub semicolons: Option<String>,
-53
Переглянути файл
@@ -34,20 +34,6 @@ fn indent_settings(style: &LanguageCodeStyle) -> Option<Vec<(&'static str, Strin
Some(settings)
}
/// Java organize-imports thresholds as jdtls settings (IDEA's "Class count to use import with
/// '*'" and "Names count to use static import with '*'"). Unset ones are IDEA's defaults, 5 and 3:
/// jdtls' own are 99 (single imports), and it keeps a value it was sent until another one comes.
/// A threshold the server configuration sets explicitly is kept.
fn organize_imports_settings(style: Option<&LanguageCodeStyle>, inherited: &serde_json::Value) -> serde_json::Value {
let explicit = |key: &str| inherited.pointer(&format!("/java/sources/organizeImports/{key}")).cloned();
let class_count = style.and_then(|s| s.class_count_to_use_import_with_star).unwrap_or(5);
let static_count = style.and_then(|s| s.names_count_to_use_static_import_with_star).unwrap_or(3);
json!({
"starThreshold": explicit("starThreshold").unwrap_or(json!(class_count)),
"staticStarThreshold": explicit("staticStarThreshold").unwrap_or(json!(static_count)),
})
}
fn patch_profile_xml(mut xml: String, settings: &[(&'static str, String)]) -> String {
for (id, value) in settings {
let marker = format!(r#"<setting id="{id}" value=""#);
@@ -98,7 +84,6 @@ pub fn configure_formatter(
});
let mut settings = cfg.settings.take().unwrap_or_else(|| json!({}));
settings["java"]["format"]["settings"] = formatter_overrides(defaults, overrides);
settings["java"]["sources"]["organizeImports"] = organize_imports_settings(style, &inherited);
cfg.settings = Some(settings);
let Some(style) = style else { return Ok(()) };
let indent = indent_settings(style);
@@ -315,44 +300,6 @@ mod tests {
}
}
#[test]
fn organize_imports_thresholds_default_to_idea_and_keep_explicit_server_settings() {
let dir = tempfile::tempdir().unwrap();
let root = dir.path().join("project");
std::fs::create_dir_all(&root).unwrap();
let imports = |cfg: &LanguageServerConfig| {
crate::handler::all_settings(cfg)["java"]["sources"]["organizeImports"].clone()
};
let mut cfg = config("jdtls");
let style = LanguageCodeStyle {
class_count_to_use_import_with_star: Some(7),
names_count_to_use_static_import_with_star: Some(4),
..Default::default()
};
configure_formatter(&mut cfg, Some(&style), &root, dir.path(), None).unwrap();
assert_eq!(imports(&cfg), json!({"starThreshold": 7, "staticStarThreshold": 4}));
// Unset: IDEA's 5 and 3, not jdtls' 99 (#6026).
let mut cfg = config("jdtls");
let style = LanguageCodeStyle { names_count_to_use_static_import_with_star: Some(2), ..Default::default() };
configure_formatter(&mut cfg, Some(&style), &root, dir.path(), None).unwrap();
assert_eq!(imports(&cfg), json!({"starThreshold": 5, "staticStarThreshold": 2}));
let mut cfg = config("jdtls");
configure_formatter(&mut cfg, None, &root, dir.path(), None).unwrap();
assert_eq!(imports(&cfg), json!({"starThreshold": 5, "staticStarThreshold": 3}));
// A threshold set in the server configuration wins.
let mut cfg = config("jdtls");
cfg.settings = Some(json!({"java": {"sources": {"organizeImports": {"starThreshold": 99}}}}));
configure_formatter(&mut cfg, Some(&style), &root, dir.path(), None).unwrap();
assert_eq!(imports(&cfg), json!({"starThreshold": 99, "staticStarThreshold": 2}));
let mut cfg = config("rust-analyzer");
configure_formatter(&mut cfg, None, &root, dir.path(), None).unwrap();
assert!(crate::handler::all_settings(&cfg)["java"].is_null());
}
#[test]
fn default_keeps_explicit_server_configuration_and_custom_accepts_absolute_paths() {
let dir = tempfile::tempdir().unwrap();
-2
Переглянути файл
@@ -152,8 +152,6 @@ impl SshManager {
let config = self.config(id)?;
let secret = self.secret(&config);
let session = Arc::new(self.connect(id, &SshTarget::from(&config), secret.as_deref()).await?);
// The shared session carries the config's port forwards, restarted on every reconnect.
session.start_forwards().await;
self.sessions.lock().insert(id.to_owned(), session.clone());
Ok(session)
}
+3 -115
Переглянути файл
@@ -7,9 +7,7 @@
//! (or is recorded silently under `StrictHostKeyChecking accept-new`), and a
//! changed key is refused unless host key checking is off.
use crate::target::{
ForwardDirection, Hop, HostKeyPolicy, PortForward, SshFiles, SshTarget, expand, home, resolve_hops,
};
use crate::target::{Hop, HostKeyPolicy, SshFiles, SshTarget, expand, home, resolve_hops};
use ide_core::remote_settings::SshAuth;
use ide_core::{IdeError, IdeResult, error::ErrorKind};
use parking_lot::Mutex;
@@ -115,18 +113,6 @@ pub struct Session {
/// Sessions of the `ProxyJump` hosts, kept alive under `handle`.
_jumps: Vec<Handle<Client>>,
label: String,
/// The config's `LocalForward` / `RemoteForward`s, started by [`Session::start_forwards`].
forwards: Vec<PortForward>,
/// `LocalForward` listeners, stopped with the session.
listeners: Mutex<Vec<tokio::task::AbortHandle>>,
}
impl Drop for Session {
fn drop(&mut self) {
for listener in self.listeners.lock().drain(..) {
listener.abort();
}
}
}
impl Session {
@@ -172,50 +158,8 @@ impl Session {
sessions.push(handle);
}
let handle = sessions.pop().expect("at least one hop");
let last = hops.last().expect("at least one hop");
Ok(Session {
handle,
_jumps: sessions,
label: last.label(),
forwards: last.forwards.clone(),
listeners: Mutex::default(),
})
}
/// Starts the config's `LocalForward` / `RemoteForward`s, as `ssh` does on connecting: the
/// SSH host listens for each `RemoteForward` (`tcpip-forward`), this machine for each
/// `LocalForward`, until the session closes. A port that cannot be forwarded (in use, refused
/// by the server) is skipped with a warning, as `ssh` goes on without it.
pub async fn start_forwards(self: &Arc<Self>) {
for f in &self.forwards {
let what = format!("{}:{} → {}:{}", f.bind, f.port, f.host, f.host_port);
match f.direction {
ForwardDirection::Remote => match self.handle.tcpip_forward(f.bind.clone(), u32::from(f.port)).await {
Ok(_) => tracing::info!("{}: RemoteForward {what}", self.label),
Err(e) => tracing::warn!("{}: RemoteForward {what} failed: {e}", self.label),
},
ForwardDirection::Local => {
let bind = match f.bind.as_str() {
"localhost" => "127.0.0.1",
"" => "0.0.0.0",
b => b,
};
match tokio::net::TcpListener::bind((bind, f.port)).await {
Ok(listener) => {
let task = tokio::spawn(local_forward(
listener,
Arc::downgrade(self),
f.host.clone(),
f.host_port,
));
self.listeners.lock().push(task.abort_handle());
tracing::info!("{}: LocalForward {what}", self.label);
}
Err(e) => tracing::warn!("{}: LocalForward {what} failed: {e}", self.label),
}
}
}
}
let label = hops.last().expect("at least one hop").label();
Ok(Session { handle, _jumps: sessions, label })
}
/// `user@host:port` of the target.
@@ -460,39 +404,6 @@ fn io(message: impl Into<String>) -> IdeError {
IdeError::new(ErrorKind::Io, message)
}
/// A `LocalForward` listener: each connection goes through a `direct-tcpip` channel to
/// `host:port` from the SSH host, while the session lives.
async fn local_forward(listener: tokio::net::TcpListener, session: std::sync::Weak<Session>, host: String, port: u16) {
while let Ok((mut socket, _)) = listener.accept().await {
let Some(session) = session.upgrade().filter(|s| !s.is_closed()) else { return };
let host = host.clone();
tokio::spawn(async move {
match session.direct_tcpip(&host, port).await {
Ok(mut stream) => {
drop(session);
let _ = tokio::io::copy_bidirectional(&mut socket, &mut stream).await;
}
Err(e) => tracing::warn!("LocalForward: cannot open a channel to {host}:{port}: {e}"),
}
});
}
}
/// A `RemoteForward` connection: accepted once `host:port` here answers, then copied both ways.
async fn remote_forward(channel: russh::Channel<Msg>, reply: client::ChannelOpenHandle, host: String, port: u16) {
match tokio::net::TcpStream::connect((host.as_str(), port)).await {
Ok(mut socket) => {
reply.accept().await;
let mut stream = channel.into_stream();
let _ = tokio::io::copy_bidirectional(&mut socket, &mut stream).await;
}
Err(e) => {
tracing::warn!("RemoteForward: cannot connect to {host}:{port}: {e}");
reply.reject(russh::ChannelOpenFailure::ConnectFailed).await;
}
}
}
// --- connection ----------------------------------------------------------------
#[derive(Debug)]
@@ -507,8 +418,6 @@ pub struct Client {
known_hosts: PathBuf,
host_key_policy: HostKeyPolicy,
issue: Arc<Mutex<Option<HostKeyIssue>>>,
/// The `RemoteForward`s whose connections this client accepts.
remote_forwards: Vec<PortForward>,
}
impl client::Handler for Client {
@@ -533,26 +442,6 @@ impl client::Handler for Client {
*self.issue.lock() = Some(issue);
Ok(false)
}
async fn server_channel_open_forwarded_tcpip(
&mut self,
channel: russh::Channel<Msg>,
_connected_address: &str,
connected_port: u32,
_originator_address: &str,
_originator_port: u32,
reply: client::ChannelOpenHandle,
_session: &mut client::Session,
) -> Result<(), Self::Error> {
// Only a port this client asked the server to forward is accepted.
match self.remote_forwards.iter().find(|f| u32::from(f.port) == connected_port) {
Some(f) => {
tokio::spawn(remote_forward(channel, reply, f.host.clone(), f.host_port));
}
None => reply.reject(russh::ChannelOpenFailure::AdministrativelyProhibited).await,
}
Ok(())
}
}
impl Client {
@@ -711,7 +600,6 @@ where
known_hosts: effective_known_hosts,
host_key_policy: hop.host_key_policy,
issue: issue.clone(),
remote_forwards: hop.forwards.iter().filter(|f| f.direction == ForwardDirection::Remote).cloned().collect(),
};
let result = match stream {
None => client::connect(config, (hop.host.as_str(), hop.port), handler).await,
+2 -114
Переглянути файл
@@ -54,63 +54,6 @@ pub(crate) struct Hop {
pub host_key_policy: HostKeyPolicy,
pub known_hosts: Option<PathBuf>,
pub agent: Agent,
/// `LocalForward` / `RemoteForward` of the config (the target's; jump hosts forward nothing).
pub forwards: Vec<PortForward>,
}
/// A `LocalForward` or `RemoteForward` of `~/.ssh/config`.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PortForward {
pub direction: ForwardDirection,
/// Address the listening side binds: empty for every address, `localhost` by default.
pub bind: String,
pub port: u16,
/// Where each connection goes, as the other side sees it.
pub host: String,
pub host_port: u16,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ForwardDirection {
/// `LocalForward`: this machine listens, connections go to `host:host_port` from the SSH host.
Local,
/// `RemoteForward`: the SSH host listens, connections go to `host:host_port` from this machine.
Remote,
}
/// `[bind_address:]port host:hostport` (or the one-argument `-L` / `-R` form with colons); IPv6
/// addresses in brackets. `None` for what isn't a TCP forward: a Unix socket, or `RemoteForward`'s
/// dynamic (SOCKS) form.
pub(crate) fn parse_forward(direction: ForwardDirection, value: &str) -> Option<PortForward> {
let spec = split_args(value).join(":");
let mut parts: Vec<String> = Vec::new();
let mut cur = String::new();
let mut bracket = false;
for ch in spec.chars() {
match ch {
'[' if cur.is_empty() => bracket = true,
']' if bracket => bracket = false,
':' if !bracket => parts.push(std::mem::take(&mut cur)),
'/' => return None,
_ => cur.push(ch),
}
}
parts.push(cur);
let (bind, port, host, host_port) = match parts.as_slice() {
[port, host, host_port] => (None, port, host, host_port),
[bind, port, host, host_port] => (Some(bind.as_str()), port, host, host_port),
_ => return None,
};
let bind = match bind {
None => "localhost".to_owned(),
Some("*") | Some("") => String::new(),
Some(b) => b.to_owned(),
};
let (port, host_port) = (port.parse().ok()?, host_port.parse().ok()?);
if host.is_empty() || host_port == 0 {
return None;
}
Some(PortForward { direction, bind, port, host: host.clone(), host_port })
}
/// Where the SSH agent of a hop listens (`IdentityAgent`).
@@ -215,8 +158,6 @@ struct RawConfig {
host_key_policy: Option<HostKeyPolicy>,
user_known_hosts_file: Option<String>,
identity_agent: Option<String>,
forwards: Vec<PortForward>,
clear_forwardings: bool,
}
fn strip_quotes(s: &str) -> &str {
@@ -575,23 +516,6 @@ fn parse_config_file(
out.user_known_hosts_file = Some(first);
}
}
"localforward" | "remoteforward" => {
let direction = if key.eq_ignore_ascii_case("localforward") {
ForwardDirection::Local
} else {
ForwardDirection::Remote
};
match parse_forward(direction, value) {
Some(f) if !out.forwards.contains(&f) => out.forwards.push(f),
Some(_) => {}
None => tracing::debug!("ssh config: {key} {value} is not a TCP port forward; skipped"),
}
}
"clearallforwardings" => {
if matches!(strip_quotes(value).to_ascii_lowercase().as_str(), "yes" | "true") {
out.clear_forwardings = true;
}
}
_ => {}
}
}
@@ -635,8 +559,7 @@ fn config_hop(
if null_known_hosts { HostKeyPolicy::Off } else { raw.host_key_policy.unwrap_or(HostKeyPolicy::Ask) };
let agent =
identity_agent(raw.identity_agent.as_deref(), |p| expand(&expand_tokens(p, alias, &host, port, &user, &local)));
let forwards = if raw.clear_forwardings { Vec::new() } else { raw.forwards };
let hop = Hop { host, port, user, identity_files, proxy_command, host_key_policy, known_hosts, agent, forwards };
let hop = Hop { host, port, user, identity_files, proxy_command, host_key_policy, known_hosts, agent };
(hop, proxy_jump)
}
@@ -651,7 +574,7 @@ fn jump_hop(config: Option<&Path>, spec: &str) -> Hop {
_ => (rest, None),
};
let (hop, _) = config_hop(config, host, port, user);
Hop { forwards: Vec::new(), ..hop }
hop
}
/// The SSH hosts to go through, the target last.
@@ -674,7 +597,6 @@ pub(crate) fn resolve_hops(target: &SshTarget, config: Option<&Path>) -> IdeResu
host_key_policy: HostKeyPolicy::Ask,
known_hosts: None,
agent: Agent::Default,
forwards: Vec::new(),
},
None,
)
@@ -714,40 +636,6 @@ pub fn openssh_args(target: &SshTarget) -> Vec<String> {
mod tests {
use super::*;
#[test]
fn parses_port_forwards_like_openssh() {
let f = |d, v: &str| parse_forward(d, v).map(|f| (f.bind, f.port, f.host, f.host_port));
let remote = ForwardDirection::Remote;
assert_eq!(f(remote, "9222 127.0.0.1:9222"), Some(("localhost".into(), 9222, "127.0.0.1".into(), 9222)));
assert_eq!(f(remote, "0.0.0.0:8080 web:80"), Some(("0.0.0.0".into(), 8080, "web".into(), 80)));
assert_eq!(f(remote, "*:8080 web:80"), Some((String::new(), 8080, "web".into(), 80)));
assert_eq!(f(remote, "[::1]:8080 [::1]:80"), Some(("::1".into(), 8080, "::1".into(), 80)));
assert_eq!(f(ForwardDirection::Local, "5432:db:5432"), Some(("localhost".into(), 5432, "db".into(), 5432)));
// Dynamic (SOCKS) and Unix socket forwards aren't TCP port forwards.
assert_eq!(f(remote, "1080"), None);
assert_eq!(f(remote, "/tmp/a.sock /tmp/b.sock"), None);
assert_eq!(f(remote, "8080 web:http"), None);
}
#[test]
fn config_forwards_belong_to_the_target_and_clear_all_forwardings_drops_them() {
let dir = tempfile::tempdir().unwrap();
let config = dir.path().join("config");
std::fs::write(
&config,
"Host box\n RemoteForward 9222 127.0.0.1:9222\n LocalForward 5432 db:5432\n ProxyJump gate\n\
Host gate\n LocalForward 1 a:1\nHost quiet\n RemoteForward 9222 127.0.0.1:9222\n ClearAllForwardings yes\n",
)
.unwrap();
let target = |host: &str| SshTarget { host: host.into(), auth: SshAuth::OpenSsh, ..Default::default() };
let hops = resolve_hops(&target("box"), Some(&config)).unwrap();
assert_eq!(hops.len(), 2);
assert!(hops[0].forwards.is_empty(), "jump hosts forward nothing");
let dirs: Vec<_> = hops[1].forwards.iter().map(|f| (f.direction, f.port)).collect();
assert_eq!(dirs, [(ForwardDirection::Remote, 9222), (ForwardDirection::Local, 5432)]);
assert!(resolve_hops(&target("quiet"), Some(&config)).unwrap()[0].forwards.is_empty());
}
#[test]
fn resolves_aliases_and_proxy_jumps_from_ssh_config() {
let tmp = tempfile::tempdir().unwrap();
-73
Переглянути файл
@@ -98,32 +98,6 @@ impl server::Handler for Sshd {
});
Ok(())
}
/// `RemoteForward`: listens on 127.0.0.1:`port` and forwards each connection back to the client.
async fn tcpip_forward(
&mut self,
address: &str,
port: &mut u32,
session: &mut ServerSession,
) -> Result<bool, Self::Error> {
let Ok(listener) = TcpListener::bind(("127.0.0.1", *port as u16)).await else { return Ok(false) };
let (handle, address, port) = (session.handle(), address.to_owned(), *port);
tokio::spawn(async move {
while let Ok((mut socket, peer)) = listener.accept().await {
let Ok(channel) = handle
.channel_open_forwarded_tcpip(address.clone(), port, "127.0.0.1", u32::from(peer.port()))
.await
else {
continue;
};
tokio::spawn(async move {
let mut stream = channel.into_stream();
let _ = tokio::io::copy_bidirectional(&mut stream, &mut socket).await;
});
}
});
Ok(true)
}
}
/// Echo server standing in for a remote service.
@@ -469,50 +443,3 @@ async fn accept_new_records_an_unknown_key_and_still_refuses_a_changed_one() {
let msg = denied(env.connect(&target, None).await);
assert!(msg.contains("has changed"), "{msg}");
}
/// A free local port (bound and released).
fn free_port() -> u16 {
std::net::TcpListener::bind("127.0.0.1:0").unwrap().local_addr().unwrap().port()
}
async fn echoes(port: u16) {
let mut s = TcpStream::connect(("127.0.0.1", port)).await.expect("forwarded port listens");
s.write_all(b"ping").await.unwrap();
let mut buf = [0u8; 4];
s.read_exact(&mut buf).await.unwrap();
assert_eq!(&buf, b"ping");
}
/// `RemoteForward` and `LocalForward` of `~/.ssh/config` are forwarded while the session lives (#6031).
#[tokio::test]
async fn config_port_forwards_follow_the_session() {
let mut env = env().await;
let (remote, local) = (free_port(), free_port());
let config = env._tmp.path().join("ssh_config");
std::fs::write(
&config,
format!(
"Host box\n\tHostName 127.0.0.1\n\tStrictHostKeyChecking=no\n\tUserKnownHostsFile=/dev/null\n\
\tRemoteForward {remote} 127.0.0.1:{echo}\n\tLocalForward 127.0.0.1:{local} localhost:{echo}\n\
\tRemoteForward /tmp/remote.sock /tmp/local.sock\n",
echo = env.echo_port
),
)
.unwrap();
env.files.config = Some(config);
let target = SshTarget {
host: "box".into(),
port: Some(env.ssh_port),
user: "coder".into(),
auth: SshAuth::OpenSsh,
..Default::default()
};
let session = Arc::new(env.connect(&target, None).await.expect("connects"));
session.start_forwards().await;
// The SSH host's port reaches the echo server here; the local port reaches it from the SSH host.
echoes(remote).await;
echoes(local).await;
drop(session);
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
assert!(TcpStream::connect(("127.0.0.1", local)).await.is_err(), "a closed session stops its LocalForward");
}
+1 -33
Переглянути файл
@@ -191,35 +191,6 @@ impl DocState {
self.disk_conflict = false;
self.clean_text = (!self.large).then(|| self.doc.clone());
}
/// The bytes saving `doc` with this document's encoding, BOM and conversion would write.
fn bytes_for_save(&self, doc: &Document) -> IdeResult<Vec<u8>> {
let text = doc.text_for_save();
Ok(if self.native_to_ascii {
ide_vfs::encode_properties_ascii(&text).into_bytes()
} else {
ide_vfs::encode(&text, &self.encoding, self.has_bom)?
})
}
/// Whether the file changed on disk since the buffer last matched it. A moved stamp with the
/// same bytes (touch, a tool rewriting the file unchanged) is no change and its stamp is adopted. Reads the file
/// only when the mtime moved but the length did not; without a clean text to compare (large
/// files, a pending encoding, line-ending or BOM change, a reported conflict) a moved stamp counts.
fn changed_on_disk(&mut self, meta: &std::fs::Metadata) -> bool {
let mtime = ide_vfs::mtime_ms(meta);
if mtime == self.disk_mtime && meta.len() == self.disk_len {
return false;
}
let same_bytes = meta.len() == self.disk_len
&& self.clean_text.as_ref().is_some_and(|clean| {
self.bytes_for_save(clean).is_ok_and(|bytes| std::fs::read(&self.path).is_ok_and(|disk| disk == bytes))
});
if same_bytes {
self.disk_mtime = mtime;
}
!same_bytes
}
}
fn keys_for(path: &Path) -> Vec<PathBuf> {
@@ -953,7 +924,7 @@ impl Documents {
&& !st.disk_conflict
&& st.uri.is_none()
&& let Ok(meta) = std::fs::metadata(&st.path)
&& st.changed_on_disk(&meta)
&& (ide_vfs::mtime_ms(&meta) != st.disk_mtime || meta.len() != st.disk_len)
{
st.disk_mtime = ide_vfs::mtime_ms(&meta);
st.disk_len = meta.len();
@@ -1440,9 +1411,6 @@ impl Documents {
return Ok(());
}
if st.dirty {
if !st.changed_on_disk(&meta) {
return Ok(());
}
st.disk_mtime = mtime;
st.disk_len = meta.len();
st.disk_conflict = true;
+6 -1
Переглянути файл
@@ -314,7 +314,12 @@ fn hash_disk(hash: &mut blake3::Hasher, path: &Path, unsaved: &HashMap<PathBuf,
/// The bytes saving `state` would write.
fn saved_bytes(state: &DocState) -> IdeResult<Vec<u8>> {
state.bytes_for_save(&state.doc)
let text = state.doc.text_for_save();
Ok(if state.native_to_ascii {
ide_vfs::encode_properties_ascii(&text).into_bytes()
} else {
ide_vfs::encode(&text, &state.encoding, state.has_bom)?
})
}
/// A reverted edit may leave the dirty flag set even when all saved bytes match.
-55
Переглянути файл
@@ -350,61 +350,6 @@ fn autosave_checks_the_disk_before_the_watcher_reports_a_change() {
);
}
/// Writes `bytes` with an mtime clearly after the current one, whatever the filesystem's granularity.
fn rewrite_later(path: &Path, bytes: &[u8]) {
let mtime = fs::metadata(path).unwrap().modified().unwrap() + std::time::Duration::from_secs(2);
fs::write(path, bytes).unwrap();
fs::File::options().write(true).open(path).unwrap().set_modified(mtime).unwrap();
}
#[test]
fn rewriting_the_same_bytes_is_no_disk_conflict() {
let f = fixture();
let path = f.root.join("notes.txt");
fs::write(&path, "alpha\nbeta\n").unwrap();
let info = f.docs.open(&path).unwrap();
f.docs.edit(info.id, 0, change(0, 5, "edited")).unwrap();
// A touch, or a tool rewriting the file unchanged: only the mtime moves.
rewrite_later(&path, b"alpha\nbeta\n");
f.docs.on_disk_changed(std::slice::from_ref(&path));
assert!(f.docs.autosave(info.id).unwrap(), "autosave stopped on a file whose bytes did not change");
assert_eq!(fs::read_to_string(&path).unwrap(), "edited\nbeta\n");
assert!(!f.events.lock().iter().any(|e| matches!(e, IdeEvent::DocDiskConflict { .. })));
}
#[test]
fn autosave_ignores_a_rewrite_of_the_same_bytes_before_the_watcher_reports_it() {
let f = fixture();
let path = f.root.join("notes.txt");
fs::write(&path, "alpha\nbeta\n").unwrap();
let info = f.docs.open(&path).unwrap();
f.docs.edit(info.id, 0, change(0, 5, "edited")).unwrap();
rewrite_later(&path, b"alpha\nbeta\n");
assert!(f.docs.autosave(info.id).unwrap(), "autosave stopped on a file whose bytes did not change");
assert_eq!(fs::read_to_string(&path).unwrap(), "edited\nbeta\n");
}
/// Opens `bytes`, edits the buffer, then rewrites the file as `external` (same text, other bytes).
fn assert_other_bytes_conflict(name: &str, bytes: &[u8], external: &[u8]) {
let f = fixture();
let path = f.root.join(name);
fs::write(&path, bytes).unwrap();
let info = f.docs.open(&path).unwrap();
f.docs.edit(info.id, 0, change(0, 0, "x")).unwrap();
rewrite_later(&path, external);
f.docs.on_disk_changed(std::slice::from_ref(&path));
assert!(!f.docs.autosave(info.id).unwrap(), "{name}: autosave overwrote other bytes of the same text");
assert_eq!(fs::read(&path).unwrap(), external);
}
#[test]
fn the_same_text_in_other_bytes_is_still_a_disk_conflict() {
assert_other_bytes_conflict("crlf.txt", b"alpha\nbeta\n", b"alpha\r\nbeta\r\n");
assert_other_bytes_conflict("bom.txt", b"alpha\n", b"\xEF\xBB\xBFalpha\n");
// Same length: only the byte comparison tells them apart.
assert_other_bytes_conflict("utf16.txt", b"\xFF\xFEa\x00\n\x00", b"\xFE\xFF\x00a\x00\n");
}
#[test]
fn autosave_leaves_a_file_changed_on_disk_after_an_edit() {
let f = fixture();
+5 -6
Переглянути файл
@@ -138,18 +138,17 @@ fn rollback_keeps_a_disk_conflict_of_an_unsaved_buffer() {
let info = docs.open(&first).unwrap();
docs.edit(info.id, info.version, ChangeSet { changes: vec![TextChange { from: 0, to: 3, insert: "own".into() }] })
.unwrap();
// An external write under the unsaved buffer, warned about before the refactoring.
let mtime = std::fs::metadata(&first).unwrap().modified().unwrap() + std::time::Duration::from_secs(2);
std::fs::write(&first, "ext\n").unwrap();
std::fs::File::options().write(true).open(&first).unwrap().set_modified(mtime).unwrap();
docs.on_disk_changed(std::slice::from_ref(&first));
docs.apply_workspace_edit(&WorkspaceEdit { files: vec![edit(&first, "new")], ..Default::default() }).unwrap();
// An external write the undo record still accepts (same bytes, new mtime) under the unsaved buffer.
std::thread::sleep(std::time::Duration::from_millis(10));
std::fs::write(&first, "old\n").unwrap();
docs.on_disk_changed(std::slice::from_ref(&first));
docs.undo_workspace_edit(undo_id(&events)).unwrap();
let snap = docs.snapshot(info.id).unwrap();
assert_eq!(snap.text, "own\n");
assert!(snap.dirty);
assert!(!docs.autosave(info.id).unwrap(), "autosave must not overwrite the external change");
assert_eq!(std::fs::read_to_string(&first).unwrap(), "ext\n");
assert_eq!(std::fs::read_to_string(&first).unwrap(), "old\n");
}
#[test]
+10 -14
Переглянути файл
@@ -114,8 +114,6 @@ All folding commands are also in **Code › Folding**. Fold regions come from th
Indentation and other style options are under **Settings › Editor › Code Style**, with a page per language. `.editorconfig` files in the project are read too.
Java has an **Imports** tab for IntelliSort-style options: **Class count to use import with '\*'** switches to a wildcard import once that many classes of one package are used, and **Names count to use static import with '\*'** does the same for statically imported names (999 keeps single imports). Both are passed through to the Java language server, whose defaults are 5 and 3, as in IDEA.
To format on every save, enable **Reformat code** (and optionally **Optimize imports**) in **Settings › Tools › Actions on Save**. Trailing spaces and the final line break on save are set in **Settings › Editor › General**, section **Save Files**.
## Tabs
@@ -147,19 +145,17 @@ With tabs placed left or right, the tab column is as wide as its longest name, u
## View options
| Action | macOS | Windows / Linux |
| ------------------------------------- | ----- | --------------- |
| **Increase Font Size** | `⌥⇧.` | `Alt+Shift+.` |
| **Decrease Font Size** | `⌥⇧,` | `Alt+Shift+,` |
| **Scroll to Center** | `⌃L` | `Ctrl+M` |
| **Scroll Up** | — | `Ctrl+Up` |
| **Scroll Down** | — | `Ctrl+Down` |
| **Scroll Up and Move if Necessary** | — | — |
| **Scroll Down and Move if Necessary** | — | — |
| **Scroll to Top** | — | — |
| **Scroll to Bottom** | — | — |
| Action | macOS | Windows / Linux |
| ---------------------- | ----- | --------------- |
| **Increase Font Size** | `⌥⇧.` | `Alt+Shift+.` |
| **Decrease Font Size** | `⌥⇧,` | `Alt+Shift+,` |
| **Scroll to Center** | `⌃L` | `Ctrl+M` |
| **Scroll Up** | — | `Ctrl+Up` |
| **Scroll Down** | — | `Ctrl+Down` |
| **Scroll to Top** | — | — |
| **Scroll to Bottom** | — | — |
**Scroll Up** and **Scroll Down** move the view by one line and leave the caret where it is, even when it scrolls out of sight. **Scroll Up and Move if Necessary** and **Scroll Down and Move if Necessary** also move the view by one line, but bring a caret the view doesn't show to its first or last line. **Scroll to Top** and **Scroll to Bottom** show the start and the end of the file; the caret stays where it is too. They have no default shortcut: run them from Find Action or assign one in **Settings › Keymap**.
**Scroll Up** and **Scroll Down** move the view by one line and leave the caret where it is, even when it scrolls out of sight. **Scroll to Top** and **Scroll to Bottom** show the start and the end of the file; the caret stays where it is too. They have no default shortcut: run them from Find Action or assign one in **Settings › Keymap**.
- **View › Active Editor › Soft-Wrap** wraps long lines in the current editor. To wrap some file types by default, use **Settings › Editor › General**, section **Soft Wraps**.
- **View › Reset Font Size** undoes font zoom in the active editor or focused surface (**View › Reset Font Size in All Editors** resets every open editor). Changing the font size with `⌘` / `Ctrl` + mouse wheel (scoped to **Active editor** by default, or **All editors**) can be turned on in **Settings › Editor › General**, section **Mouse Control**.
+1 -1
Переглянути файл
@@ -90,7 +90,7 @@ Settings › Appearance & Behavior › System Settings, unless noted.
| `dateFormat.overrideSystem` | `false` | **Override system date and time format** (Date Formats page). |
| `dateFormat.pattern` | `"dd.MM.yyyy"` | Date pattern with `dd`, `MM`, `MMM`, `yy`, `yyyy`. |
| `dateFormat.use24Hour` | `true` | 24-hour time. |
| `dateFormat.pretty` | `true` | "Today", "Yesterday", "5 min ago" (in lists with time, in the annotate gutter as the day alone). |
| `dateFormat.pretty` | `true` | "Today", "Yesterday", "5 min ago". |
### `[appearance]`
+10 -12
Переглянути файл
@@ -145,19 +145,17 @@ description: "多光标与选区、行编辑、剪贴板历史、代码折叠、
## 显示选项
| 操作 | macOS | Windows / Linux |
| ------------------------------ | ----- | --------------- |
| **增大字体** | `⌥⇧.` | `Alt+Shift+.` |
| **减小字体** | `⌥⇧,` | `Alt+Shift+,` |
| **滚动到中央** | `⌃L` | `Ctrl+M` |
| **向上滚动** | — | `Ctrl+Up` |
| **向下滚动** | — | `Ctrl+Down` |
| **向上滚动并在必要时移动光标** | — | — |
| **向下滚动并在必要时移动光标** | — | — |
| **滚动到顶部** | — | — |
| **滚动到底部** | — | — |
| 操作 | macOS | Windows / Linux |
| -------------- | ----- | --------------- |
| **增大字体** | `⌥⇧.` | `Alt+Shift+.` |
| **减小字体** | `⌥⇧,` | `Alt+Shift+,` |
| **滚动到中央** | `⌃L` | `Ctrl+M` |
| **向上滚动** | — | `Ctrl+Up` |
| **向下滚动** | — | `Ctrl+Down` |
| **滚动到顶部** | — | — |
| **滚动到底部** | — | — |
**向上滚动** 和 **向下滚动** 把视图移动一行,光标保持原位,即使它因此移出可见区域。**向上滚动并在必要时移动光标** 和 **向下滚动并在必要时移动光标** 同样把视图移动一行,但会把不在视图中的光标移到视图的第一行或最后一行。**滚动到顶部** 和 **滚动到底部** 显示文件的开头和结尾;光标同样保持原位。它们默认没有快捷键:在查找操作中运行,或在 **设置 › 按键映射** 中指定。
**向上滚动** 和 **向下滚动** 把视图移动一行,光标保持原位,即使它因此移出可见区域。**滚动到顶部** 和 **滚动到底部** 显示文件的开头和结尾;光标同样保持原位。它们默认没有快捷键:在查找操作中运行,或在 **设置 › 按键映射** 中指定。
- **视图 › 活动编辑器 › 软换行** 让当前编辑器的长行自动折行。想让某些文件类型默认软换行,在 **设置 › 编辑器 › 常规** 的 **软换行** 一节中设置。
- **视图 › 重置字体大小** 撤销当前编辑器或焦点区域的字体缩放(**视图 › 重置所有编辑器中的字体大小** 会重置所有打开的编辑器)。用 `⌘` / `Ctrl` + 鼠标滚轮调整字号的功能默认关闭,可在 **设置 › 编辑器 › 常规** 的 **鼠标控制** 一节中打开,并可选择作用于 **当前编辑器**(默认)或 **所有编辑器**。
+1 -1
Переглянути файл
@@ -90,7 +90,7 @@ exclude = ["**/.git", "**/node_modules", "**/target", "**/dist"]
| `dateFormat.overrideSystem` | `false` | **覆盖系统日期和时间格式**(日期格式页)。 |
| `dateFormat.pattern` | `"dd.MM.yyyy"` | 日期格式,可用 `dd`、`MM`、`MMM`、`yy`、`yyyy`。 |
| `dateFormat.use24Hour` | `true` | 使用 24 小时制。 |
| `dateFormat.pretty` | `true` | 显示“今天”“昨天”“5 分钟前”这类相对时间(列表中带时间,注解装订区域仅显示日期)。 |
| `dateFormat.pretty` | `true` | 显示“今天”“昨天”“5 分钟前”这类相对时间。 |
### `[appearance]`
-24
Переглянути файл
@@ -9162,18 +9162,6 @@ export type LanguageCodeStyle_Deserialize = {
keywordCase?: string | null,
/** SQL › Case › Identifiers (unquoted names): `upper` | `lower` | `keep`. */
identifierCase?: string | null,
/**
* Java: organize imports switches to a wildcard import once this many
* classes of one package are used (jdtls `starThreshold`; IDEA's default
* 5; unset keeps the language server's default).
*/
classCountToUseImportWithStar?: number | null,
/**
* Java: organize imports switches to a wildcard static import once this
* many statically imported names are used (jdtls `staticStarThreshold`;
* IDEA's default 3; unset keeps the language server's default).
*/
namesCountToUseStaticImportWithStar?: number | null,
/** JavaScript / TypeScript › Punctuation › Semicolons: `ignore` | `insert` | `remove`. */
semicolons?: string | null,
/** JavaScript / TypeScript › Punctuation › Quotes: `auto` | `single` | `double`. */
@@ -9204,18 +9192,6 @@ export type LanguageCodeStyle_Serialize = {
keywordCase?: string | null,
/** SQL › Case › Identifiers (unquoted names): `upper` | `lower` | `keep`. */
identifierCase?: string | null,
/**
* Java: organize imports switches to a wildcard import once this many
* classes of one package are used (jdtls `starThreshold`; IDEA's default
* 5; unset keeps the language server's default).
*/
classCountToUseImportWithStar?: number | null,
/**
* Java: organize imports switches to a wildcard static import once this
* many statically imported names are used (jdtls `staticStarThreshold`;
* IDEA's default 3; unset keeps the language server's default).
*/
namesCountToUseStaticImportWithStar?: number | null,
/** JavaScript / TypeScript › Punctuation › Semicolons: `ignore` | `insert` | `remove`. */
semicolons?: string | null,
/** JavaScript / TypeScript › Punctuation › Quotes: `auto` | `single` | `double`. */
-8
Переглянути файл
@@ -81,12 +81,10 @@ import {
cursorParagraphBackward,
cursorParagraphForward,
scrollDown,
scrollDownAndMove,
scrollToBottom,
scrollToCenter,
scrollToTop,
scrollUp,
scrollUpAndMove,
selectCodeBlockEnd,
selectCodeBlockStart,
selectPageBottom,
@@ -1061,12 +1059,6 @@ export function registerEditorActions(): () => void {
caret("editor.scrollToCenter", "Scroll to Center", (v) => scrollToCenter(v), { category: "Editor Actions" }),
caret("editor.scrollUp", "Scroll Up", (v) => scrollUp(v), { category: "Editor Actions" }),
caret("editor.scrollDown", "Scroll Down", (v) => scrollDown(v), { category: "Editor Actions" }),
caret("editor.scrollUpAndMove", "Scroll Up and Move if Necessary", (v) => scrollUpAndMove(v), {
category: "Editor Actions",
}),
caret("editor.scrollDownAndMove", "Scroll Down and Move if Necessary", (v) => scrollDownAndMove(v), {
category: "Editor Actions",
}),
caret("editor.scrollToTop", "Scroll to Top", (v) => scrollToTop(v), { category: "Editor Actions" }),
caret("editor.scrollToBottom", "Scroll to Bottom", (v) => scrollToBottom(v), { category: "Editor Actions" }),
caret("editor.moveToPageTop", "Move Caret to Page Top", (v) => cursorPageTop(v), { category: "Editor Actions" }),
+1 -101
Переглянути файл
@@ -1,7 +1,7 @@
import { afterEach, beforeAll, describe, expect, it } from "vitest";
import { EditorSelection, EditorState, StateEffect } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { codeFolding, foldEffect, indentService, type LanguageSupport } from "@codemirror/language";
import { indentService, type LanguageSupport } from "@codemirror/language";
import { languages } from "@codemirror/language-data";
import { addCursorAbove, insertBlankLine, selectLine, toggleTabFocusMode } from "@codemirror/commands";
import {
@@ -14,11 +14,9 @@ import {
nextParagraphBoundary,
previousParagraphBoundary,
scrollDown,
scrollDownAndMove,
scrollToBottom,
scrollToTop,
scrollUp,
scrollUpAndMove,
selectPageBottom,
selectPageTop,
selectParagraphForward,
@@ -253,104 +251,6 @@ describe("Move Caret to Page Top / Bottom", () => {
});
});
describe("Scroll Up / Down and Move if Necessary", () => {
/** jsdom has no layout: a scroller `height` line heights tall, scrolled to `top` line heights. */
function scroller(view: EditorView, top: number, height: number) {
const line = view.lineBlockAt(0).height;
let px = top * line;
Object.defineProperty(view.scrollDOM, "scrollTop", {
configurable: true,
get: () => px,
set: (v: number) => (px = Math.max(0, v)),
});
Object.defineProperty(view, "documentTop", { configurable: true, get: () => -px });
Object.defineProperty(view.scrollDOM, "clientHeight", { configurable: true, get: () => height * line });
return () => px / line;
}
const lines = (marked: Record<number, string>) =>
Array.from({ length: 10 }, (_, i) => marked[i] ?? `line ${i} text`).join("\n");
const lineOf = (view: EditorView) => view.state.selection.ranges.map((r) => view.state.doc.lineAt(r.head).number - 1);
const columnOf = (view: EditorView) =>
view.state.selection.ranges.map((r) => r.head - view.state.doc.lineAt(r.head).from);
it("scrolls one line and keeps a caret that stays in view where it is", () => {
const view = make(lines({ 4: "line 4 te|xt" }));
const top = scroller(view, 2, 4);
const before = view.state.selection;
expect(scrollDownAndMove(view)).toBe(true);
expect(top()).toBe(3);
expect(view.state.selection.eq(before)).toBe(true);
expect(scrollUpAndMove(view)).toBe(true);
expect(top()).toBe(2);
expect(view.state.selection.eq(before)).toBe(true);
});
it("brings a caret that scrolls off the top down to the first line, keeping its column", () => {
const view = make(lines({ 2: "line 2 te|xt" }));
scroller(view, 2, 4);
scrollDownAndMove(view);
expect([lineOf(view), columnOf(view)]).toEqual([[3], [9]]);
});
it("brings a caret that scrolls off the bottom up to the last line, keeping its column", () => {
const view = make(lines({ 5: "li|ne 5 text" }));
scroller(view, 2, 4);
scrollUpAndMove(view);
expect([lineOf(view), columnOf(view)]).toEqual([[4], [2]]);
});
it("moves a caret already out of view to the nearest edge", () => {
const view = make(lines({ 9: "line 9 |text" }));
scroller(view, 0, 4);
scrollDownAndMove(view);
expect([lineOf(view), columnOf(view)]).toEqual([[4], [7]]);
});
it("drops the selection of a caret it moves and keeps the others", () => {
const view = make(lines({ 0: "|line 0 text" }));
const at = (line: number, col: number) => view.state.doc.line(line + 1).from + col;
view.dispatch({
selection: EditorSelection.create(
[EditorSelection.range(at(2, 0), at(2, 4)), EditorSelection.range(at(4, 0), at(4, 4))],
1,
),
});
scroller(view, 2, 4);
scrollDownAndMove(view);
expect(view.state.selection.ranges.map((r) => [r.anchor, r.head])).toEqual([
[at(3, 4), at(3, 4)],
[at(4, 0), at(4, 4)],
]);
expect(view.state.selection.mainIndex).toBe(1);
});
it("keeps a caret at the end of a folded block the view shows", () => {
const view = make(lines({ 7: "line 7 text|" }));
const { doc } = view.state;
view.dispatch({
effects: [
StateEffect.appendConfig.of(codeFolding()),
foldEffect.of({ from: doc.line(6).to, to: doc.line(8).to }),
],
});
expect(view.lineBlockAt(doc.line(8).to).from).toBe(doc.line(6).from);
const before = view.state.selection;
scroller(view, 1, 4);
scrollDownAndMove(view);
expect(view.state.selection.eq(before)).toBe(true);
});
it("only scrolls at the top of the file when the caret stays in view", () => {
const view = make(lines({ 1: "|line 1 text" }));
const top = scroller(view, 0, 4);
const before = view.state.selection;
scrollUpAndMove(view);
expect(top()).toBe(0);
expect(view.state.selection.eq(before)).toBe(true);
expect(view.state.doc.toString()).toBe(lines({}));
});
});
describe("code block navigation", () => {
let js: LanguageSupport;
beforeAll(async () => {
+5 -40
Переглянути файл
@@ -1,4 +1,4 @@
/** IDEA caret commands that CodeMirror has no equivalent for: Split Line, Scroll to Center / Up / Down / Top / Bottom, Scroll Up / Down and Move if Necessary, Page Top / Bottom, code block, brace and paragraph navigation. */
/** IDEA caret commands that CodeMirror has no equivalent for: Split Line, Scroll to Center / Up / Down / Top / Bottom, Page Top / Bottom, code block, brace and paragraph navigation. */
import { countColumn, EditorSelection, findColumn, type EditorState, type Transaction } from "@codemirror/state";
import { EditorView, type Command } from "@codemirror/view";
import { insertNewlineAndIndent } from "@codemirror/commands";
@@ -66,21 +66,15 @@ function pageEdgeLine(view: EditorView, edge: "top" | "bottom"): number {
return block.top >= bottom || (block.bottom > bottom && previous.top >= top) ? previous.from : block.from;
}
/** `head` moved to the line starting at `lineStart`, keeping its visual column. */
function sameColumnOn(state: EditorState, head: number, lineStart: number): number {
const line = state.doc.lineAt(head);
const target = state.doc.lineAt(lineStart);
const column = countColumn(line.text, state.tabSize, head - line.from);
return target.from + findColumn(target.text, column, state.tabSize);
}
/** Move Caret to Page Top / Bottom (with Selection): every caret to that line, keeping its column. */
function moveToPageEdge(edge: "top" | "bottom", extend = false): Command {
return (view) => {
const { state } = view;
const target = pageEdgeLine(view, edge);
const target = state.doc.lineAt(pageEdgeLine(view, edge));
const ranges = state.selection.ranges.map((r) => {
const head = sameColumnOn(state, r.head, target);
const line = state.doc.lineAt(r.head);
const column = countColumn(line.text, state.tabSize, r.head - line.from);
const head = target.from + findColumn(target.text, column, state.tabSize);
return extend ? EditorSelection.range(r.anchor, head) : EditorSelection.cursor(head);
});
view.dispatch({
@@ -96,35 +90,6 @@ export const cursorPageBottom = moveToPageEdge("bottom");
export const selectPageTop = moveToPageEdge("top", true);
export const selectPageBottom = moveToPageEdge("bottom", true);
/**
* Scroll Up / Down and Move if Necessary: move the viewport by one line, then bring
* a caret outside the lines the view shows whole to the first or last of them,
* keeping its column. Carets in view keep their place and selection.
*/
const scrollByLineAndMove =
(lines: number): Command =>
(view) => {
scrollByLine(lines)(view);
const { state } = view;
const first = pageEdgeLine(view, "top");
const last = view.lineBlockAt(pageEdgeLine(view, "bottom"));
let moved = false;
const ranges = state.selection.ranges.map((r) => {
if (r.head >= first && r.head <= last.to) return r;
moved = true;
return EditorSelection.cursor(sameColumnOn(state, r.head, r.head < first ? first : last.from));
});
if (moved) {
view.dispatch({
selection: EditorSelection.create(ranges, state.selection.mainIndex),
userEvent: "select.navigate",
});
}
return true;
};
export const scrollUpAndMove = scrollByLineAndMove(-1);
export const scrollDownAndMove = scrollByLineAndMove(1);
const NOT_CODE = /String|Comment|Regexp|Char|Template/;
/** `{` / `}` at `pos` when it is code (not inside a string or comment, as far as the syntax tree knows). */
-56
Переглянути файл
@@ -24,22 +24,6 @@ import { installKeyboardDispatcher } from "@/platform/keymap";
import { TEXT_WHEN } from "./actions";
import { EDITOR_WHEN } from "@/editor/lsp/actions";
import { setShownLine } from "@/editor/api";
import { registerProjectActions } from "@/features/project-tree/actions";
/** `isTauri` is a spy (File Color writes need it true); the settings commands stand in for the backend. */
const ipc = vi.hoisted(() => ({
isTauri: vi.fn(() => false),
settingsSet: vi.fn(async () => ({ status: "ok" as const, data: {} })),
settingsGet: vi.fn(async () => ({})),
}));
vi.mock("@/platform/ipc", async (orig) => {
const real = await orig<typeof import("@/platform/ipc")>();
return {
...real,
isTauri: ipc.isTauri,
commands: { ...real.commands, settingsSet: ipc.settingsSet, settingsGet: ipc.settingsGet },
};
});
let ctrl: EditorController | null = null;
@@ -438,46 +422,6 @@ describe("EditorController", () => {
expect(pane().tabs.map((t) => t.input.path)).toEqual(["/p/a.ts", "/p/c.ts"]);
});
it("offers the project view's File Color submenu through actions", async () => {
useProject.setState({
project: { name: "p", root: "/p", trusted: true, isGit: false, settings: {} } as never,
settings: {} as never,
});
ipc.isTauri.mockReturnValue(true);
const disposeActions = registerProjectActions();
try {
ctrl = new EditorController(createMemoryBackend({ "/p/a.ts": "", "/p/b.ts": "", "/elsewhere/c.ts": "" }));
ctrl.start();
await ctrl.openFile("/p/a.ts", { focus: false });
const pane = () => useTabs.getState().panes[useTabs.getState().activePane]!;
const raw = ctrl!.tabMenu(pane().id, pane().tabs[0]!);
const entry = raw.find((i) => "label" in i && i.label === "File Color");
expect(entry).toBeDefined();
const items = resolveMenuItems((entry as { submenu: typeof raw }).submenu);
expect(items.filter((i) => i.kind === "item").map((i) => i.label)).toEqual([
"Blue",
"Green",
"Orange",
"Rose",
"Violet",
"Yellow",
"Gray",
"Edit File Colors…",
]);
items.find((i) => i.label === "Blue")!.run!();
await vi.waitFor(() => expect(ipc.settingsSet).toHaveBeenCalledTimes(2));
expect(ipc.settingsSet).toHaveBeenNthCalledWith(1, "project", "scopes", expect.stringContaining('"file:a.ts"'));
expect(ipc.settingsSet).toHaveBeenNthCalledWith(2, "project", "fileColors", expect.stringContaining("blue"));
// A file outside the project has no File Color, as in the project view.
await ctrl.openFile("/elsewhere/c.ts", { focus: false });
const outside = pane().tabs.find((t) => t.input.path === "/elsewhere/c.ts")!;
expect(ctrl.tabMenu(pane().id, outside).some((i) => "label" in i && i.label === "File Color")).toBe(false);
ipc.isTauri.mockReturnValue(false);
useProject.setState({ project: null, settings: null });
} finally {
disposeActions();
}
});
it("keeps editor tabs and unsaved documents through attach and detach", async () => {
const settings = {};
useProject.setState({
+1 -25
Переглянути файл
@@ -12,7 +12,7 @@ import { create } from "zustand";
import { setContext } from "@/platform/context";
import { formatBinding, hostBinding, shortcutLabel } from "@/platform/keymap";
import { isSameOrInside } from "@/platform/paths";
import { basename, dirname, relativePath, useProject } from "@/platform/project";
import { basename, dirname, useProject } from "@/platform/project";
import { editorPrefs } from "@/platform/editorSettings";
import {
_emitEditorEvent,
@@ -60,7 +60,6 @@ import { isUntitledUri, untitledTitle } from "@/platform/virtualDocs";
import { isRemoteWindow, projectLocation } from "@/platform/remote";
import { auxiliaryWindow } from "@/platform/auxWindow";
import { fileIconName, showContextMenu, type MenuItem } from "@/ui";
import { FILE_COLOR_NAMES, ownFileColor } from "@/platform/fileColors";
import { canOpenWithSystemApp, canRevealInFileManager, fileManagerName } from "@/platform/fileManager";
import {
activateTab,
@@ -2551,9 +2550,6 @@ export class EditorController implements SlotHost {
{ kind: "separator" },
...(path
? ([
...(inProject && path !== project!.root
? ([{ label: "File Color", submenu: fileColorMenuItems(path) }, { kind: "separator" }] as MenuItem[])
: []),
{
label: "Copy Path/Reference…",
submenu: [
@@ -2642,26 +2638,6 @@ export class EditorController implements SlotHost {
}
}
/**
* File Color submenu of a file tab: the project view's File Color rows as action items carrying
* the path (features/project-tree owns the model and the titles), so both menus agree.
*/
function fileColorMenuItems(path: string): MenuItem[] {
const { project, settings } = useProject.getState();
const current = project ? ownFileColor(relativePath(project.root, path), false, settings)?.toLowerCase() : null;
return [
...FILE_COLOR_NAMES.map((name): MenuItem => ({
kind: "action",
action: `file.${name}`,
arg: path,
checked: current === name,
})),
{ kind: "separator" },
...(current ? [{ kind: "action" as const, action: "file.clearColor", arg: path }] : []),
{ kind: "action", action: "file.editColors" },
];
}
/** Open In › for a file: Project View, Finder / Explorer / Files, associated app, Terminal. */
function openInMenu(path: string, lines?: { line: number; endLine?: number }): MenuItem {
return {
-9
Переглянути файл
@@ -188,15 +188,6 @@ it("hands the window's whole list to the backend before startup, even after a fa
);
});
it("leaves the backend alone while no project is open", async () => {
loadBreakpoints(null);
await vi.advanceTimersByTimeAsync(200);
expect(ipc.debugReplaceBreakpoints).not.toHaveBeenCalled();
loadBreakpoints("/p");
await vi.advanceTimersByTimeAsync(0);
expect(ipc.debugReplaceBreakpoints).toHaveBeenCalledOnce();
});
it("flushes persisted breakpoints immediately after project loading", async () => {
ipc.debugSetBreakpoints.mockResolvedValue({ status: "ok", data: [] });
localStorage.setItem(
+2 -4
Переглянути файл
@@ -138,10 +138,8 @@ async function drainBreakpoints() {
/** Makes this window's whole list the backend's: files it no longer lists are cleared there. */
async function replaceBreakpoints() {
// Without a project (before one opens, after it closes) the backend holds no breakpoints for
// this window and has none to clear.
const { root, byFile, muted } = useBreakpoints.getState();
if (!isTauri() || root === null || useProject.getState().project?.trusted === false) return;
if (!isTauri() || useProject.getState().project?.trusted === false) return;
const { byFile, muted } = useBreakpoints.getState();
const files = Object.fromEntries(Object.entries(byFile).map(([path, list]) => [path, toBackend(list, muted, path)]));
await call(commands.debugReplaceBreakpoints(files));
}
+1 -26
Переглянути файл
@@ -1,15 +1,13 @@
/** Actions of the project view (Find Action, keymap, other features via `executeAction`). */
import { activeEditor } from "@/editor/api";
import { executeAction, getAction, registerActions, type Action } from "@/platform/actions";
import { getAction, registerActions, type Action } from "@/platform/actions";
import { getContext } from "@/platform/context";
import { FILE_COLOR_NAMES } from "@/platform/fileColors";
import { canRevealInFileManager, revealInFileManagerLabel } from "@/platform/fileManager";
import { dirname, useProject } from "@/platform/project";
import { showContextMenu, type MenuItem } from "@/ui";
import { maybeEditorService, menuGroupItems, toolWindowService } from "@/workbench/contributions";
import { OPTION_LABELS, SORT_LABELS, flipToggle, isToggled } from "./HeaderActions";
import { compareTarget, newMenuItems, revealLabel } from "./contextMenu";
import { LABELS, setFileColor } from "./fileColor";
import { openNewPopup } from "./newPopupModel";
import type { ProjectNode } from "./model";
import {
@@ -589,28 +587,5 @@ export function registerProjectActions(): () => void {
...toggles,
...modes,
...sorts,
// File Color of a single path (the project view's submenu; the editor tab menu references
// these ids with a path argument instead of importing this feature).
...FILE_COLOR_NAMES.map((name): Action => ({
id: `file.${name}`,
title: LABELS[name],
category: "Project View",
hidden: true,
run: ({ arg }) => void setFileColor(String(arg), false, name),
})),
{
id: "file.clearColor",
title: "Clear File Color",
category: "Project View",
hidden: true,
run: ({ arg }) => void setFileColor(String(arg), false, null),
},
{
id: "file.editColors",
title: "Edit File Colors…",
category: "Project View",
hidden: true,
run: () => void executeAction("file.settings", "fileColors"),
},
]);
}
+1 -2
Переглянути файл
@@ -8,8 +8,7 @@ import { call, commands, isTauri } from "@/platform/ipc";
import { loadSettings, relativePath, useProject } from "@/platform/project";
import type { MenuItem } from "@/ui";
/** English title per colour, also the title of its `file.<colour>` action (the editor tab menu). */
export const LABELS: Record<(typeof FILE_COLOR_NAMES)[number], string> = {
const LABELS: Record<(typeof FILE_COLOR_NAMES)[number], string> = {
blue: "Blue",
green: "Green",
orange: "Orange",
-66
Переглянути файл
@@ -1,66 +0,0 @@
import { useMemo, type ComponentType } from "react";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { useProject } from "@/platform/project";
import { PageContext } from "../components/context";
import { DEFAULT_SETTINGS } from "../model/schema";
import { openSettings, stagedValue, useSettingsDialog } from "../model/staging";
import { codeStyleLanguagePages } from "../pages/editor/codeStyle";
const mocks = vi.hoisted(() => ({ languages: vi.fn() }));
vi.mock("@/platform/ipc", async (original) => {
const actual = await original<typeof import("@/platform/ipc")>();
return {
...actual,
isTauri: () => true,
commands: {
...actual.commands,
languages: mocks.languages,
},
};
});
beforeEach(() => {
mocks.languages.mockResolvedValue([
{ id: "java", name: "Java", indent: { tabSize: 4, insertSpaces: true } },
{ id: "rust", name: "Rust" },
]);
useProject.setState({ settings: structuredClone(DEFAULT_SETTINGS), project: null });
openSettings("editor.codeStyle.java");
});
afterEach(cleanup);
function CodeStylePage({ id, Page }: { id: string; Page: ComponentType }) {
const value = useMemo(() => ({ pageId: id, scope: "global" as const }), [id]);
return (
<PageContext.Provider value={value}>
<Page />
</PageContext.Provider>
);
}
async function page(language: string) {
const pages = await codeStyleLanguagePages();
const spec = pages.find((p) => p.id === `editor.codeStyle.${language}`)!;
render(<CodeStylePage id={spec.id} Page={spec.component!} />);
}
const value = () => stagedValue(useSettingsDialog.getState(), "global", "editor.codeStyle.languages");
describe("Java Imports (IntelliSort)", () => {
it("stages the class-count and static-count options on the Java code style", async () => {
await page("java");
fireEvent.click(screen.getByRole("tab", { name: "Imports" }));
fireEvent.change(screen.getByLabelText("Class count to use import with *"), { target: { value: "7" } });
fireEvent.change(screen.getByLabelText("Names count to use static import with *"), { target: { value: "2" } });
expect(value()).toEqual({
java: { classCountToUseImportWithStar: 7, namesCountToUseStaticImportWithStar: 2 },
});
fireEvent.click(screen.getByRole("button", { name: "Reset to Language Defaults" }));
expect(value()).toEqual({});
});
it("keeps the Imports tab specific to Java", async () => {
await page("rust");
expect(screen.queryByRole("tab", { name: "Imports" })).toBeNull();
});
});
+1 -48
Переглянути файл
@@ -157,11 +157,6 @@ const COMMENTS = {
keywords: ["Line comment at first column", "Add a space at line comment start"],
};
const CASE = { id: "case", label: "Case", keywords: ["Keywords", "Identifiers", "To upper", "To lower"] };
const IMPORTS = {
id: "imports",
label: "Imports",
keywords: ["imports", "static imports", "wildcard", "class count", "import with *"],
};
const SPACES = { id: "spaces", label: "Spaces", keywords: ["Space", "Around binary operators", "Within braces"] };
const PUNCTUATION = { id: "punctuation", label: "Punctuation", keywords: ["Semicolons", "Quotes"] };
@@ -303,41 +298,6 @@ function LanguageStyle({ lang }: { lang: LanguageInfo }) {
),
});
}
if (lang.id === "java") {
tabs.push({
...IMPORTS,
content: (
<FormGroup>
<Row
label="Class count to use import with '*'"
hint="Use a wildcard import once this many classes of one package are used (5 by default; 999 keeps single-class imports)."
>
<NumberInput
value={own.classCountToUseImportWithStar ?? 5}
onChange={(n) => set({ classCountToUseImportWithStar: n })}
min={1}
max={999}
integer
aria-label="Class count to use import with *"
/>
</Row>
<Row
label="Names count to use static import with '*'"
hint="Use a wildcard static import once this many names are imported statically (3 by default; 999 keeps single imports)."
>
<NumberInput
value={own.namesCountToUseStaticImportWithStar ?? 3}
onChange={(n) => set({ namesCountToUseStaticImportWithStar: n })}
min={1}
max={999}
integer
aria-label="Names count to use static import with *"
/>
</Row>
</FormGroup>
),
});
}
if (TS_STYLE_LANGUAGES.has(lang.id)) {
tabs.push(
{
@@ -541,14 +501,7 @@ export async function codeStyleLanguagePages(): Promise<PageSpec[]> {
...keywords,
]),
...(lang.id === "java"
? [
"Formatting profile",
"IntelliJ IDEA",
"Custom Eclipse formatter XML",
"Eclipse formatter XML",
IMPORTS.label,
...IMPORTS.keywords,
]
? ["Formatting profile", "IntelliJ IDEA", "Custom Eclipse formatter XML", "Eclipse formatter XML"]
: []),
...(lang.id === "php" ? ["Alignment", "Align key-value pairs", "Align consecutive assignments"] : []),
...(lang.id === "sql" ? [CASE.label, ...CASE.keywords, "Do not change"] : []),
-21
Переглянути файл
@@ -276,27 +276,6 @@ describe("annotate Options", () => {
const hidden = (v: EditorView) =>
["date", "author", "revision"].filter((c) => v.dom.classList.contains(`cm-vcs-blame-hide-${c}`));
it("prints Today/Yesterday in the date cell when pretty formatting is on", async () => {
const today = Date.now();
const yesterday = today - 86_400_000;
const recentLines: BlameLine[] = [
{ commit: sha, author: "Aleks Zlateski", timeMs: today, summary: "today" },
{ commit: otherSha, author: "Dan Crankshaw", timeMs: yesterday, summary: "yesterday" },
];
mocks.blame.mockResolvedValue({ status: "ok", data: recentLines });
useProject.setState({ settings: { general: { dateFormat: { pretty: true } } } });
const created = new EditorView({
parent: document.body,
state: EditorState.create({ doc: "first\nsecond\nthird", extensions: [blameSlot()] }),
});
view = created;
await toggleAnnotations(created, "/repo/src/main.py");
const cell = (commit: string) =>
created.dom.querySelector<HTMLElement>(`.cm-vcs-blame [data-commit="${commit}"] .cm-vcs-blame-date`)?.textContent;
expect(cell(sha)).toBe("Today");
expect(cell(otherSha)).toBe("Yesterday");
});
it("shows date and author by default and adds the revision from Options", async () => {
view = await annotated();
expect(
+2 -2
Переглянути файл
@@ -11,7 +11,7 @@ import { onWorkflowSettingsChange, workflowSettings } from "@/platform/workflowS
import { showContextMenu, type MenuItem } from "@/ui";
import { notifications } from "@/workbench/contributions";
import { closeBlamePopup, scheduleCloseBlamePopup, scheduleOpenBlamePopup } from "./BlamePopup";
import { formatPrettyDay } from "@/platform/dateFormat";
import { formatDate } from "./model";
import { saveVcsSetting } from "./settingsUi";
import { useVcs } from "./store";
@@ -318,7 +318,7 @@ function build(lines: BlameLine[], doc: Text): BlameState {
let label = labels.get(line.commit);
if (!label && !isUncommitted(line)) {
label = {
date: line.timeMs ? formatPrettyDay(line.timeMs) : "",
date: formatDate(line.timeMs),
author: shortAuthorName(line.author, names),
revision: line.commit.slice(0, 8),
};
-14
Переглянути файл
@@ -5,7 +5,6 @@ import {
formatDateTime,
formatDay,
formatPattern,
formatPrettyDay,
formatTimestamp,
} from "./dateFormat";
@@ -34,19 +33,6 @@ describe("dateFormat", () => {
expect(formatTimestamp(d.getTime(), now, custom)).toBe("05.11.2026 09:07");
});
it("shows Today/Yesterday without a clock time for blame, older dates keep the short date", () => {
const now = new Date(2026, 10, 13, 12, 0).getTime();
const pretty = { ...system, pretty: true };
const older = new Date(2026, 10, 5, 9, 7);
const short = { year: "2-digit", month: "2-digit", day: "2-digit" } as const;
expect(formatPrettyDay(new Date(2026, 10, 13, 9, 7).getTime(), now, pretty)).toBe("Today");
expect(formatPrettyDay(new Date(2026, 10, 12, 23, 30).getTime(), now, pretty)).toBe("Yesterday");
expect(formatPrettyDay(older.getTime(), now, pretty)).toBe(older.toLocaleDateString(undefined, short));
expect(formatPrettyDay(new Date(2026, 10, 13, 9, 7).getTime(), now, { ...system, pretty: false })).toBe(
new Date(2026, 10, 13, 9, 7).toLocaleDateString(undefined, short),
);
});
it("formats another date with the same cached formatter", () => {
const e = new Date(2025, 0, 31);
formatDay(d, system);
-13
Переглянути файл
@@ -99,16 +99,3 @@ export function formatTimestamp(ms: number, now = Date.now(), o: DateFormatOptio
}
return formatDateTime(d, o);
}
/**
* Day without clock time (blame gutter): "Today" / "Yesterday" when pretty
* formatting is on, as IDEA's annotate shows; older dates keep the short date.
*/
export function formatPrettyDay(ms: number, now = Date.now(), o: DateFormatOptions = dateFormatOptions()): string {
const d = new Date(ms);
if (o.pretty) {
if (d.toDateString() === new Date(now).toDateString()) return tx("Today");
if (d.toDateString() === new Date(now - 86_400_000).toDateString()) return tx("Yesterday");
}
return formatDay(d, o, true);
}
-4
Переглянути файл
@@ -47,10 +47,6 @@ export interface LanguageCodeStyle {
/** SQL › Case: Reformat Code's case for keywords and unquoted identifiers. */
keywordCase?: SqlWordCase;
identifierCase?: SqlWordCase;
/** Java: organize imports switches to a wildcard import once this many classes of one package are used (jdtls passthrough). */
classCountToUseImportWithStar?: number;
/** Java: organize imports switches to a wildcard static import once this many names are used (jdtls passthrough). */
namesCountToUseStaticImportWithStar?: number;
/** JavaScript / TypeScript › Punctuation (unset: tsserver's default, `ignore` / `auto`). */
semicolons?: "ignore" | "insert" | "remove";
quotes?: "auto" | "single" | "double";
-2
Переглянути файл
@@ -120,8 +120,6 @@ export const IDEA_ACTIONS: Readonly<Record<string, string>> = {
ToggleZenMode: "view.toggleZenMode",
EditorScrollUp: "editor.scrollUp",
EditorScrollDown: "editor.scrollDown",
EditorScrollUpAndMove: "editor.scrollUpAndMove",
EditorScrollDownAndMove: "editor.scrollDownAndMove",
EditorScrollTop: "editor.scrollToTop",
EditorScrollBottom: "editor.scrollToBottom",
EditorMoveToPageTop: "editor.moveToPageTop",
-9
Переглянути файл
@@ -92,15 +92,6 @@ describe("IntelliJ IDEA keymap import", () => {
expect(k.unknownActions).toEqual([]);
});
it("maps Scroll Up / Scroll Down and Move if Necessary", () => {
const k = parseIdeaKeymap(
`<keymap name="E" parent="$default"><action id="EditorScrollUpAndMove"><keyboard-shortcut first-keystroke="alt UP"/></action><action id="EditorScrollDownAndMove"><keyboard-shortcut first-keystroke="alt DOWN"/></action></keymap>`,
);
expect(k.overrides["editor.scrollUpAndMove"]).toEqual([normalizeBinding("Alt+Up")]);
expect(k.overrides["editor.scrollDownAndMove"]).toEqual([normalizeBinding("Alt+Down")]);
expect(k.unknownActions).toEqual([]);
});
it("maps Scroll to Top / Scroll to Bottom", () => {
const k = parseIdeaKeymap(
`<keymap name="X" parent="Mac OS X 10.5+"><action id="EditorScrollTop"><keyboard-shortcut first-keystroke="HOME"/></action><action id="EditorScrollBottom"><keyboard-shortcut first-keystroke="END"/></action></keymap>`,
-2
Переглянути файл
@@ -64,8 +64,6 @@ describe("IDEA keymap parity", () => {
// `Mac OS X 10.5+` removes the ⌘↑ / ⌘↓ it would inherit from `Mac OS X`.
["editor.scrollUp", [], ["Ctrl+Up"]],
["editor.scrollDown", [], ["Ctrl+Down"]],
["editor.scrollUpAndMove", [], []],
["editor.scrollDownAndMove", [], []],
// Only IDEA's Xcode keymap binds these (Home / End).
["editor.scrollToTop", [], []],
["editor.scrollToBottom", [], []],
-2
Переглянути файл
@@ -138,8 +138,6 @@ export const intellijMacos: Record<string, string[]> = {
"editor.scrollToCenter": ["Ctrl+L"],
"editor.scrollUp": [],
"editor.scrollDown": [],
"editor.scrollUpAndMove": [],
"editor.scrollDownAndMove": [],
"editor.scrollToTop": [],
"editor.scrollToBottom": [],
"editor.moveToPageTop": ["Meta+PageUp"],
-2
Переглянути файл
@@ -139,8 +139,6 @@ export const intellijWindows: Record<string, string[]> = {
"editor.scrollToCenter": ["Ctrl+M"],
"editor.scrollUp": ["Ctrl+Up"],
"editor.scrollDown": ["Ctrl+Down"],
"editor.scrollUpAndMove": [],
"editor.scrollDownAndMove": [],
"editor.scrollToTop": [],
"editor.scrollToBottom": [],
"editor.moveToPageTop": ["Ctrl+PageUp"],
-2
Переглянути файл
@@ -254,8 +254,6 @@ export const vscodeMacos: Record<string, string[]> = {
"editor.scrollToCenter": [],
"editor.scrollUp": [],
"editor.scrollDown": [],
"editor.scrollUpAndMove": [],
"editor.scrollDownAndMove": [],
"editor.scrollToTop": [],
"editor.scrollToBottom": [],
"editor.moveToPageTop": [],
-7
Переглянути файл
@@ -4118,13 +4118,6 @@
"Run '{command}' in '{rel}' to install them.": "Run '{command}' in '{rel}' to install them.",
"Run '{command}' to install them.": "Run '{command}' to install them.",
"Install Node.js Dependencies": "Install Node.js Dependencies",
"Imports": "Imports",
"Class count to use import with '*'": "Class count to use import with '*'",
"Use a wildcard import once this many classes of one package are used (5 by default; 999 keeps single-class imports).": "Use a wildcard import once this many classes of one package are used (5 by default; 999 keeps single-class imports).",
"Class count to use import with *": "Class count to use import with *",
"Names count to use static import with '*'": "Names count to use static import with '*'",
"Use a wildcard static import once this many names are imported statically (3 by default; 999 keeps single imports).": "Use a wildcard static import once this many names are imported statically (3 by default; 999 keeps single imports).",
"Names count to use static import with *": "Names count to use static import with *",
"Watch for changes": "Watch for changes",
"Rerun Automatically": "Rerun Automatically",
"Debug runs the tests once, without watching.": "Debug runs the tests once, without watching.",
-2
Переглянути файл
@@ -693,8 +693,6 @@
"Scroll to Center": "捲動到中央",
"Scroll Up": "向上捲動",
"Scroll Down": "向下捲動",
"Scroll Up and Move if Necessary": "向上捲動並在必要時移動游標",
"Scroll Down and Move if Necessary": "向下捲動並在必要時移動游標",
"Scroll to Top": "捲動到頂部",
"Scroll to Bottom": "捲動到底部",
"Move Caret to Page Top": "將游標移至頁面頂部",
-8
Переглянути файл
@@ -1054,8 +1054,6 @@
"Scroll to Center": "滚动到中央",
"Scroll Up": "向上滚动",
"Scroll Down": "向下滚动",
"Scroll Up and Move if Necessary": "向上滚动并在必要时移动光标",
"Scroll Down and Move if Necessary": "向下滚动并在必要时移动光标",
"Scroll to Top": "滚动到顶部",
"Scroll to Bottom": "滚动到底部",
"Move Caret to Page Top": "将光标移至页面顶部",
@@ -10564,12 +10562,6 @@
"Run with {title}": "使用 {title} 运行",
"Debug with {title}": "使用 {title} 调试",
"Launches the selected configuration with the Java agent of {pluginName}": "使用 {pluginName} 的 Java 代理启动所选配置",
"Class count to use import with '*'": "使用通配符导入的类数",
"Use a wildcard import once this many classes of one package are used (5 by default; 999 keeps single-class imports).": "当同一个包使用达到该数量的类时使用通配符导入;默认为 5,999 表示始终保留单类导入。",
"Class count to use import with *": "使用通配符导入的类数",
"Names count to use static import with '*'": "使用通配符静态导入的名称数",
"Use a wildcard static import once this many names are imported statically (3 by default; 999 keeps single imports).": "静态导入的名称达到该数量时使用通配符静态导入;默认为 3,999 表示始终保留单条导入。",
"Names count to use static import with *": "使用通配符静态导入的名称数",
"Watch for changes": "监视更改",
"Rerun Automatically": "自动重新运行",
"Debug runs the tests once, without watching.": "调试时测试只运行一次,不监视更改。",