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

..
Автор SHA1 Повідомлення Дата
l0ng-ai 205241c0b3 fix(notebook): Vim u and Ctrl-R undo and redo in notebook cells
Notebook cells have no CodeMirror history: source and structural edits
share the notebook's backend history, which Cmd+Z already uses. Vim's u /
Ctrl-R called CodeMirror's history and did nothing. An editor can now
provide externalHistory, and the Vim engine sends undo / redo there.
2026-11-16 00:11:25 +08:00
Akbar Husain cf444a31f7 perf(index): allocation-free hump scoring and byte-scan name boosts (#3573)
hump_bonus walks the candidate's chars once with a cursor into the sorted, deduplicated match indices instead of collecting a Vec<char> per ranked survivor, and name_boost finds the extension dot with a byte scan. Results are unchanged; find_symbols/OCo goes from 3.71 ms to 3.36 ms in the index bench.

Co-authored-by: akbar1214 <[email protected]>
2026-11-16 00:05:57 +08:00
Mr0Bread c3763fb806 feat(agent): steer agents that advertise _session/steering (#3568)
Messages typed while a task is running join the running turn for agents that advertise the _session/steering extension (_meta.steering.supported in the initialize response, as OMP does), not only those advertising _meta.openidea.steer. An outcome other than injected (promptRequired, failed) queues the message for the next turn.

Co-authored-by: Mr0Bread <[email protected]>
2026-11-16 00:01:30 +08:00
Mr0Bread 9a518e734b refactor(styles): put gap on the spacing scale (#3562)
Extends the 4px-grid spacing scale with --space-0-5 (2px), --space-1 (4px) and --space-1-5 (6px) and replaces the literal 2/4/6/8/12/16px gap, row-gap and column-gap values with the tokens; computed values are unchanged. src/styles/spacingScale.test.ts flags an on-scale literal gap.

Co-authored-by: Mr0Bread <[email protected]>
2026-11-15 23:59:47 +08:00
Mr0Bread 2913c12a19 chore(styles): remove CSS module classes no component reads (#3560)
35 CSS-module classes in 10 modules were defined but never read (no styles.x use, no composes, no dynamic access in their importers): leftovers of removed UI such as the settings code-preview block, the GitHub tool window's layout helpers and SDK tree rows.

Co-authored-by: Mr0Bread <[email protected]>
2026-11-15 23:58:00 +08:00
Mr0Bread 3044518b88 fix(styles): restore CSS classes components still reference (#3559)
Components read CSS-module classes no module defined, which are undefined at runtime. The archived-task banner in agent sessions (.banner, .bannerText, .bannerSpacer, dropped in #2083) and the Create Patch directory row (.cloneDirRow, .cloneDirInput, dropped in #866) are restored; references to classes that never existed are removed. src/styles/cssModules.test.ts lists any styles.x the imported module lacks.

Co-authored-by: Mr0Bread <[email protected]>
2026-11-15 23:56:20 +08:00
Vadim LazukтаInf1mum 778472854e fix(markdown): keep the Preview only scroll position when switching tabs back (#3569)
Tab switches unmount the preview, and its saved offset was applied once at remount, before images and diagrams had drawn. A restore that clamped to the short document is applied again on each settle until it fits or the reader scrolls; the clamped write no longer replaces the saved offset. The preview opts out of scroll anchoring, which in WebView2 kept a later block in view while images above it loaded.

Fixes #3537

Co-authored-by: Inf1mum <[email protected]>
2026-11-15 23:54:36 +08:00
l0ng-ai 1679d61a6a fix(services): list the SSH configurations in the Docker connection dialog (#3570)
SshConfigSelect reads the settings window's staged ssh.configs unless given a list, and that list is empty outside the settings window, so the Docker connection dialog offered only None. The dialog now passes the live list; the None choice gets its Chinese text.

Closes #3535
2026-11-15 23:51:21 +08:00
l0ng-ai 937008a6fe fix(lsp): highlight a library class the Kotlin server shows as Java as Java (#3565)
A virtual .class document has no language by its name, so it took its server's first language: the Kotlin language server's Java stubs of jar classes were highlighted as Kotlin and their Java keywords stayed uncoloured. A .class stub whose package or import line ends with ';' is now Java (virtual_doc::is_java_class_stub).
2026-11-15 23:40:00 +08:00
l0ng-ai dc3d2050cb fix(editor): colour this and super as keywords in Java, JavaScript, TypeScript and C++ (#3564)
The Lezer grammars tag `this` as `self`, which the colour scheme paints with Python's self-parameter colour, and @lezer/javascript tags `super` as an atom. JAVA_TAGS (also used by JSP), JS_TAGS and a new C++ entry restyle them as keywords. Python's `self` is unchanged.
2026-11-15 23:37:06 +08:00
Mr0Bread 732baf8f1e fix(styles): use defined tokens where CSS read --bg-subtle, --bg-toolbar and --fg-primary (#3550)
Three custom properties were read without a fallback and declared nowhere, so they resolved to their initial values: no background on the Working Status and Command Permissions rows, none on the console Find button (its icon sat over console text), and an inherited hover colour. They now use --bg-hover, --bg-elev and --fg-strong; a dead var(--bg) fallback in Run.module.css is dropped. A test lists any var(--x) without a fallback whose --x is declared nowhere.

Co-authored-by: Mr0Bread <[email protected]>
2026-11-15 23:31:12 +08:00
Mansur Akhmadiтаmansur-akhmadi 9b6e5a5a62 feat(vcs): copy a file's link on its Git remote from Copy Path/Reference… (#3553)
Copy Path/Reference… gains a <hosting> Link item (GitHub Link, GitLab Link, Bitbucket Link) that copies the page Open In › <hosting> opens; in the editor the link covers the selected lines (#L2-L3 / #L2-3 / #lines-2:3). A copyPath menu id lets features add items to the chooser, so editor/core and project-tree stay free of Git code.

Closes #3552

Co-authored-by: mansur-akhmadi <[email protected]>
2026-11-15 23:29:54 +08:00
l0ng-ai 8c2c701517 feat(keymap): list Cut, Copy, Paste, Undo, Redo and Select All in Settings › Keymap (#3563)
The Edit actions are hidden from Search Everywhere, and the Keymap page skipped hidden actions with no preset shortcut, so they could not get a second key (Ctrl+Shift+C / V / X for Vim users). A keymap flag on an action keeps it listed; the settings window's action list (describeActions) carries it too.
2026-11-15 23:25:59 +08:00
l0ng-ai aeb689c632 test(app): the command-line diff opens with Swap Sides (#3557)
#3540 made the command-line diff swappable; the launch tests in windows.test.ts still expected the diff data without the flag.
2026-11-15 23:17:53 +08:00
l0ng-ai 80c25be389 fix(keymap): list the data editor actions in the VS Code preset (#3556)
The VS Code preset must name every IntelliJ action id; #3551 added the db.* data editor actions to the IntelliJ presets only, failing keymap.test.ts on main.
2026-11-15 23:16:27 +08:00
Sameh Elhawaryтаsamehelhawary acea7e6235 feat(php): Phoxite as a selectable PHP language server (#3541)
languages/php.toml gains a phoxite entry (phoxite-lsp over stdio), a fallback listed after phpactor; Intelephense stays the default and users pick Phoxite under Language Servers. ide-tools installs it from the samehelhawary/phoxite GitHub releases (a binary per platform with a .sha256 beside it). A server entry can now name the servers it replaces: those stay away while it serves the file (Phoxite replaces laravel-lsp, which it covers), including when the replacing fallback takes over after a server gives up.

Co-authored-by: samehelhawary <[email protected]>
2026-11-15 23:14:32 +08:00
l0ng-ai 25197b3215 fix(vcs): show a committed directory symlink's target in revision diffs (#3554)
Revision content was decoded with the working file's encoding, read whenever the path existed. For a symlink to a folder that path is a directory, so loading failed and the Git Log diff showed '<path> is a directory'. The working file is now consulted only when it is a regular file; otherwise the encoding is detected from the revision's blob.

Closes #3528
2026-11-15 23:11:50 +08:00
Vadim LazukтаInf1mum 55786a7030 fix(vcs): the Git Log rename label names the original directory (#3546)
The changed-file label trimmed a rename's old path to its base name, so a move between directories looked like a rename in place. A shared renameFrom() now says 'renamed from <name>' within one directory and 'moved from <old path relative to the new directory>' otherwise, as IDEA does; Git Log and the GitHub create / pull request change trees use it.

Closes #3529

Co-authored-by: Inf1mum <[email protected]>
2026-11-15 23:09:13 +08:00
Vadim LazukтаInf1mum b7adbbb17c fix(project): mark symlinks with a link arrow in the tree (#3547)
Directory and file symlinks used the same icons as real folders and files. The Project view now overlays IDEA's link arrow (expui nodes/symlink) on every entry the listing reports as a symlink; the model already carried the flag, so no extra stat calls.

Closes #3527

Co-authored-by: Inf1mum <[email protected]>
2026-11-15 23:06:39 +08:00
l0ng-ai d1290c76ea feat(database): data editor row and toolbar commands as actions (#3551)
Reload Page, First / Previous / Next / Last Page, Add Row, Export Data, Delete Rows, Restore Rows, Edit Cell and the cell copy commands were menu items or toolbar buttons only. They are now db.* actions supplied by the table editor and the console result grid through their focus handle, so they appear in Find Action and take Keymap shortcuts; menus and buttons run the same actions. DataGrip's defaults bind Reload Page, Previous / Next Page and Add Row, and Delete Rows on Windows and Linux.

Closes #3506
2026-11-15 23:03:35 +08:00
l0ng-ai 0febd3e170 fix(editor): Sort Lines orders by character code (#3548)
Sort Lines used a locale-aware collator, which interleaves upper- and lowercase letters. It now compares UTF-16 code units, the order IDEA's Sort Lines uses (String.compareTo) and LC_ALL=C sort gives.

Closes #3516
2026-11-15 22:47:11 +08:00
238 змінених файлів з 2544 додано та 1225 видалено

No files matched your search

+1
Переглянути файл
@@ -42,6 +42,7 @@ Visual style: dark, low-contrast greys, one cool accent
shortcuts live in `src/platform/keymaps/`.
- Styling: CSS Modules + tokens only (no hex literals in components). Inline SVG
icons from `src/ui/icons.tsx`, never emoji. Real `<button>`/`<input>`; `aria-label` on icon buttons.
`gap` uses the `--space-*` scale (`src/styles/tokens.css`, 4px grid) where a value is on it.
- User-visible text goes through the text catalog: add every new string to both
`src/platform/locales/text/en.json` and `zh.json` (`textCatalog.test.ts` enforces it).
Other locales may lack entries; their UI shows the English text until a translator adds it.
+29 -3
Переглянути файл
@@ -1861,12 +1861,24 @@ impl Task {
let s = self.state.lock();
s.busy && s.task.status == AgentStatus::Running
};
let Some(live) = live.filter(|l| running && (prompt.images.is_empty() || l.capabilities.images)) else {
let Some((live, method)) = live
.filter(|l| running && (prompt.images.is_empty() || l.capabilities.images))
.and_then(|l| steer_method(&l.init).map(|m| (l, m)))
else {
return Err(prompt);
};
let content = self.content(&live, &prompt).await;
let sent: Result<Value, RpcError> =
live.peer.request("_openidea/steer", json!({ "sessionId": live.session, "prompt": content }), None).await;
live.peer.request(method, json!({ "sessionId": live.session, "prompt": content }), None).await;
// `_session/steering` answers with an outcome: only `injected` joined the turn
// (`promptRequired`: no turn is running any more).
let sent = match sent {
Ok(reply) => match reply.get("outcome").and_then(Value::as_str) {
None | Some("injected") => Ok(()),
Some(outcome) => Err(reply.get("reason").and_then(Value::as_str).unwrap_or(outcome).to_owned()),
},
Err(e) => Err(e.to_string()),
};
if let Err(e) = sent {
// The turn ended meanwhile: the message waits for the next one instead.
tracing::debug!("agent task {}: steering failed: {e}", self.id);
@@ -2865,13 +2877,27 @@ fn shown_background(tasks: &[Value], known: &[AgentBackgroundTask]) -> Vec<Agent
.collect()
}
/// The method that adds a message to the running turn: OpenIDEA's own, or the
/// `_session/steering` extension an agent advertises in the response's top-level `_meta`
/// (OMP).
fn steer_method(init: &acp::Negotiated) -> Option<&'static str> {
let supported = |v: Option<&Value>| v.and_then(Value::as_bool) == Some(true);
if supported(init.meta("/openidea/steer")) {
Some("_openidea/steer")
} else if supported(init.meta.as_ref().and_then(|m| m.pointer("/steering/supported"))) {
Some("_session/steering")
} else {
None
}
}
fn capabilities_of(init: &acp::Negotiated) -> (AgentCapabilities, bool) {
let meta = |p: &str| init.meta(p).and_then(Value::as_bool) == Some(true);
let capabilities = AgentCapabilities {
images: init.prompt("image"),
fork: init.session("fork"),
rollback: meta("/openidea/rollback"),
steer: meta("/openidea/steer"),
steer: steer_method(init).is_some(),
background_tasks: meta("/openidea/backgroundTasks"),
read_only: false,
};
+50
Переглянути файл
@@ -51,6 +51,9 @@ struct FakeAgent {
/// Config options `session/new` reports after the model one (per-model efforts, say).
extra_options: Mutex<Vec<Value>>,
model_options: Mutex<HashMap<String, Vec<Value>>>,
/// Advertises steering as OMP does (`_meta.steering` at the top of `initialize`)
/// instead of `_meta.openidea.steer`.
session_steering: bool,
}
impl FakeAgent {
@@ -156,6 +159,10 @@ impl Handler for FakeAgent {
if params.pointer("/clientCapabilities/subagents").is_some_and(Value::is_object) {
self.calls.lock().push("subagents".into());
}
if self.session_steering {
return Ok(json!({"protocolVersion": 1, "agentCapabilities": {"loadSession": true},
"_meta": {"steering": {"supported": true}}}));
}
Ok(
json!({"protocolVersion": 1, "authMethods": self.auth_methods, "agentCapabilities": {"loadSession": !self.no_load,
"sessionCapabilities": {"fork": {}}, "_meta": {"openidea": {"rollback": true, "steer": true, "backgroundTasks": true}}}}),
@@ -183,6 +190,13 @@ impl Handler for FakeAgent {
self.calls.lock().push(format!("{method} {detail}"));
Ok(json!({}))
}
"_session/steering" => {
let text = params["prompt"][0]["text"].clone();
self.calls.lock().push(format!("{method} {text}"));
// OMP answers whether the message joined the turn rather than failing.
let outcome = if text == "too late" { "promptRequired" } else { "injected" };
Ok(json!({"outcome": outcome, "queue": "steering"}))
}
"session/load" => {
self.say(&session, "replayed history");
Ok(json!({}))
@@ -1060,6 +1074,42 @@ fn text(t: &str) -> AgentPrompt {
AgentPrompt { text: t.into(), ..AgentPrompt::default() }
}
#[tokio::test(flavor = "multi_thread")]
async fn steers_through_session_steering() {
let tmp = tempfile::tempdir().unwrap();
let agent = Arc::new(FakeAgent { session_steering: true, ..FakeAgent::default() });
let mgr = manager(tmp.path(), agent.clone());
let task = mgr
.create(NewAgentTask {
project_root: None,
prompt: text("wait"),
provider: "claude".into(),
config: vec![],
isolation: Isolation::Local,
base: None,
})
.await
.unwrap();
wait_for(&mgr, &task.id, AgentStatus::Running).await;
assert!(mgr.task(&task.id).unwrap().state.lock().task.capabilities.steer);
mgr.prompt(&task.id, text("also this"), true).await.unwrap();
assert!(agent.calls.lock().iter().any(|c| c == "_session/steering \"also this\""));
let entries = mgr.entries(&task.id, None).unwrap();
assert!(matches!(entries.last(), Some(AgentEntry::User { steered: true, .. })));
assert!(mgr.task(&task.id).unwrap().state.lock().task.queue.is_empty());
// The agent didn't take it into the turn: the turn stops and it goes next, as without
// steering (the fake agent's next turn asks for permission).
mgr.prompt(&task.id, text("too late"), true).await.unwrap();
wait_for(&mgr, &task.id, AgentStatus::NeedsInput).await;
let entries = mgr.entries(&task.id, None).unwrap();
assert!(entries.iter().any(|e| matches!(e, AgentEntry::User { text, steered: false, .. } if text == "too late")));
assert!(!entries.iter().any(|e| matches!(e, AgentEntry::User { text, steered: true, .. } if text == "too late")));
mgr.cancel(&task.id, None).unwrap();
wait_for(&mgr, &task.id, AgentStatus::Ready).await;
}
#[tokio::test(flavor = "multi_thread")]
async fn messages_sent_while_busy_are_queued_and_send_now_interrupts() {
let tmp = tempfile::tempdir().unwrap();
+3 -1
Переглянути файл
@@ -1275,7 +1275,9 @@ impl Project {
}
let defaults = self.documents.file_defaults();
let fallback = defaults.fallback_for(path);
if path.exists() {
// The working file only when it is a regular file: a path that is a directory there
// (a committed symlink to a folder, a file replaced by a folder) has only its blob.
if path.is_file() {
let loaded = ide_vfs::load_text_with_fallback(path, fallback)?;
return encoding_rs::Encoding::for_label(loaded.encoding.as_bytes())
.ok_or_else(|| ide_core::IdeError::invalid("unknown file encoding"));
+46
Переглянути файл
@@ -111,3 +111,49 @@ async fn gbk_document_gutter_diff_stage_and_rollback_share_encoding() {
assert_eq!(vcs::vcs_file_at(&host, "main", utf8, None).await.unwrap().as_deref(), Some(old));
host.close_project("main");
}
/// A committed symlink to a folder (#3528): its revision is the link target, even though the
/// working path is a directory.
#[cfg(unix)]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn a_directory_symlink_revision_is_its_target() {
let temp = tempfile::tempdir().unwrap();
let base = dunce::canonicalize(temp.path()).unwrap();
let root = base.join("project");
std::fs::create_dir_all(root.join("target")).unwrap();
git(&root, &["init", "-b", "main"]);
git(&root, &["config", "user.name", "Test"]);
git(&root, &["config", "user.email", "[email protected]"]);
git(&root, &["config", "commit.gpgsign", "false"]);
std::fs::write(root.join("target/file.txt"), "example\n").unwrap();
std::os::unix::fs::symlink("target", root.join("dir-link")).unwrap();
git(&root, &["add", "."]);
git(&root, &["commit", "-m", "Add a directory symlink"]);
let host = Host::new(HostConfig {
config_dir: base.join("config"),
data_dir: base.join("data"),
local_data_dir: base.join("data"),
languages: Arc::new(ide_language::LanguageRegistry::load(None).unwrap()),
syntax: Arc::default(),
sink_for: Box::new(|_| Arc::new(NullSink)),
owner: |w| w,
runtime: tokio::runtime::Handle::current(),
project_environment: false,
});
host.trust.decide(&root, true, false).unwrap();
let project = host.open_project("main", &root).unwrap();
for _ in 0..500 {
if !project.repos().is_empty() {
break;
}
tokio::time::sleep(Duration::from_millis(10)).await;
}
let link = root.join("dir-link");
assert!(link.is_dir());
assert_eq!(
vcs::vcs_file_at(&host, "main", link.clone(), Some("HEAD".into())).await.unwrap().as_deref(),
Some("target")
);
assert_eq!(vcs::vcs_file_mode(&host, "main", link, Some("HEAD".into())).await.unwrap().as_deref(), Some("120000"));
host.close_project("main");
}
+25 -11
Переглянути файл
@@ -78,8 +78,8 @@ impl Needle {
let mut b = 0;
if n.eq_ignore_ascii_case(q) {
b += EXACT;
} else if let Some(dot) = name.find('.')
&& name.as_bytes()[..dot].eq_ignore_ascii_case(q)
} else if let Some(dot) = n.iter().position(|&b| b == b'.')
&& n[..dot].eq_ignore_ascii_case(q)
{
b += EXACT_STEM;
} else if n.len() >= q.len() && n[..q.len()].eq_ignore_ascii_case(q) {
@@ -97,17 +97,31 @@ fn hump_bonus(s: &str, indices: &[u32]) -> u32 {
if indices.is_empty() {
return 0;
}
let chars: Vec<char> = s.chars().collect();
let is_start = |i: usize| {
if i == 0 {
return true;
// One pass over `s`: `indices` is sorted, and whether position `i` is a
// word start only needs the char before it, so no `Vec<char>` is collected.
let is_start = |prev: Option<char>, c: char| match prev {
None => true,
Some(p) => {
!p.is_alphanumeric()
|| (p.is_lowercase() && c.is_uppercase())
|| (!p.is_ascii_digit() && c.is_ascii_digit())
}
let (p, c) = (chars[i - 1], chars[i]);
!p.is_alphanumeric() || (p.is_lowercase() && c.is_uppercase()) || (!p.is_ascii_digit() && c.is_ascii_digit())
};
let humps = indices.iter().filter(|&&i| (i as usize) < chars.len() && is_start(i as usize)).count() as u32;
let first = if is_start(indices[0] as usize) { FIRST_AT_START } else { 0 };
humps * HUMP + first
let (mut humps, mut next, mut first_start) = (0u32, 0usize, false);
let (mut prev, mut at) = (None, 0u32);
for c in s.chars() {
if next < indices.len() && indices[next] == at {
let started = is_start(prev, c);
humps += u32::from(started);
if next == 0 {
first_start = started;
}
next += 1;
}
prev = Some(c);
at += 1;
}
humps * HUMP + u32::from(first_start) * FIRST_AT_START
}
#[derive(Clone, Copy)]
+5
Переглянути файл
@@ -170,6 +170,11 @@ pub struct LanguageServerConfig {
/// basedpyright): only used while none of those is installed.
#[serde(default)]
pub fallback: bool,
/// Names of servers listed after this one that it makes redundant (a PHP server
/// with its own Laravel support replaces `laravel-lsp`): they aren't used while
/// this one serves the file.
#[serde(default)]
pub replaces: Vec<String>,
/// What the server is used for (`completion`, `code-action`, `diagnostics`,
/// … `FEATURES` in `ide-lsp/src/caps.rs`); empty means everything. The other
/// capabilities it announces are ignored, so a refactoring-only server next
+4 -1
Переглянути файл
@@ -758,7 +758,10 @@ mod tests {
let cfg = reg.get(&LanguageId::new("php")).unwrap();
let names: Vec<&str> = cfg.language_servers.iter().map(|s| s.name.as_str()).collect();
// After the fallback: hover, rename and symbols stay with Intelephense.
assert_eq!(names, ["intelephense", "phpactor", "laravel-lsp"]);
assert_eq!(names, ["intelephense", "phpactor", "phoxite", "laravel-lsp"]);
// Phoxite answers the Laravel strings itself.
let phoxite = cfg.language_servers.iter().find(|s| s.name == "phoxite").unwrap();
assert!(phoxite.fallback && phoxite.replaces == ["laravel-lsp"]);
let lsp = cfg.language_servers.iter().find(|s| s.name == "laravel-lsp").unwrap();
assert_eq!(lsp.command.as_str(), "laravel-lsp");
// Its `lsp` command takes no options and speaks over stdio; `--stdio` stops it at startup.
+26 -9
Переглянути файл
@@ -660,15 +660,17 @@ impl LspManager {
/// The servers serving `path`: every regular one, and each `fallback` one
/// only while all servers listed before it have given up (missing, not
/// launchable, or crashed for good). One that requires a root marker serves
/// only files below one, and stands in for no other.
/// only files below one, and stands in for no other. One that a server before
/// it `replaces` is left out while that server serves the file.
fn servers_for(&self, language: &LanguageId, path: &Path) -> Vec<Arc<Server>> {
if let Some(servers) = self.arduino_servers(language, path) {
return servers;
}
let mut out = Vec::new();
let mut available_before = false;
let mut replaced: Vec<String> = Vec::new();
for sc in &self.language_servers(language) {
if sc.fallback && available_before {
if (sc.fallback && available_before) || replaced.contains(&sc.name) {
continue;
}
if sc.require_root_marker
@@ -678,6 +680,9 @@ impl LspManager {
}
let server = self.server_for(sc, language, path);
available_before |= !sc.require_root_marker && !server.gave_up();
if !server.gave_up() {
replaced.extend(sc.replaces.iter().cloned());
}
out.push(server);
}
out
@@ -865,7 +870,7 @@ impl LspManager {
ide_core::event::ServerStatus::Missing,
Some(message),
) {
self.attach_fallbacks();
self.fallbacks_take_over().await;
}
return;
}
@@ -878,7 +883,7 @@ impl LspManager {
ide_core::event::ServerStatus::Misconfigured,
Some(message),
) {
self.attach_fallbacks();
self.fallbacks_take_over().await;
}
return;
}
@@ -891,7 +896,7 @@ impl LspManager {
ide_core::event::ServerStatus::Crashed,
Some(message),
) {
self.attach_fallbacks();
self.fallbacks_take_over().await;
}
return;
}
@@ -1039,7 +1044,7 @@ impl LspManager {
}
}
// Gave up (crashed repeatedly, or its build expired): the fallbacks it hid take over.
None => self.attach_fallbacks(),
None => self.fallbacks_take_over().await,
}
}
@@ -3464,7 +3469,10 @@ impl LspManager {
virtual_doc::is_decompiled(&text)
};
let title = title.unwrap_or_else(|| virtual_doc::title(uri, decompiled));
let detected = self.languages.detect(Path::new(&title), None);
let mut detected = self.languages.detect(Path::new(&title), None);
if let Some(stem) = title.strip_suffix(".class").filter(|_| virtual_doc::is_java_class_stub(&text)) {
detected = self.languages.detect(Path::new(&format!("{stem}.java")), None);
}
let language_id = if detected == LanguageId::plain_text() {
languages.first().cloned().unwrap_or(detected)
} else {
@@ -3828,8 +3836,16 @@ impl LspManager {
}
}
/// A server enabled again shadows the fallbacks attached in its place: they
/// leave the open documents, and stop once no document uses them.
/// A server gave up: its fallbacks take over the open documents, and the servers
/// they replace leave.
async fn fallbacks_take_over(&self) {
self.attach_fallbacks();
self.detach_shadowed_fallbacks().await;
}
/// A server enabled again shadows the fallbacks attached in its place, and a
/// fallback that took over may replace a server attached earlier: they leave the
/// open documents, and stop once no document uses them.
async fn detach_shadowed_fallbacks(&self) {
let open: Vec<(DocId, LanguageId, PathBuf)> =
self.docs.lock().iter().map(|(id, d)| (*id, d.language.clone(), d.path.clone())).collect();
@@ -3845,6 +3861,7 @@ impl LspManager {
.filter(|a| {
!wanted.iter().any(|w| w.id == a.server.id)
&& (configs.iter().any(|c| c.fallback && c.name == a.server.name)
|| configs.iter().any(|c| c.replaces.contains(&a.server.name))
|| (a.server.name == "clangd" && wanted.iter().any(|s| s.name == arduino::SERVER)))
})
.map(|a| a.server.id)
+22
Переглянути файл
@@ -110,6 +110,17 @@ pub fn is_decompiled(text: &str) -> bool {
})
}
/// Whether a `.class` stub is written in Java: its first `package` or `import` line ends with `;`.
/// The Kotlin language server shows Java classes from jars as Java and Kotlin ones as Kotlin, under
/// the same `.class` name.
pub fn is_java_class_stub(text: &str) -> bool {
text.lines()
.take(200)
.map(str::trim)
.find(|line| line.starts_with("package ") || line.starts_with("import "))
.is_some_and(|line| line.ends_with(';'))
}
/// `scheme` of a URI (`jdt` for `jdt://…`).
pub fn scheme(uri: &str) -> &str {
uri.split_once(':').map(|(s, _)| s).unwrap_or("")
@@ -205,6 +216,17 @@ mod tests {
const JDT: &str = "jdt://contents/spring-boot-4.1.1.jar/org.springframework.boot/SpringApplication.class?=spring-demo/%5C/Users%5C/me%5C/.m2%5C/repository%5C/spring-boot-4.1.1.jar%3Corg.springframework.boot%28SpringApplication.class";
#[test]
fn class_stubs_in_java_or_kotlin() {
let java = "// IntelliJ API Decompiler stub source generated from a class file\n\npackage com.boydti.fawe.util;\n\npublic class EditSessionBuilder {\n}\n";
let kotlin = "// IntelliJ API Decompiler stub source generated from a class file\n// Implementation of methods is not available\n\npackage kotlin.collections\n\npublic fun <T> listOf(): List<T> { /* compiled code */ }\n";
let imports_only = "import java.util.List;\n\npublic class A {}\n";
assert!(is_java_class_stub(java));
assert!(is_java_class_stub(imports_only));
assert!(!is_java_class_stub(kotlin));
assert!(!is_java_class_stub("public class A {}"));
}
#[test]
fn csharp_metadata_titles_and_kinds() {
for (uri, expected) in [
+62
Переглянути файл
@@ -264,6 +264,7 @@ fn server_cfg(name: &str) -> LanguageServerConfig {
install_hint: Some(format!("install {name}")),
connect: None,
fallback: false,
replaces: Vec::new(),
features: Vec::new(),
code_action_kinds: Vec::new(),
max_java: None,
@@ -3286,6 +3287,67 @@ async fn a_server_requiring_a_root_marker_serves_only_files_below_one() {
h.wait_status("alt", ServerStatus::Ready).await;
}
/// A server that `replaces` another (a PHP server with its own Laravel support and
/// `laravel-lsp`) keeps it away while it serves, and only then.
#[tokio::test(flavor = "multi_thread")]
async fn a_replaced_server_stays_away_while_its_replacement_serves() {
let servers = [("main", incremental_caps()), ("alt", incremental_caps()), ("framework", incremental_caps())];
let configure = |cfg: &mut LanguageServerConfig| match cfg.name.as_str() {
"alt" => {
cfg.fallback = true;
cfg.replaces = vec!["framework".into()];
}
"framework" => cfg.require_root_marker = true,
_ => {}
};
let h = harness_configured("mock", "mk", &servers, configure);
let disabled: Arc<Mutex<Vec<String>>> = Default::default();
{
let disabled = disabled.clone();
h.mgr.set_servers_hook(Box::new(move |_, defined| {
defined.iter().filter(|c| !disabled.lock().contains(&c.name)).cloned().collect()
}));
}
std::fs::write(h.root.join("mock.toml"), "").unwrap();
let (_, path) = h.open("a.mk", "x");
let uri = uri_of(&path);
// The preferred server serves: the framework's server joins it, the alternative stays away.
h.wait_status("main", ServerStatus::Ready).await;
h.wait_status("framework", ServerStatus::Ready).await;
eventually(|| h.launcher.state("framework").docs.lock().contains_key(&uri)).await;
assert!(h.statuses("alt").is_empty());
// The alternative takes over: the server it replaces closes the document and stops.
disabled.lock().push("main".into());
h.mgr.reconfigure().await;
h.wait_status("alt", ServerStatus::Ready).await;
eventually(|| h.launcher.state("alt").docs.lock().contains_key(&uri)).await;
assert!(!h.launcher.state("framework").notified("textDocument/didClose").is_empty());
assert_eq!(h.statuses("framework").last(), Some(&ServerStatus::Stopped));
assert_eq!(h.mgr.servers().iter().map(|s| s.name.as_str()).collect::<Vec<_>>(), ["alt"]);
// The preferred server again: the framework's server comes back with it.
disabled.lock().clear();
h.mgr.reconfigure().await;
h.wait_status("main", ServerStatus::Ready).await;
eventually(|| h.statuses("framework").last() == Some(&ServerStatus::Ready)).await;
assert_eq!(h.statuses("alt").last(), Some(&ServerStatus::Stopped));
// A preferred server that is not installed: the alternative replaces the framework's
// server although that one attached first.
let servers = [("ghost", json!({})), ("alt", incremental_caps()), ("framework", incremental_caps())];
let h = harness_configured("mock", "mk", &servers, configure);
h.launcher.state("ghost").missing.store(true, Ordering::SeqCst);
std::fs::write(h.root.join("mock.toml"), "").unwrap();
let (_, path) = h.open("a.mk", "x");
let uri = uri_of(&path);
h.wait_status("ghost", ServerStatus::Missing).await;
h.wait_status("alt", ServerStatus::Ready).await;
eventually(|| h.launcher.state("alt").docs.lock().contains_key(&uri)).await;
eventually(|| !h.mgr.servers().iter().any(|s| s.name == "framework")).await;
}
#[tokio::test(flavor = "multi_thread")]
async fn a_fallback_leaves_when_the_preferred_server_is_enabled_again() {
let h = harness_with_fallbacks(&[("main", incremental_caps()), ("alt", incremental_caps())], &["alt"]);
+3
Переглянути файл
@@ -419,6 +419,7 @@ async fn missing_binary_is_reported_with_install_hint() {
install_hint: Some("npm i -g nope-ls".into()),
connect: None,
fallback: false,
replaces: Vec::new(),
features: Vec::new(),
code_action_kinds: Vec::new(),
max_java: None,
@@ -692,6 +693,7 @@ async fn typescript_language_server_end_to_end() {
install_hint: None,
connect: None,
fallback: false,
replaces: Vec::new(),
features: Vec::new(),
code_action_kinds: Vec::new(),
max_java: None,
@@ -745,6 +747,7 @@ fn npm_server(tools: &Path, name: &str, bin: &str, init: Option<serde_json::Valu
install_hint: None,
connect: None,
fallback: false,
replaces: Vec::new(),
features: Vec::new(),
code_action_kinds: Vec::new(),
max_java: None,
+1
Переглянути файл
@@ -1306,6 +1306,7 @@ fn custom_server(name: &str, ls: &LanguageServerSettings) -> LanguageServerConfi
}),
connect: None,
fallback: false,
replaces: Vec::new(),
features: Vec::new(),
code_action_kinds: Vec::new(),
max_java: None,
+1
Переглянути файл
@@ -35,6 +35,7 @@ pub(crate) fn server(name: &str) -> LanguageServerConfig {
install_hint: None,
connect: None,
fallback: false,
replaces: Vec::new(),
features: Vec::new(),
code_action_kinds: Vec::new(),
max_java: None,
+22
Переглянути файл
@@ -170,6 +170,28 @@ mod tests {
assert_eq!(select_asset(&["laravel-lsp"], rules, LINUX_X64), None);
}
#[test]
fn phoxite_assets() {
let names = [
"phoxite-lsp-aarch64-apple-darwin",
"phoxite-lsp-x86_64-apple-darwin",
"phoxite-lsp-aarch64-unknown-linux-gnu",
"phoxite-lsp-x86_64-unknown-linux-gnu",
"phoxite-lsp-x86_64-pc-windows-msvc.exe",
// Not for any platform here: the musl build, the checksums, the VS Code packages.
"phoxite-lsp-x86_64-unknown-linux-musl",
"phoxite-lsp-x86_64-unknown-linux-gnu.sha256",
"phoxite-lsp-x86_64-pc-windows-msvc.exe.sha256",
"phoxite-linux-x64-0.2.1.vsix",
];
let rules = crate::registry::find("phoxite").unwrap().asset_rules();
assert_eq!(select_asset(&names, rules, MAC_ARM), Some(names[0]));
assert_eq!(select_asset(&names, rules, MAC_X64), Some(names[1]));
assert_eq!(select_asset(&names, rules, LINUX_ARM), Some(names[2]));
assert_eq!(select_asset(&names, rules, LINUX_X64), Some(names[3]));
assert_eq!(select_asset(&names, rules, WIN), Some(names[4]));
}
#[test]
fn kmp_lsp_assets_include_the_native_jar_indexer() {
let names = [
+32
Переглянути файл
@@ -458,6 +458,38 @@ pub static TOOLS: &[ToolSpec] = &[
homepage: "https://github.com/laravel/lsp",
needs: &[],
},
ToolSpec {
name: "phoxite",
display: "Phoxite",
kind: LanguageServer,
commands: &["phoxite-lsp"],
// Plain binaries per platform (`phoxite-lsp-<target triple>[.exe]`), each with a
// `.sha256` beside it.
method: Method::Release {
source: ReleaseSource::GitHub { repo: "samehelhawary/phoxite" },
assets: &[
rule(Mac, Arm64, "phoxite-lsp-aarch64-apple-darwin"),
rule(Mac, X64, "phoxite-lsp-x86_64-apple-darwin"),
rule(Linux, Arm64, "phoxite-lsp-aarch64-unknown-linux-gnu"),
rule(Linux, X64, "phoxite-lsp-x86_64-unknown-linux-gnu"),
rule(Windows, Arm64, "phoxite-lsp-aarch64-pc-windows-msvc.exe"),
rule(Windows, X64, "phoxite-lsp-x86_64-pc-windows-msvc.exe"),
],
locate: &[
"phoxite-lsp",
"phoxite-lsp-aarch64-apple-darwin",
"phoxite-lsp-x86_64-apple-darwin",
"phoxite-lsp-aarch64-unknown-linux-gnu",
"phoxite-lsp-x86_64-unknown-linux-gnu",
"phoxite-lsp-aarch64-pc-windows-msvc",
"phoxite-lsp-x86_64-pc-windows-msvc",
],
},
fallback: None,
version: ver("phoxite-lsp"),
homepage: "https://github.com/samehelhawary/phoxite",
needs: &[],
},
ToolSpec {
name: "gopls",
display: "gopls",
+2 -1
Переглянути файл
@@ -146,7 +146,8 @@ Closing a selected result activates its left neighbor, or its right neighbor if
**Edit Data** (`F4`) opens a table in an editor tab with server-side paging (100 to 5,000 rows), a `WHERE` filter and an `ORDER BY` field (both with completion). Click a column header to sort; `Shift`-click to add more sort columns.
- Double-click, `Enter` or `F2` edits a cell; `Shift+Enter` opens a larger editor. Pasting tab-separated text fills several cells.
- **Add Row**, **Delete Rows**, **Set NULL** (`⌘⌫` / `Ctrl+Backspace`), **Set DEFAULT** (`⌘⇧⌫` / `Ctrl+Shift+Backspace`). `Space` toggles booleans.
- **Add Row** (`⌘N` / `Alt+Insert`), **Delete Rows** (`Ctrl+Y` on Windows and Linux), **Set NULL** (`⌘⌫` / `Ctrl+Backspace`), **Set DEFAULT** (`⌘⇧⌫` / `Ctrl+Shift+Backspace`). `Space` toggles booleans.
- **Reload Page** (`⌘R` / `Ctrl+F5`), **Previous Page** and **Next Page** (`⌘⌥↑` / `⌘⌥↓`, `Ctrl+Alt+Up` / `Ctrl+Alt+Down`). These, the copy commands and **Export Data** are actions: find them with **Find Action** and assign shortcuts in **Settings › Keymap**.
- **Submit** (`⌘Enter` / `Ctrl+Enter`) sends all pending changes in one transaction; **Revert** (`⌘⌥Z` / `Ctrl+Alt+Z`) discards them.
Console results are editable the same way when the query is a plain select from one table that includes the primary key. Tables without a primary key, joins, aggregates, `UNION` queries, read-only data sources and ClickHouse results are read-only.
+1
Переглянути файл
@@ -101,6 +101,7 @@ Each entry starts one LSP server. Servers are listed in order; all regular serve
| `settings` | table | Answers the server's `workspace/configuration` requests. Without it, the requested sections are looked up in `initialization-options`. |
| `install-hint` | string | Shown when the server is missing and the IDE cannot install it. |
| `fallback` | bool | An alternative to the servers listed before it; used only while none of them is installed. |
| `replaces` | string array | Names of servers listed after this one that it makes redundant. They are not used while this server serves the file. Use it for an alternative that covers what an added server does. |
| `features` | string array | Use the server only for these features; empty means everything. Values: `completion`, `inline-completion`, `hover`, `signature-help`, `definition`, `declaration`, `type-definition`, `implementation`, `references`, `document-highlight`, `document-symbol`, `workspace-symbol`, `code-action`, `code-lens`, `rename`, `formatting`, `inlay-hint`, `semantic-tokens`, `document-link`, `call-hierarchy`, `type-hierarchy`, `folding-range`, `selection-range`, `diagnostics`. |
| `code-action-kinds` | string array | Keep only these code action kinds, matched by prefix (`refactor` keeps `refactor.extract`); empty keeps all. |
| `connect` | string | `host:port` of a server that speaks LSP over TCP. See [TCP servers](#tcp-servers). |
+1 -1
Переглянути файл
@@ -148,7 +148,7 @@ The table lists every built-in language definition. Server and debugger names in
| OCaml | `ocaml` | `.ml`, `.mll`, `.mly` | Yes | Yes | ocamllsp | ocamlearlybird |
| OCaml Interface | `ocaml.interface` | `.mli` | Yes | Yes | ocamllsp | — |
| Perl | `perl` | `.pl`, `.pm`, `.pod`, `.psgi`, `.cgi` | Yes | — | **perlnavigator** | — |
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | Yes | Yes | **intelephense** → phpactor + **laravel-lsp** | **php-debug** |
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | Yes | Yes | **intelephense** → phpactor → **phoxite** + **laravel-lsp** | **php-debug** |
| Plain Text | `plaintext` | `.txt`, `.text` | — | — | — | — |
| PowerShell | `powershell` | `.ps1`, `.psm1`, `.psd1`, `.pssc`, `.psrc` | Yes | — | powershell-editor-services | — |
| Prisma | `prisma` | `.prisma` | Yes | Yes | **prisma-language-server** | — |
+11 -7
Переглянути файл
@@ -7,11 +7,14 @@ OpenIDEA highlights PHP files (`.php`, `.phtml`, `.phpt` and older `.php3`–`.p
## Language servers
| Server | When it runs |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `intelephense` | Default. Workspace root: `composer.json`, `.phpactor.json` or `index.php`. |
| `phpactor` | Fallback: used only while Intelephense is not installed. |
| `laravel-lsp` | Laravel projects only (below an `artisan` file): hover, definition and completion inside `config('…')`, `route('…')` and `view('…')`. |
| Server | When it runs |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `intelephense` | Default. Workspace root: `composer.json`, `.phpactor.json` or `index.php`. |
| `phpactor` | Fallback: used only while Intelephense is not installed. |
| `phoxite` | Alternative with its own Laravel and Blade support: used while neither server above is installed, or when you pick it in **Settings › Languages & Frameworks › Language Servers**. |
| `laravel-lsp` | Laravel projects only (below an `artisan` file): hover, definition and completion inside `config('…')`, `route('…')` and `view('…')`. |
While Phoxite serves a project, `laravel-lsp` is not started: Phoxite answers the Laravel strings itself.
Intelephense checks code against the project's PHP version (see [Language level](#language-level)) and indexes the stubs and include paths you configure.
@@ -25,6 +28,7 @@ When a `.php` file opens and Intelephense is missing, a notification offers **In
| ------------------ | ---------------------------------------------------------------------- |
| Intelephense | npm (`intelephense`) |
| Laravel LSP | GitHub release (`laravel/lsp`) |
| Phoxite | GitHub release (`samehelhawary/phoxite`) |
| PHP Debug (Xdebug) | Open VSX (`xdebug.php-debug`); needs Node.js to run |
| phpactor | Not installable from the IDE; install it yourself and put it on `PATH` |
@@ -77,12 +81,12 @@ See [Debugging](/en/guide/debugging).
## Framework support
- **Laravel**: Laravel LSP for `config()`, `route()` and `view()` strings, and an `artisan serve` configuration.
- **Laravel**: Laravel LSP for `config()`, `route()` and `view()` strings, and an `artisan serve` configuration. With Phoxite as the PHP server, routes, views, config, translations and Eloquent models get completion, navigation and rename from it instead.
- **WordPress** and similar platforms: add their stubs under **Additional stubs** and the platform folder under **Include paths**.
## Limitations
- No Blade or Twig template support; only `.php` files get PHP code insight.
- No Blade or Twig template support with Intelephense; only `.php` files get PHP code insight. Phoxite adds code insight in `.blade.php` files, without Blade highlighting.
- phpactor is not installed by the IDE.
- Run with Coverage is not available for PHPUnit.
- Debugging needs the Xdebug extension in your PHP; the IDE does not install it.
+2 -1
Переглянути файл
@@ -145,7 +145,8 @@ SQL 补全基于已连接的架构:`FROM`/`JOIN` 后补全表(并根据外
**编辑数据**(`F4`)在编辑器标签页中打开表,服务器端分页(每页 100 到 5,000 行),并提供 `WHERE` 过滤和 `ORDER BY` 字段(都支持补全)。点击列标题排序,按住 `Shift` 点击可以追加排序列。
- 双击、`Enter` 或 `F2` 编辑单元格;`Shift+Enter` 打开更大的编辑框。粘贴制表符分隔的文本可以一次填写多个单元格。
- **添加行**、**删除行**、**设为 NULL**(`⌘⌫` / `Ctrl+Backspace`)、**设为默认值**(`⌘⇧⌫` / `Ctrl+Shift+Backspace`)。`Space` 切换布尔值。
- **添加行**(`⌘N` / `Alt+Insert`)、**删除行**(Windows 和 Linux 上为 `Ctrl+Y`)、**设为 NULL**(`⌘⌫` / `Ctrl+Backspace`)、**设为默认值**(`⌘⇧⌫` / `Ctrl+Shift+Backspace`)。`Space` 切换布尔值。
- **重新加载页面**(`⌘R` / `Ctrl+F5`)、**上一页** 和 **下一页**(`⌘⌥↑` / `⌘⌥↓`,`Ctrl+Alt+Up` / `Ctrl+Alt+Down`)。这些命令、各种复制命令和 **导出数据** 都是操作:可以在 **查找操作** 中找到,并在 **设置 › 按键映射** 中设置快捷键。
- **提交**(`⌘Enter` / `Ctrl+Enter`)在一个事务中提交所有待定更改;**还原**(`⌘⌥Z` / `Ctrl+Alt+Z`)放弃更改。
如果控制台查询是对单表的简单 select 且包含主键,结果同样可以编辑。没有主键的表、连接查询、聚合、`UNION` 查询、只读数据源和 ClickHouse 的结果都是只读的。
+1
Переглянути файл
@@ -101,6 +101,7 @@ root-markers = ["angular.json", "node_modules/@angular/core"]
| `settings` | 表 | 用于响应服务器的 `workspace/configuration` 请求。不写时,从 `initialization-options` 中查找请求的配置节。 |
| `install-hint` | 字符串 | 服务器缺失且 IDE 无法安装时显示的提示。 |
| `fallback` | 布尔 | 作为前面服务器的备选,只在它们都未安装时使用。 |
| `replaces` | 字符串数组 | 排在它后面、因它而变得多余的服务器名称。它为文件提供服务时,这些服务器不会被使用。用于能覆盖附加服务器功能的备选服务器。 |
| `features` | 字符串数组 | 只把服务器用于这些功能;为空表示全部。可选值:`completion`、`inline-completion`、`hover`、`signature-help`、`definition`、`declaration`、`type-definition`、`implementation`、`references`、`document-highlight`、`document-symbol`、`workspace-symbol`、`code-action`、`code-lens`、`rename`、`formatting`、`inlay-hint`、`semantic-tokens`、`document-link`、`call-hierarchy`、`type-hierarchy`、`folding-range`、`selection-range`、`diagnostics`。 |
| `code-action-kinds` | 字符串数组 | 只保留这些种类的代码操作,按前缀匹配(`refactor` 包含 `refactor.extract`);为空则全部保留。 |
| `connect` | 字符串 | 通过 TCP 提供 LSP 的服务器地址 `host:port`,见 [TCP 服务器](#tcp-服务器)。 |
+1 -1
Переглянути файл
@@ -143,7 +143,7 @@ IDE 安装工具从不需要 `sudo`。工具装在本地数据目录下 IDE 自
| OCaml | `ocaml` | `.ml`, `.mll`, `.mly` | 是 | 是 | ocamllsp | ocamlearlybird |
| OCaml Interface | `ocaml.interface` | `.mli` | 是 | 是 | ocamllsp | — |
| Perl | `perl` | `.pl`, `.pm`, `.pod`, `.psgi`, `.cgi` | 是 | — | **perlnavigator** | — |
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | 是 | 是 | **intelephense** → phpactor + **laravel-lsp** | **php-debug** |
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | 是 | 是 | **intelephense** → phpactor → **phoxite** + **laravel-lsp** | **php-debug** |
| Plain Text | `plaintext` | `.txt`, `.text` | — | — | — | — |
| PowerShell | `powershell` | `.ps1`, `.psm1`, `.psd1`, `.pssc`, `.psrc` | 是 | — | powershell-editor-services | — |
| Prisma | `prisma` | `.prisma` | 是 | 是 | **prisma-language-server** | — |
+11 -7
Переглянути файл
@@ -7,11 +7,14 @@ OpenIDEA 开箱即可高亮 PHP 文件(`.php`、`.phtml`、`.phpt` 以及老
## 语言服务器
| 服务器 | 启用条件 |
| -------------- | --------------------------------------------------------------------------------------------------------------------- |
| `intelephense` | 默认。工作区根:`composer.json`、`.phpactor.json` 或 `index.php`。 |
| `phpactor` | 备选:仅在未安装 Intelephense 时使用。 |
| `laravel-lsp` | 仅限 Laravel 项目(`artisan` 文件所在目录之下):在 `config('…')`、`route('…')`、`view('…')` 中提供悬停、跳转和补全。 |
| 服务器 | 启用条件 |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `intelephense` | 默认。工作区根:`composer.json`、`.phpactor.json` 或 `index.php`。 |
| `phpactor` | 备选:仅在未安装 Intelephense 时使用。 |
| `phoxite` | 备选,自带 Laravel 和 Blade 支持:仅在以上两个服务器都未安装时使用,或在 **设置 › 语言和框架 › 语言服务器** 中选中它时使用。 |
| `laravel-lsp` | 仅限 Laravel 项目(`artisan` 文件所在目录之下):在 `config('…')`、`route('…')`、`view('…')` 中提供悬停、跳转和补全。 |
Phoxite 为项目提供服务时不会启动 `laravel-lsp`:Laravel 相关的字符串由 Phoxite 自己处理。
Intelephense 会按项目的 PHP 版本检查代码(见下文“语言级别”),并索引你配置的 stub 和包含路径。
@@ -25,6 +28,7 @@ Intelephense 会按项目的 PHP 版本检查代码(见下文“语言级别
| ------------------ | -------------------------------------------------- |
| Intelephense | npm(`intelephense`) |
| Laravel LSP | GitHub release(`laravel/lsp`) |
| Phoxite | GitHub release(`samehelhawary/phoxite`) |
| PHP Debug (Xdebug) | Open VSX(`xdebug.php-debug`),运行时需要 Node.js |
| phpactor | IDE 不负责安装,请自行安装并放到 `PATH` 上 |
@@ -77,12 +81,12 @@ PHPUnit 运行配置类型包含 **目标**、**配置文件**、**测试过滤
## 框架支持
- **Laravel**:Laravel LSP 支持 `config()`、`route()`、`view()` 中的字符串,并提供 `artisan serve` 运行配置。
- **Laravel**:Laravel LSP 支持 `config()`、`route()`、`view()` 中的字符串,并提供 `artisan serve` 运行配置。以 Phoxite 作为 PHP 服务器时,路由、视图、配置、翻译和 Eloquent 模型的补全、跳转和重命名改由它提供。
- **WordPress** 等平台:在 **附加存根** 中加入对应 stub,在 **包含路径** 中加入平台代码目录。
## 已知限制
- 不支持 Blade 或 Twig 模板,只有 `.php` 文件有 PHP 代码智能。
- 使用 Intelephense 时不支持 Blade 或 Twig 模板,只有 `.php` 文件有 PHP 代码智能。Phoxite 为 `.blade.php` 文件提供代码智能,但没有 Blade 语法高亮。
- IDE 不会安装 phpactor。
- PHPUnit 不支持使用覆盖率运行。
- 调试需要 PHP 已安装 Xdebug 扩展,IDE 不负责安装。
+11
Переглянути файл
@@ -26,6 +26,17 @@ args = ["language-server"]
root-markers = ["composer.json", ".phpactor.json"]
install-hint = "Install phpactor (https://phpactor.readthedocs.io/en/master/usage/standalone.html)"
# Alternative with its own Laravel and Blade support. https://github.com/samehelhawary/phoxite
[[language-servers]]
name = "phoxite"
fallback = true
command = "phoxite-lsp"
args = []
root-markers = ["composer.json", "artisan", "index.php"]
# It answers the Laravel strings itself.
replaces = ["laravel-lsp"]
install-hint = "Install phoxite-lsp from https://github.com/samehelhawary/phoxite/releases and put it on PATH"
# Laravel projects only: hover, definition and completion inside
# config('…'), route('…') and view('…'). Last: Intelephense keeps PHP hover,
# rename and symbols. https://github.com/laravel/lsp
+14
Переглянути файл
@@ -290,6 +290,20 @@ export const documentSynced = Facet.define<() => Promise<void>, (() => Promise<v
combine: (values) => values[0] ?? null,
});
/**
* Undo / Redo of an editor whose history is kept outside CodeMirror (notebook cells share
* the notebook's backend history). Commands that would call CodeMirror's history (Vim's
* `u` / `Ctrl-R`) go through it instead.
*/
export interface ExternalHistory {
undo(): void;
redo(): void;
}
export const externalHistory = Facet.define<ExternalHistory, ExternalHistory | null>({
combine: (values) => values[0] ?? null,
});
export function whenSynced(view: EditorView): Promise<void> {
return view.state.facet(documentSynced)?.() ?? Promise.resolve();
}
+25 -2
Переглянути файл
@@ -75,7 +75,7 @@ import { resetAllEditorsFontZoom, stepAllEditorsFontZoom } from "./cm/prefs";
import { useProject } from "@/platform/project";
import { call, commands } from "@/platform/ipc";
import { editorPrefs } from "@/platform/editorSettings";
import { notifications } from "@/workbench/contributions";
import { menuGroupItems, notifications } from "@/workbench/contributions";
import { togglePinSelectedContent } from "@/workbench/toolwindows/content";
import { useToolWindowLayout } from "@/workbench/toolwindows/store";
import { toggleReadOnly } from "./fileAttributes";
@@ -529,7 +529,29 @@ function copyReference(reference: Promise<string>) {
function copyPathReferencePopup(view: EditorView, slot: EditorSlot) {
const path = slot.model.path;
const line = view.state.doc.lineAt(view.state.selection.main.head).number;
const { doc, selection } = view.state;
const line = doc.lineAt(selection.main.head).number;
const { from, to } = selection.main;
// The selected lines, leaving out the one a selection ends at the start of.
const first = doc.lineAt(from).number;
const last = Math.max(first, doc.lineAt(to).number - (to > from && doc.lineAt(to).from === to ? 1 : 0));
const contributed = menuGroupItems("copyPath", {
paths: [path],
line: first - 1,
endLine: last > first ? last - 1 : undefined,
}).flatMap((item) =>
(item.kind ?? "item") === "item" && "run" in item && item.id && item.run && item.preview
? [
{
id: item.id,
label: item.verbatim ? item.label : tx(item.label),
preview: item.preview,
shortcut: shortcutLabel(item.id),
run: item.run,
},
]
: [],
);
const flavours = [
{ id: "project.copyAbsolutePath", label: "Absolute Path", value: pathToCopy("absolute", path) },
{ id: "project.copyFileName", label: "File Name", value: pathToCopy("name", path) },
@@ -557,6 +579,7 @@ function copyPathReferencePopup(view: EditorView, slot: EditorSlot) {
void executeAction(f.id, f.id === "editor.copyPathWithLineNumber" ? f.value : path);
},
})),
...contributed,
{
id: "editor.copyReference",
label: tx("Reference"),
+5 -2
Переглянути файл
@@ -1,4 +1,7 @@
import { tags as t, type styleTags } from "@lezer/highlight";
/** @lezer/javascript styles `.` as a deref operator, but not `?.`. */
export const JS_TAGS: Parameters<typeof styleTags>[0] = { "?.": t.derefOperator };
/**
* @lezer/javascript styles `.` as a deref operator, but not `?.`; it tags `this` as `self` (Python's
* `self` colour) and `super` as an atom, which WebStorm colours as keywords.
*/
export const JS_TAGS: Parameters<typeof styleTags>[0] = { "?.": t.derefOperator, "this super": t.keyword };
+25
Переглянути файл
@@ -270,6 +270,31 @@ describe("language modes", () => {
}
});
it("colours `this` and `super` as keywords in Java, JavaScript, TypeScript and C++", async () => {
const highlighter = tagHighlighter([
{ tag: t.keyword, class: "keyword" },
{ tag: t.self, class: "self" },
{ tag: t.atom, class: "atom" },
]);
for (const [mode, path, doc, expected] of [
["Java", "/p/A.java", "class A extends B { A() { super(); this.a = 1; } }", ["super", "this"]],
["JavaScript", "/p/a.js", "class A extends B { m() { super.m(); this.a = 1; } }", ["super", "this"]],
["TypeScript", "/p/a.ts", "class A extends B { m() { super.m(); this.a = 1; } }", ["super", "this"]],
["C++", "/p/a.cpp", "void A::m() { this->a = 1; }", ["this"]],
] as const) {
const support = await loadSupport(findLanguageDescription(mode, path)!);
const found: Array<[string, string]> = [];
highlightTree(support!.language.parser.parse(doc), highlighter, (from, to, style) =>
found.push([doc.slice(from, to), style]),
);
const words = new Set<string>(expected);
expect(
found.filter(([text]) => words.has(text)),
mode,
).toEqual(expected.map((word) => [word, "keyword"]));
}
});
it("recognizes go.mod and go.work files by mode and filename", async () => {
for (const [mode, path] of [
["GoMod", "/project/go.mod"],
+5 -1
Переглянути файл
@@ -293,9 +293,11 @@ const CSS_TAGS: Parameters<typeof styleTags>[0] = {
"ClassName IdName PseudoClassName ColorLiteral CallTag": t.tagName,
};
// @lezer/java tags annotations as plain identifiers.
// @lezer/java tags annotations as plain identifiers, and `this` as `self` (Python's `self` colour);
// IntelliJ colours `this` as a keyword.
export const JAVA_TAGS: Parameters<typeof styleTags>[0] = {
"MarkerAnnotation/Identifier Annotation/Identifier MarkerAnnotation Annotation": t.annotation,
this: t.keyword,
};
/** Highlighting the stock grammars lack or colour unlike IntelliJ. */
@@ -306,6 +308,8 @@ const EXTRA_TAGS: Record<string, Parameters<typeof styleTags>[0]> = {
JSX: JS_TAGS,
TSX: JS_TAGS,
Java: JAVA_TAGS,
// CLion colours `this` as a keyword.
"C++": { this: t.keyword },
PHP: {
"; ,": t.separator,
"ClassDeclaration/Name BaseClause/Name InterfaceClause/Name": t.className,
+39 -1
Переглянути файл
@@ -10,7 +10,7 @@ import { LspPopups } from "@/editor/lsp/Popups";
import { registerProjectActions } from "@/features/project-tree/actions";
import { useProjectTree } from "@/features/project-tree/store";
import { useContextMenuStore } from "@/ui";
import { provideNotificationService } from "@/workbench/contributions";
import { provideNotificationService, registerMenuGroup, type MenuGroupContext } from "@/workbench/contributions";
import * as controller from "./controller";
import { createMemoryBackend } from "./backend";
import { registerEditorActions } from "./actions";
@@ -189,6 +189,44 @@ describe("editor Copy Path/Reference chooser", () => {
expect(useLspPopup.getState().popup).toBeNull();
});
it("lists contributed links before Reference, for the selected lines", async () => {
const contexts: MenuGroupContext[] = [];
const run = vi.fn();
disposers.push(
registerMenuGroup({
id: "test.link",
menus: ["copyPath"],
items: (_menu, ctx) => {
contexts.push(ctx);
return [{ id: "test.copyLink", label: "Host Link", verbatim: true, preview: "https://host/a#L1", run }];
},
}),
);
const view = ctrl.activeSlot!.view!;
await executeAction("editor.copyPathReference");
expect(
popup()
.items.map((item) => item.label)
.slice(-2),
).toEqual(["Host Link", "Reference"]);
expect(popup().items.at(-2)).toMatchObject({
preview: "https://host/a#L1",
shortcut: shortcutLabel("test.copyLink"),
});
await popup().items.at(-2)!.run();
expect(run).toHaveBeenCalledOnce();
// From the first line into the second; then ending at the start of the second line.
view.dispatch({ selection: { anchor: 0, head: documentText.indexOf("A {}") } });
await executeAction("editor.copyPathReference");
view.dispatch({ selection: { anchor: 0, head: documentText.indexOf("class") } });
await executeAction("editor.copyPathReference");
expect(contexts.map(({ paths, line, endLine }) => [paths, line, endLine])).toEqual([
[[path], 1, undefined],
[[path], 0, 1],
[[path], 0, undefined],
]);
});
it("adds the chooser to Copy / Paste Special", () => {
vi.spyOn(ctrl.activeSlot!.view!, "posAtCoords").mockReturnValue(null);
ctrl.onContextMenu(ctrl.activeSlot!, new MouseEvent("contextmenu"));
+8 -8
Переглянути файл
@@ -74,7 +74,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 0 6px 0 8px;
}
.pin {
@@ -89,7 +89,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-height: 36px;
padding: 0 12px;
background: var(--bg-editor-banner, color-mix(in srgb, var(--accent) 7%, var(--bg-editor, var(--bg-elev))));
@@ -133,8 +133,8 @@
display: grid;
grid-template-columns: minmax(220px, 420px) auto 1fr;
align-items: center;
column-gap: 6px;
row-gap: 6px;
column-gap: var(--space-1-5);
row-gap: var(--space-1-5);
padding: 6px 8px 6px 10px;
background: var(--bg-editor-inline, var(--bg-elev));
border-bottom: 1px solid var(--border-editor-tabs, var(--border));
@@ -155,7 +155,7 @@
.findButtons {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
}
.findCount {
font-size: var(--fs-ui);
@@ -173,14 +173,14 @@
.replaceButtons {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
/* Go to line */
.gotoBody {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 8px 16px 0;
}
.gotoHint {
@@ -316,7 +316,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
height: 26px;
padding: 0 8px;
overflow: hidden;
+1 -1
Переглянути файл
@@ -115,7 +115,7 @@ function EmptyEditorArea() {
return (
<div ref={ref} className={styles.area}>
<EmptyEditor />
{over && <div className={clsx(styles.dropZone, styles["drop-center"])} aria-hidden="true" />}
{over && <div className={styles.dropZone} aria-hidden="true" />}
</div>
);
}
+2 -2
Переглянути файл
@@ -58,7 +58,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: var(--h-list-row);
padding: 0 6px;
border-radius: var(--radius-row);
@@ -87,7 +87,7 @@
.childHeader {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: var(--h-list-row);
padding: 0 6px;
margin-bottom: 2px;
+10 -10
Переглянути файл
@@ -11,7 +11,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 0 12px;
font-size: var(--fs-ui);
font-weight: 600;
@@ -96,7 +96,7 @@
.item {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
width: 100%;
font-size: var(--fs-ui);
@@ -263,7 +263,7 @@
bottom: 0;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 2px 6px;
border-top: 1px solid var(--border-popup);
background: var(--bg-popup);
@@ -283,7 +283,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 0 6px 0 12px;
background: var(--bg-popup-inline, var(--bg-elev));
border-bottom: 1px solid var(--border-popup);
@@ -342,7 +342,7 @@
height: var(--h-row);
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 0 14px;
font-size: var(--fs-ui);
}
@@ -368,7 +368,7 @@
flex: none;
display: flex;
align-items: flex-start;
gap: 6px;
gap: var(--space-1-5);
padding: 10px 14px 0;
font-size: var(--fs-ui);
color: var(--fg-muted);
@@ -421,7 +421,7 @@
border: 0;
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
.reformatLegend {
margin-bottom: 6px;
@@ -432,21 +432,21 @@
.reformatOption {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
font-size: var(--fs-ui);
}
.pasteImports {
display: flex;
flex-direction: column;
gap: 12px;
gap: var(--space-3);
padding: 14px;
font-size: var(--fs-ui);
}
.pasteImportList {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
max-height: 280px;
overflow: auto;
overflow-wrap: anywhere;
+3 -3
Переглянути файл
@@ -19,7 +19,7 @@
flex: none;
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
.targets {
@@ -41,7 +41,7 @@
display: grid;
grid-template-columns: 1fr 110px;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 0 8px;
min-height: var(--h-list-row);
}
@@ -88,6 +88,6 @@
.busy {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
color: var(--fg-muted);
}
+10 -10
Переглянути файл
@@ -35,7 +35,7 @@
.agentRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
width: 100%;
min-width: 0;
padding: 0 8px;
@@ -69,7 +69,7 @@
.registryState {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 6px 12px;
border-top: 1px solid var(--border);
color: var(--fg-muted);
@@ -79,7 +79,7 @@
.customActions {
display: flex;
flex-wrap: wrap;
gap: 6px;
gap: var(--space-1-5);
padding: 8px;
border-top: 1px solid var(--border);
}
@@ -116,7 +116,7 @@
.facts {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
margin-top: 2px;
color: var(--fg-muted);
@@ -143,12 +143,12 @@
.actions {
display: flex;
flex: none;
gap: 6px;
gap: var(--space-1-5);
}
.progress {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
max-width: 360px;
margin: 10px 0 0 34px;
}
@@ -182,7 +182,7 @@
}
.links {
display: flex;
gap: 12px;
gap: var(--space-3);
}
.link {
padding: 0;
@@ -209,7 +209,7 @@
.sectionTitle {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
height: 22px;
margin-bottom: 4px;
color: var(--fg-strong);
@@ -244,7 +244,7 @@
grid-template-columns: minmax(150px, max-content) minmax(0, 1fr);
align-items: center;
column-gap: 10px;
row-gap: 4px;
row-gap: var(--space-1);
min-width: 0;
}
.label {
@@ -278,7 +278,7 @@
display: flex;
flex: 1;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-width: 0;
max-width: 480px;
}
+1 -1
Переглянути файл
@@ -575,7 +575,7 @@ function Details({
{job && (
<div className={styles.progress}>
<ProgressBar value={job.fraction} aria-label={tx`Installing ${agent.name}`} />
<span className={styles.hint}>{job.message}</span>
<span>{job.message}</span>
</div>
)}
{!job && installed && update && <p className={styles.notice}>{tx`${update} is available`}</p>}
+6 -6
Переглянути файл
@@ -18,14 +18,14 @@
min-height: 0;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 12px;
gap: var(--space-3);
}
.column {
min-height: 0;
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 10px;
border: 1px solid var(--border-strong);
border-radius: var(--radius-control);
@@ -42,7 +42,7 @@
min-height: 120px;
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
overflow: auto;
}
@@ -50,9 +50,9 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
gap: var(--space-1-5);
padding: 4px 8px;
background: var(--bg-subtle);
background: var(--bg-hover);
border-radius: var(--radius-control);
font-family: var(--font-mono);
font-size: var(--fs-small);
@@ -65,7 +65,7 @@
.add {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.input {
+1 -1
Переглянути файл
@@ -1,7 +1,7 @@
.body {
display: flex;
flex-direction: column;
gap: 12px;
gap: var(--space-3);
height: 100%;
min-height: 0;
}
+7 -7
Переглянути файл
@@ -31,7 +31,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
}
@@ -105,7 +105,7 @@
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
gap: var(--space-1);
padding: 24px 12px;
color: var(--fg-muted);
}
@@ -154,7 +154,7 @@
.dockedBar {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 2px 8px;
border-bottom: 1px solid var(--border);
}
@@ -215,7 +215,7 @@
padding: 4px 12px 8px;
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
}
.external > .row {
flex: none;
@@ -225,7 +225,7 @@
.chooser {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.chooserList {
height: 312px;
@@ -242,14 +242,14 @@
.chooserRow {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
width: 100%;
}
.chooserFooter {
display: flex;
align-items: center;
gap: 12px;
gap: var(--space-3);
}
.chooserFolder {
flex: 0 0 auto;
+12 -12
Переглянути файл
@@ -75,7 +75,7 @@
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
gap: var(--space-2);
border-radius: inherit;
background: color-mix(in srgb, var(--bg-popup) 82%, transparent);
color: var(--fg-strong);
@@ -85,7 +85,7 @@
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 4px 6px 6px;
cursor: default;
}
@@ -95,13 +95,13 @@
flex-wrap: wrap;
align-items: center;
min-width: 0;
gap: 2px;
gap: var(--space-0-5);
}
.actions {
display: flex;
flex: none;
align-items: center;
gap: 4px;
gap: var(--space-1);
margin-left: auto;
}
/* Attach/reference buttons share the send button's 24px footprint and chrome. */
@@ -135,7 +135,7 @@
display: grid;
grid-template-columns: minmax(0, 80px) minmax(0, 1fr);
align-items: center;
gap: 12px;
gap: var(--space-3);
margin-top: 8px;
}
.settingsLabel {
@@ -147,7 +147,7 @@
.chip {
display: inline-flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: var(--h-control);
min-width: 0;
padding: 0 4px 0 6px;
@@ -229,7 +229,7 @@
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
gap: var(--space-3);
}
.effortValue {
color: var(--fg-strong);
@@ -295,7 +295,7 @@
.modeOption {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 24px;
margin: 0 6px;
padding: 0 8px;
@@ -318,7 +318,7 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
gap: var(--space-3);
margin-top: 6px;
padding: 8px 14px 2px;
border-top: 1px solid var(--border);
@@ -329,7 +329,7 @@
.bar {
flex-direction: row;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.toolbar {
flex-wrap: nowrap;
@@ -392,7 +392,7 @@
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 8px 10px 0;
cursor: default;
}
@@ -539,7 +539,7 @@
.popupFooter {
display: flex;
flex-wrap: wrap;
gap: 4px 14px;
gap: var(--space-1) 14px;
padding: 5px 12px 6px;
border-top: 1px solid var(--border);
color: var(--fg-subtle);
+4 -4
Переглянути файл
@@ -15,7 +15,7 @@
width: min(var(--agent-conversation-width), 100%);
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.fitWidth .inner {
width: 100%;
@@ -35,7 +35,7 @@
flex-wrap: wrap;
align-items: center;
/* The chips' own padding spaces them. */
gap: 2px;
gap: var(--space-0-5);
padding: 0 2px;
font-size: var(--fs-small);
}
@@ -66,7 +66,7 @@
padding: 16px 12px 12px;
}
.docked .inner {
gap: 8px;
gap: var(--space-2);
}
.docked .where {
flex-wrap: nowrap;
@@ -95,7 +95,7 @@
.notes {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
height: 0;
}
.docked .notes {
+11 -17
Переглянути файл
@@ -10,13 +10,13 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
gap: var(--space-3);
}
.headerActions {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.title {
@@ -52,7 +52,7 @@
.error {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 6px 8px;
border-radius: var(--radius-control);
background: color-mix(in srgb, var(--danger) 12%, transparent);
@@ -63,7 +63,7 @@
.notice {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 6px 8px;
border-radius: var(--radius-control);
background: var(--accent-soft);
@@ -89,13 +89,13 @@
justify-content: space-between;
min-height: 32px;
padding: 2px 4px;
gap: 8px;
gap: var(--space-2);
}
.sectionToggle {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
flex: 1;
min-width: 0;
padding: 4px 2px;
@@ -143,12 +143,6 @@
padding: 2px 0 6px;
}
.emptySection {
padding: 6px 24px 8px;
color: var(--fg-muted);
font-size: var(--fs-small);
}
.sectionNote {
margin: 0;
padding: 2px 24px 6px;
@@ -161,7 +155,7 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
gap: var(--space-3);
padding: 6px 8px 6px 22px;
border-radius: var(--radius-control);
}
@@ -173,7 +167,7 @@
.rowMain {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
min-width: 0;
flex: 1;
}
@@ -197,7 +191,7 @@
.rowActions {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
flex-shrink: 0;
}
@@ -206,7 +200,7 @@
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
align-items: start;
gap: 10px 12px;
gap: 10px var(--space-3);
padding: 12px 16px 4px;
}
@@ -223,7 +217,7 @@
.formControl {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
min-width: 0;
}
+3 -3
Переглянути файл
@@ -2,7 +2,7 @@
.chip {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
max-width: 100%;
height: 20px;
padding: 0 6px 0 4px;
@@ -126,7 +126,7 @@
.cardHead {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 6px 10px;
}
.cardPath {
@@ -201,7 +201,7 @@
.codeHead {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 26px;
padding: 0 4px 0 8px;
border-bottom: 1px solid var(--border);
+79 -54
Переглянути файл
@@ -91,7 +91,7 @@
flex-wrap: wrap;
/* The changes chip sits above the line; the facts stay on that line's baseline. */
align-items: flex-end;
gap: 2px 6px;
gap: var(--space-0-5) var(--space-1-5);
min-width: 0;
padding: 0 2px;
overflow: hidden;
@@ -104,7 +104,7 @@
flex: 0 1 auto;
max-width: 100%;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: 22px;
min-width: 0;
color: var(--fg-secondary);
@@ -122,7 +122,7 @@
max-width: 100%;
align-items: center;
/* The chips' own padding spaces them. */
gap: 2px;
gap: var(--space-0-5);
min-width: 0;
overflow: hidden;
}
@@ -144,7 +144,7 @@
flex: 1 1 auto;
flex-wrap: wrap;
align-items: center;
gap: 2px 8px;
gap: var(--space-0-5) var(--space-2);
min-width: 0;
}
/* Shrinks before the terminal buttons do: in a narrow docked session the meters clip, not the controls. */
@@ -154,7 +154,7 @@
margin-left: auto;
align-items: center;
height: 22px;
gap: 8px;
gap: var(--space-2);
max-width: 100%;
min-width: 0;
overflow: hidden;
@@ -163,13 +163,13 @@
display: flex;
flex: none;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
}
/* What changed (files, commits) above the meters; both open the Changes pane. */
.statusChips {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
max-width: 100%;
min-width: 0;
}
@@ -177,7 +177,7 @@
composes: surface from "../../ui/Chip.module.css";
display: inline-flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
max-width: 100%;
min-width: 0;
padding: 0 8px;
@@ -207,6 +207,31 @@
color: var(--fg-subtle);
}
/* The archived-task notice: an editor notification banner above the conversation. */
.banner {
flex: none;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: var(--space-1) var(--space-2);
min-height: 36px;
padding: 9px 12px;
background: var(--bg-feedback-warning);
border-bottom: 1px solid var(--border-feedback-warning);
color: var(--fg-strong);
}
.bannerText {
flex: 1 1 240px;
min-width: 0;
max-height: 33vh;
overflow-y: auto;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.bannerSpacer {
flex: 1;
}
/* The conversation with its find bar. */
.streamArea {
min-width: 0;
@@ -320,7 +345,7 @@
.messageFooter {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-height: var(--h-control-small);
max-width: 100%;
flex-wrap: wrap;
@@ -378,7 +403,7 @@
}
.messageActions {
display: inline-flex;
gap: 4px;
gap: var(--space-1);
max-width: 100%;
flex-wrap: wrap;
opacity: 0;
@@ -442,7 +467,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 4px 8px;
border-bottom: 1px solid var(--border);
}
@@ -498,14 +523,14 @@
.editBar {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
margin-top: 6px;
font-size: var(--fs-small);
}
.editButtons {
display: flex;
gap: 6px;
gap: var(--space-1-5);
margin-left: auto;
}
@@ -735,7 +760,7 @@
.thought summary {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-width: 0;
height: var(--h-row);
color: var(--fg-muted);
@@ -773,7 +798,7 @@
.tool {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
box-sizing: border-box;
min-height: var(--h-row);
@@ -828,7 +853,7 @@
.processSummary {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
width: 100%;
max-width: 100%;
box-sizing: border-box;
@@ -876,7 +901,7 @@
.processBody {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
max-height: calc(var(--h-row) * 16);
overflow-y: auto;
margin-top: 2px;
@@ -900,7 +925,7 @@
.plan {
display: grid;
gap: 2px;
gap: var(--space-0-5);
}
.planTitle {
font-weight: 600;
@@ -909,7 +934,7 @@
.planItem {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.planDone {
color: var(--fg-muted);
@@ -1017,7 +1042,7 @@
.error {
display: flex;
gap: 6px;
gap: var(--space-1-5);
align-items: flex-start;
color: var(--danger);
white-space: pre-wrap;
@@ -1027,7 +1052,7 @@
.working {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
color: var(--fg-muted);
}
@@ -1049,7 +1074,7 @@
flex: none;
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
align-self: center;
width: 100%;
max-width: calc(var(--session-content-width) + var(--space-3) * 2);
@@ -1060,12 +1085,12 @@
.background {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.backgroundTask {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 24px;
padding: 0 4px 0 8px;
border-radius: var(--radius-row);
@@ -1085,12 +1110,12 @@
.queue {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.queued {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 28px;
padding: 0 4px 0 8px;
border-radius: var(--radius-row);
@@ -1145,7 +1170,7 @@
.images {
display: flex;
flex-wrap: wrap;
gap: 6px;
gap: var(--space-1-5);
margin-top: 4px;
}
.imageItem {
@@ -1185,14 +1210,14 @@
.attachments {
display: flex;
flex-wrap: wrap;
gap: 4px 6px;
gap: var(--space-1) var(--space-1-5);
margin-top: 4px;
font-size: var(--fs-small);
}
.attachment {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
}
.changes {
@@ -1225,7 +1250,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 32px;
flex: none;
padding: 0 6px 0 10px;
@@ -1270,7 +1295,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
}
.changeName {
flex: 0 1 auto;
@@ -1302,7 +1327,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.changeGroupName {
min-width: 0;
@@ -1317,7 +1342,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.changeCommitHash {
flex: none;
@@ -1348,7 +1373,7 @@
.subagent {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
padding: 6px 8px;
border: 1px solid var(--border);
border-radius: var(--radius-small);
@@ -1357,7 +1382,7 @@
.subagentHead {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-width: 0;
}
.subagentOpen {
@@ -1365,7 +1390,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 2px 4px;
margin: -2px -4px;
border: 0;
@@ -1441,7 +1466,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 30px;
padding: 0 8px 0 6px;
border-bottom: 1px solid var(--border);
@@ -1452,7 +1477,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
overflow: hidden;
}
.crumb {
@@ -1498,12 +1523,12 @@
.subagentStrip {
display: flex;
flex-wrap: wrap;
gap: 4px;
gap: var(--space-1);
}
.subagentChip {
display: inline-flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
max-width: 240px;
height: 22px;
padding: 0 8px;
@@ -1531,7 +1556,7 @@
flex: none;
display: flex;
flex-direction: column;
gap: 12px;
gap: var(--space-3);
max-height: 50vh;
overflow-y: auto;
/* The composer's width, so the card sits exactly over the box it belongs to. */
@@ -1573,7 +1598,7 @@
.question {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
min-width: 0;
margin: 0;
padding: 0;
@@ -1607,7 +1632,7 @@
.questionChoices {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
.question .questionChoices > * {
border: 1px solid var(--border);
@@ -1633,7 +1658,7 @@
.questionChoice {
display: flex;
align-items: flex-start;
gap: 8px;
gap: var(--space-2);
}
.questionOptionText {
display: flex;
@@ -1663,19 +1688,19 @@
.questionBody {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
.questionChoices {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
min-width: 0;
}
@container question-card (min-width: 640px) {
.questionBodyWithPreview {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 12px;
gap: var(--space-3);
align-items: start;
}
.questionBodyWithPreview .questionPreview {
@@ -1691,7 +1716,7 @@
display: flex;
flex-direction: column;
grid-area: 1 / 1;
gap: 4px;
gap: var(--space-1);
min-width: 0;
visibility: hidden;
}
@@ -1724,12 +1749,12 @@
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 8px;
gap: var(--space-2);
}
.questionPager {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.questionPage {
color: var(--fg-subtle);
@@ -1771,7 +1796,7 @@
.tray {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.tray:empty {
display: none;
@@ -1783,12 +1808,12 @@
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px;
gap: var(--space-1);
}
.trayChip {
display: inline-flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: var(--h-row);
padding: 0 var(--space-2);
border: none;
@@ -1807,7 +1832,7 @@
.trayPlan {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
padding: 2px var(--space-2) 4px calc(var(--space-2) * 2);
font-size: var(--fs-small);
}
+6 -6
Переглянути файл
@@ -16,13 +16,13 @@
.activity {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.after {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.seconds {
@@ -35,7 +35,7 @@
min-height: 120px;
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
padding: 8px;
overflow: auto;
border: 1px solid var(--border-strong);
@@ -46,9 +46,9 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
gap: var(--space-1-5);
padding: 4px 8px;
background: var(--bg-subtle);
background: var(--bg-hover);
border-radius: var(--radius-control);
}
@@ -64,7 +64,7 @@
.add {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.input {
+12 -12
Переглянути файл
@@ -18,7 +18,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
height: var(--h-row);
padding: 0 10px;
border-bottom: 1px solid var(--border);
@@ -39,7 +39,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
@@ -115,7 +115,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
width: 100%;
height: var(--h-row);
padding: 0 8px;
@@ -163,7 +163,7 @@
.scope {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
margin: 0;
padding: 0;
border: 0;
@@ -176,7 +176,7 @@
.radioRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 3px 0;
color: var(--fg);
cursor: default;
@@ -187,7 +187,7 @@
}
.dirRow {
display: flex;
gap: 6px;
gap: var(--space-1-5);
padding: 4px 0 0 22px;
}
.grow {
@@ -197,7 +197,7 @@
.fieldRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.languageSelect {
min-width: 180px;
@@ -245,7 +245,7 @@
.previewItem {
display: flex;
align-items: flex-start;
gap: 8px;
gap: var(--space-2);
padding: 4px 8px;
border-bottom: 1px solid var(--border);
}
@@ -257,7 +257,7 @@
flex: 1;
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.previewWhere {
color: var(--fg-subtle);
@@ -298,7 +298,7 @@
.details {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 10px 12px;
overflow: auto;
border-left: 1px solid var(--border);
@@ -312,7 +312,7 @@
.detailsTitle {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
color: var(--fg-strong);
}
.detailsMessage {
@@ -322,5 +322,5 @@
}
.detailsActions {
display: flex;
gap: 6px;
gap: var(--space-1-5);
}
+3 -3
Переглянути файл
@@ -1,19 +1,19 @@
.body {
display: flex;
flex-direction: column;
gap: 16px;
gap: var(--space-4);
padding: 20px;
}
.field {
display: grid;
grid-template-columns: 80px 1fr;
align-items: center;
gap: 12px;
gap: var(--space-3);
}
.row {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
}
.row > input {
+2
Переглянути файл
@@ -499,6 +499,7 @@ describe("launch", () => {
path: "/x/b.txt",
left: { type: "file", path: "/x/a.txt", label: "/x/a.txt" },
right: { type: "worktree", label: "/x/b.txt" },
swappable: true,
},
]);
});
@@ -514,6 +515,7 @@ describe("launch", () => {
path: "/p/b.txt",
left: { type: "file", path: "/p/a.txt", label: "a.txt" },
right: { type: "worktree", label: "b.txt" },
swappable: true,
},
]);
});
+9 -9
Переглянути файл
@@ -14,7 +14,7 @@
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
line-height: 1.55;
}
.productName {
@@ -37,7 +37,7 @@
}
.fact {
display: flex;
gap: 4px;
gap: var(--space-1);
min-width: 0;
}
.fact dt {
@@ -57,7 +57,7 @@
.links {
display: flex;
flex-wrap: wrap;
gap: 4px 16px;
gap: var(--space-1) var(--space-4);
}
.link {
padding: 0;
@@ -94,7 +94,7 @@
.keymapBar {
display: flex;
align-items: center;
gap: 12px;
gap: var(--space-3);
padding: 8px 12px;
border-bottom: 1px solid var(--border-popup);
}
@@ -139,7 +139,7 @@
.keymapRow {
display: flex;
align-items: center;
gap: 12px;
gap: var(--space-3);
min-height: var(--h-row);
padding: 0 4px;
border-radius: var(--radius-row);
@@ -157,13 +157,13 @@
.keymapKeys {
flex: none;
display: flex;
gap: 4px;
gap: var(--space-1);
}
.invalidateBody {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 14px;
color: var(--fg);
font-size: var(--fs-ui);
@@ -185,13 +185,13 @@
.importSummary {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.importList {
margin: 0;
display: grid;
grid-template-columns: max-content 1fr;
gap: 2px 16px;
gap: var(--space-0-5) var(--space-4);
}
.importList dt {
color: var(--fg-muted);
+2
Переглянути файл
@@ -78,7 +78,9 @@ export function appActions(): Action[] {
id,
title: t(key),
category: t("app.category.edit"),
// The native ⌘C / Ctrl+C keep working unbound; listed so another key can be added (IDEA's $Copy…).
hidden: true,
keymap: true,
run: editCommand(command),
});
return [
+7 -7
Переглянути файл
@@ -31,7 +31,7 @@
.entry {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
width: 100%;
height: 26px;
padding: 0 8px;
@@ -68,7 +68,7 @@
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
align-items: center;
gap: 8px 12px;
gap: var(--space-2) var(--space-3);
}
.label {
color: var(--fg);
@@ -76,7 +76,7 @@
}
.inline {
display: flex;
gap: 8px;
gap: var(--space-2);
}
.inline > :first-child {
flex: 1;
@@ -103,7 +103,7 @@
.missing {
display: flex;
align-items: flex-start;
gap: 8px;
gap: var(--space-2);
padding: 8px 10px;
border: 1px solid var(--border-feedback-warning);
border-radius: var(--radius-control, 4px);
@@ -136,17 +136,17 @@
.dependencies {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
.chips {
display: flex;
flex-wrap: wrap;
gap: 4px;
gap: var(--space-1);
}
.chip {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: 22px;
padding: 0 6px 0 8px;
border: 1px solid var(--border);
+8 -8
Переглянути файл
@@ -9,7 +9,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 0 6px;
}
.sep {
@@ -22,7 +22,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 28px;
padding: 2px 10px;
font-size: var(--fs-small);
@@ -57,14 +57,14 @@
.loading {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 12px;
color: var(--fg-muted);
}
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
@@ -110,7 +110,7 @@
.popupHeader {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
height: var(--h-row);
padding: 4px 10px 0;
font-size: var(--fs-small);
@@ -124,7 +124,7 @@
.inputRow {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 6px 10px;
border-bottom: 1px solid var(--border-popup);
}
@@ -164,7 +164,7 @@
.completion {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
flex: 1;
}
@@ -196,7 +196,7 @@
.popupFooter {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 6px 10px;
border-top: 1px solid var(--border-popup);
font-size: var(--fs-small);
+7 -7
Переглянути файл
@@ -10,7 +10,7 @@
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
gap: var(--space-1-5);
min-height: 36px;
padding: 4px 8px;
border-bottom: 1px solid var(--border);
@@ -37,7 +37,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 28px;
padding: 2px 10px;
font-size: var(--fs-small);
@@ -74,7 +74,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
@@ -124,7 +124,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 32px;
padding: 0 10px;
border-bottom: 1px solid var(--border);
@@ -142,7 +142,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 6px 10px;
font-size: var(--fs-small);
color: var(--fg-secondary);
@@ -162,7 +162,7 @@
.usageHeader {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 26px;
}
.usageVersion {
@@ -190,7 +190,7 @@
.step {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 22px;
white-space: nowrap;
}
+1 -1
Переглянути файл
@@ -22,7 +22,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
+2 -2
Переглянути файл
@@ -14,7 +14,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 0 6px;
}
.sep {
@@ -43,7 +43,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
+1 -1
Переглянути файл
@@ -29,7 +29,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
+1 -1
Переглянути файл
@@ -50,7 +50,7 @@
.line {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
min-height: 24px;
}
.name {
+1 -1
Переглянути файл
@@ -1,7 +1,7 @@
.toolbar {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 3px 6px;
flex-shrink: 0;
}
+2 -2
Переглянути файл
@@ -9,7 +9,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 0 10px;
border-bottom: 1px solid var(--border-popup);
font-size: var(--fs-small);
@@ -62,7 +62,7 @@
.row {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
width: 100%;
}
+3 -3
Переглянути файл
@@ -14,7 +14,7 @@
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 4px 0;
border-right: 1px solid var(--border);
}
@@ -29,7 +29,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 0 10px;
font-size: var(--fs-ui);
color: var(--fg-subtle);
@@ -72,7 +72,7 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
+3 -3
Переглянути файл
@@ -46,7 +46,7 @@
bottom: 0;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
width: 104px;
height: 54px;
padding: 0 10px;
@@ -79,7 +79,7 @@
min-width: 0;
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
color: var(--fg-muted);
font-size: var(--fs-small);
text-align: center;
@@ -111,7 +111,7 @@
.recent {
display: grid;
grid-template-columns: repeat(10, minmax(0, 1fr));
gap: 8px 5px;
gap: var(--space-2) 5px;
margin: 12px 12px 0;
padding-top: 10px;
border-top: 1px solid var(--border);
+6 -6
Переглянути файл
@@ -20,7 +20,7 @@
display: grid;
grid-template-columns: minmax(120px, 1fr) 170px 170px;
align-items: center;
column-gap: 8px;
column-gap: var(--space-2);
}
.header.noBranches,
.row.noBranches {
@@ -35,7 +35,7 @@
.headerCell {
display: inline-flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
min-width: 0;
padding: 0;
border: 0;
@@ -62,7 +62,7 @@
.name {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
}
.icon {
@@ -75,7 +75,7 @@
.cell {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
}
.bar {
@@ -112,7 +112,7 @@
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
/* Manage Coverage Reports */
@@ -126,7 +126,7 @@
.reportRow {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
flex: 1;
white-space: nowrap;
+46 -46
Переглянути файл
@@ -31,7 +31,7 @@
position: relative;
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
padding: 0 6px;
border-right: 1px solid var(--border);
overflow: hidden;
@@ -139,7 +139,7 @@
.toolbar {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
height: var(--h-header);
padding: 0 6px;
flex: none;
@@ -237,7 +237,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 0 6px;
}
.dbToolbarSep {
@@ -259,7 +259,7 @@
.nodeRow {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
}
/* The whole tree row, indent included, so a coloured source and its children form one band. */
@@ -307,7 +307,7 @@
.consoleBar {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: var(--h-header);
padding: 0 8px;
background: var(--bg-editor);
@@ -338,7 +338,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 0 8px;
color: var(--fg-muted);
}
@@ -352,7 +352,7 @@
.pager {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
color: var(--fg-secondary);
font-size: var(--fs-small);
white-space: nowrap;
@@ -370,7 +370,7 @@
display: grid;
grid-template-columns: fit-content(40%) minmax(0, 1fr);
align-items: center;
gap: 8px 12px;
gap: var(--space-2) var(--space-3);
min-width: 0;
padding: 14px;
overflow-wrap: anywhere;
@@ -397,7 +397,7 @@
}
.formRow {
display: flex;
gap: 8px;
gap: var(--space-2);
align-items: center;
}
.formRow[hidden],
@@ -409,7 +409,7 @@
grid-column: 1 / -1;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
color: var(--fg-strong);
}
.formSection::after {
@@ -490,7 +490,7 @@
.colorValue {
display: inline-flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.colorSwatch {
width: 12px;
@@ -500,12 +500,12 @@
.namePicker {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
.nameList {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
max-height: 180px;
overflow: auto;
padding-left: 22px;
@@ -513,14 +513,14 @@
.propertyTable {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
}
.propertyHead,
.propertyRow {
display: grid;
grid-template-columns: 1fr 1fr 24px;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
.propertyHead {
color: var(--fg-secondary);
@@ -620,7 +620,7 @@
:global(.cm-openidea-db-banner) {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-height: 28px;
padding: 0 6px 0 10px;
background: color-mix(in srgb, var(--danger) 10%, var(--bg-editor));
@@ -682,7 +682,7 @@
.previewBlock {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
min-width: 0;
}
.previewTitle {
@@ -734,7 +734,7 @@
}
.modifyToolbar {
display: flex;
gap: 2px;
gap: var(--space-0-5);
padding: 2px 4px;
border-bottom: 1px solid var(--border);
}
@@ -746,7 +746,7 @@
.modifyItem {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 24px;
padding: 0 8px;
cursor: default;
@@ -767,7 +767,7 @@
grid-template-columns: max-content 1fr;
align-content: start;
align-items: center;
gap: 8px 12px;
gap: var(--space-2) var(--space-3);
padding: 12px;
overflow: auto;
}
@@ -777,17 +777,17 @@
padding: 10px 12px;
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.quickDocRows {
margin: 0;
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.quickDocRows > div {
display: flex;
gap: 6px;
gap: var(--space-1-5);
}
.quickDocRows dt {
font-weight: 600;
@@ -837,7 +837,7 @@
right: 12px;
bottom: 12px;
display: flex;
gap: 8px;
gap: var(--space-2);
align-items: center;
padding: 3px 10px;
border: 1px solid var(--border);
@@ -859,7 +859,7 @@
.columnsPopup {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
width: 320px;
padding: 8px;
}
@@ -870,14 +870,14 @@
display: flex;
flex: 1;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
white-space: nowrap;
}
.filterPopup {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
width: 280px;
padding: 8px;
}
@@ -888,7 +888,7 @@
.filterValue {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: var(--h-row);
}
.filterValue > :first-child {
@@ -910,7 +910,7 @@
.filterButtons {
display: flex;
flex-wrap: wrap;
gap: 6px;
gap: var(--space-1-5);
}
.sidePanel {
flex: none;
@@ -934,24 +934,24 @@
.recordFields {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 8px;
}
.recordField {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
}
.recordLabel {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
color: var(--fg-secondary);
}
.valueView {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
height: 100%;
padding: 8px;
box-sizing: border-box;
@@ -998,7 +998,7 @@
flex-direction: column;
flex: 1;
min-height: 0;
gap: 6px;
gap: var(--space-1-5);
overflow: hidden;
}
.valueWindowBody .valueEditor {
@@ -1040,7 +1040,7 @@
.chartBar {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: var(--h-header);
padding: 0 8px;
flex: none;
@@ -1102,7 +1102,7 @@
.planRow {
display: grid;
grid-template-columns: minmax(160px, 1fr) 1fr;
gap: 12px;
gap: var(--space-3);
width: 100%;
}
.planHeader {
@@ -1113,7 +1113,7 @@
.planOperation {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
overflow: hidden;
text-overflow: ellipsis;
}
@@ -1144,14 +1144,14 @@
/* Export / history / import dialogs. */
.exportDialog {
display: flex;
gap: 16px;
gap: var(--space-4);
height: 420px;
padding: 14px;
}
.exportOptions {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
width: 300px;
flex: none;
}
@@ -1164,7 +1164,7 @@
min-width: 0;
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.exportPreviewText,
.historyPreview {
@@ -1206,21 +1206,21 @@
}
.historyDialog {
display: flex;
gap: 12px;
gap: var(--space-3);
height: 440px;
padding: 14px;
}
.historyList {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
width: 300px;
flex: none;
min-height: 0;
}
.historyItem {
display: flex;
gap: 8px;
gap: var(--space-2);
align-items: baseline;
width: 100%;
min-width: 0;
@@ -1263,7 +1263,7 @@
}
.sqlCompletionOption {
display: flex;
gap: 12px;
gap: var(--space-3);
align-items: center;
width: 100%;
padding: 4px 8px;
@@ -1346,7 +1346,7 @@
flex: none;
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
padding: 4px 8px;
background: var(--bg-elev);
border-bottom: 1px solid var(--border);
@@ -1382,7 +1382,7 @@
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 2px 4px;
border: 1px solid var(--border-popup, var(--border));
border-radius: var(--radius-small);
+24 -8
Переглянути файл
@@ -409,6 +409,23 @@ export function Grid(props: GridProps) {
const anchor = scrollRef.current?.querySelectorAll<HTMLElement>("[data-column-filter]")[sel!.c1];
if (anchor) props.onFilter!(sel!.c1, anchor);
},
canEditCell: () => {
if (!canEdit()) return false;
const n = norm(sel!);
return n.top === n.bottom && n.left === n.right && props.rowState?.(n.top) !== "deleted";
},
editCell: () => {
if (actions.canEditCell()) startEdit(sel!.r1, sel!.c1);
},
hasSelection: () => !!sel && !editing,
copy: (kind) => {
if (!actions.hasSelection()) return;
if (kind === "header") copy("tsv", true);
else if (kind === "rowsTsv") copy("tsv", true, true);
else if (kind === "rowsCsv") copy("csv", true, true);
else copy(kind, false);
},
selectedRows,
};
Object.assign((cellActions.current ??= {} as CellActions), actions);
});
@@ -529,20 +546,19 @@ export function Grid(props: GridProps) {
{
label: "Copy as",
submenu: [
{ label: "TSV", verbatim: true, run: () => copy("tsv", false) },
{ label: "CSV", verbatim: true, run: () => copy("csv", false) },
{ label: "One-Row", run: () => copy("onerow", false) },
{ kind: "action", action: "db.copyAsTsv", label: "TSV", arg: cellActions.current },
{ kind: "action", action: "db.copyAsCsv", label: "CSV", arg: cellActions.current },
{ kind: "action", action: "db.copyAsOneRow", label: "One-Row", arg: cellActions.current },
],
},
{ label: "Copy with Header", run: () => copy("tsv", true) },
{ label: "Copy Rows as TSV", run: () => copy("tsv", true, true) },
{ label: "Copy Rows as CSV", run: () => copy("csv", true, true) },
{ kind: "action", action: "db.copyWithHeader", arg: cellActions.current },
{ kind: "action", action: "db.copyRowsAsTsv", arg: cellActions.current },
{ kind: "action", action: "db.copyRowsAsCsv", arg: cellActions.current },
];
if (editable && onEdit) {
const n = norm(sel);
items.push(
{ kind: "separator" },
{ label: "Edit Cell", disabled: n.top !== n.bottom || n.left !== n.right, run: () => startEdit(n.top, n.left) },
{ kind: "action", action: "db.editCell", arg: cellActions.current },
{ kind: "action", action: "db.setCellNull", arg: cellActions.current },
{ kind: "action", action: "db.setCellDefault", arg: cellActions.current },
);
+81 -21
Переглянути файл
@@ -137,7 +137,8 @@ function readonlyNotice(reason: EditBlockReason): string {
}
/** IDEA's pager at the bottom of a result: |< < 1-500 of 501+ > >| and the page size; paging runs the query again. */
function Pager({ tab }: { tab: ResultTab }) {
/** The result tab's page position and the page moves it allows, shared by the pager and the `db.*Page` actions. */
function pagerOf(tab: ResultTab) {
const r = tab.outcome.result!;
const page = tab.page ?? 0;
const pageSize = tab.pageSize ?? Math.max(r.rows.length, 1);
@@ -154,6 +155,21 @@ function Pager({ tab }: { tab: ResultTab }) {
}
if (lastPage !== null && lastPage !== page) go(lastPage);
};
return {
page,
pageSize,
w,
canPage,
go,
goLast,
canPrevious: canPage && page > 0,
canNext: canPage && r.hasMore,
canLast: canPage && !((!r.hasMore && w.total !== null) || (w.total === null && !countable(tab))),
};
}
function Pager({ tab }: { tab: ResultTab }) {
const { page, pageSize, w, canPage, go, goLast, canPrevious, canNext, canLast } = pagerOf(tab);
const { first, last } = w;
const total = w.total === null ? `${w.last + 1}+` : String(w.total);
const sizes = PAGE_SIZES.includes(pageSize) ? PAGE_SIZES : [...PAGE_SIZES, pageSize].sort((a, b) => a - b);
@@ -162,15 +178,17 @@ function Pager({ tab }: { tab: ResultTab }) {
<IconButton
icon="page-first"
title="First Page"
shortcut={shortcutLabel("db.firstPage")}
size="small"
disabled={!canPage || page === 0}
disabled={!canPrevious}
onClick={() => go(0)}
/>
<IconButton
icon="chevron-left"
title="Previous Page"
shortcut={shortcutLabel("db.previousPage")}
size="small"
disabled={!canPage || page === 0}
disabled={!canPrevious}
onClick={() => go(page - 1)}
/>
<button
@@ -185,15 +203,17 @@ function Pager({ tab }: { tab: ResultTab }) {
<IconButton
icon="chevron-right"
title="Next Page"
shortcut={shortcutLabel("db.nextPage")}
size="small"
disabled={!canPage || !r.hasMore}
disabled={!canNext}
onClick={() => go(page + 1)}
/>
<IconButton
icon="page-last"
title="Last Page"
shortcut={shortcutLabel("db.lastPage")}
size="small"
disabled={!canPage || (!r.hasMore && w.total !== null) || (w.total === null && !countable(tab))}
disabled={!canLast}
onClick={() => void goLast()}
/>
<Select
@@ -365,6 +385,10 @@ function Result({ tab }: { tab: ResultTab }) {
return { ...e, deletes, inserts: e.inserts.filter((_, i) => !insertsGone.has(i)) };
});
const addRow = () => setEdits((e) => ({ ...e, inserts: [...e.inserts, new Map()] }));
const restoreRows = (rows: number[]) =>
setEdits((e) => ({ ...e, deletes: new Set([...e.deletes].filter((d) => !rows.includes(d))) }));
const dirty = hasEdits(edits);
const submitting = useSyncExternalStore(subscribeResults, () => !!r && submittingResults.has(r));
const busy = submitting || !!tab.busy;
@@ -397,6 +421,17 @@ function Result({ tab }: { tab: ResultTab }) {
}
};
const showExport = (at: { x: number; y: number }) =>
r &&
showContextMenu(
at,
exportMenu(
{ columns, rows: r.rows, driver, table: queryTable(text, { driver }) },
queryTable(text, { driver }),
extractor,
),
);
// Submit / Revert / Go to Column (⌘↩ / ⌥⌘Z / ⌘F12) reach the latest state through the handle, as in the table editor.
const canSubmit = editable && dirty && !busy;
const viewRef = useRef<HTMLDivElement>(null);
@@ -421,6 +456,30 @@ function Result({ tab }: { tab: ResultTab }) {
const rect = viewRef.current?.getBoundingClientRect();
if (view === "table" && rect) setColumnsAt({ x: rect.left + rect.width / 2, y: rect.top + 48 });
};
const pager = r ? pagerOf(tab) : null;
const rowsEditable = editable && !busy && view === "table";
handle.commands = pager
? {
reload: { enabled: () => !busy, run: () => void rerunResult(tab.id) },
firstPage: { enabled: () => pager.canPrevious, run: () => pager.go(0) },
previousPage: { enabled: () => pager.canPrevious, run: () => pager.go(pager.page - 1) },
nextPage: { enabled: () => pager.canNext, run: () => pager.go(pager.page + 1) },
lastPage: { enabled: () => pager.canLast, run: () => void pager.goLast() },
addRow: { enabled: () => editable && !busy, run: addRow },
exportData: {
enabled: () => true,
run: () => {
const rect = viewRef.current?.querySelector("[data-db-export]")?.getBoundingClientRect();
if (rect) showExport({ x: rect.left, y: rect.bottom });
},
},
deleteRows: { enabled: (rows) => rowsEditable && rows.length > 0, run: deleteRows },
restoreRows: {
enabled: (rows) => rowsEditable && rows.some((row) => edits.deletes.has(row)),
run: restoreRows,
},
}
: undefined;
tableEditorChanged(handle);
});
const hasResult = !!r;
@@ -430,12 +489,6 @@ function Result({ tab }: { tab: ResultTab }) {
);
if (!r) return null;
const data = (): ExportData => ({
columns,
rows: r.rows,
driver,
table: queryTable(text, { driver }),
});
const tableLabel = target ? `${target.schema ? `${target.schema}.` : ""}${target.table}` : "";
const tablePkCount = detailsValue?.columns.filter((c) => c.primaryKey).length ?? 0;
let notice: string | null = null;
@@ -456,7 +509,13 @@ function Result({ tab }: { tab: ResultTab }) {
<IconButton icon="database" title="Table" aria-pressed={view === "table"} onClick={() => setView("table")} />
<IconButton icon="db-chart" title="Chart" aria-pressed={view === "chart"} onClick={() => setView("chart")} />
<span className={styles.toolbarSeparator} />
<IconButton icon="refresh" title="Rerun Query" disabled={busy} onClick={() => void rerunResult(tab.id)} />
<IconButton
icon="refresh"
title="Rerun Query"
shortcut={shortcutLabel("db.reloadPage")}
disabled={busy}
onClick={() => void rerunResult(tab.id)}
/>
<PinButton tab={tab} />
{view === "table" && (
<IconButton
@@ -472,8 +531,9 @@ function Result({ tab }: { tab: ResultTab }) {
<IconButton
icon="plus"
title="Add Row"
shortcut={shortcutLabel("db.addRow")}
disabled={busy}
onClick={() => setEdits((e) => ({ ...e, inserts: [...e.inserts, new Map()] }))}
onClick={addRow}
/>
<Button
size="small"
@@ -503,7 +563,9 @@ function Result({ tab }: { tab: ResultTab }) {
<IconButton
icon="export"
title="Export Data"
onClick={(e) => showContextMenu(e, exportMenu(data(), queryTable(text, { driver }), extractor))}
shortcut={shortcutLabel("db.exportData")}
data-db-export=""
onClick={(e) => showExport({ x: e.clientX, y: e.clientY })}
/>
{view === "table" && <PanelToggle panel={panel} onChange={setPanel} />}
</Toolbar>
@@ -541,15 +603,13 @@ function Result({ tab }: { tab: ResultTab }) {
rowMenu={(rows) =>
editable && !busy
? [
{ label: "Delete Rows", icon: "trash", run: () => deleteRows(rows) },
{
label: "Restore Rows",
run: () =>
setEdits((e) => ({
...e,
deletes: new Set([...e.deletes].filter((d) => !rows.includes(d))),
})),
kind: "action",
action: "db.deleteRows",
icon: "trash",
arg: { rows, editor: handleRef.current },
},
{ kind: "action", action: "db.restoreRows", arg: { rows, editor: handleRef.current } },
]
: []
}
+53 -30
Переглянути файл
@@ -215,18 +215,61 @@ export function TableEditor({ input }: { input: EditorInput }) {
const r = viewRef.current?.getBoundingClientRect();
if (page && r) setColumnsAt({ x: r.left + r.width / 2, y: r.top + 48 });
};
const addRow = () => setEdits((e) => ({ ...e, inserts: [...e.inserts, new Map()] }));
const restoreRows = (rows: number[]) =>
setEdits((e) => ({ ...e, deletes: new Set([...e.deletes].filter((d) => !rows.includes(d))) }));
const showExport = (at: { x: number; y: number }) =>
page &&
showContextMenu(
at,
exportMenu(
{
columns: gridColumns,
rows: page.result.rows,
table: ref.table,
driver: sourceById(ref.id)?.driver ?? "sqlite",
},
`${ref.schema}.${ref.table}`,
extractor,
),
);
const canPrevious = offset > 0 && !loading;
const canNext = !!page?.result.hasMore && !loading;
handle.commands = {
reload: { enabled: () => !loading, run: reload },
firstPage: { enabled: () => canPrevious, run: () => setOffset(0) },
previousPage: { enabled: () => canPrevious, run: () => setOffset(Math.max(0, offset - limit)) },
nextPage: { enabled: () => canNext, run: () => setOffset(offset + limit) },
addRow: { enabled: () => editable, run: addRow },
exportData: {
enabled: () => !!page,
run: () => {
const r = viewRef.current?.querySelector("[data-db-export]")?.getBoundingClientRect();
if (r) showExport({ x: r.left, y: r.bottom });
},
},
deleteRows: { enabled: (rows) => editable && rows.length > 0, run: deleteRows },
restoreRows: { enabled: (rows) => editable && rows.some((r) => edits.deletes.has(r)), run: restoreRows },
};
useEffect(() => registerTableEditor(viewRef.current!, handle), [handle]);
useEffect(() => tableEditorChanged(handle), [handle, dirty, editable]);
const orderInvalid = orderDraft !== null && !parseOrderBy(orderDraft, names);
return (
<div className={styles.view} ref={viewRef} data-db-table-editor="">
<div className={styles.toolbar}>
<IconButton icon="refresh" title="Reload Page" onClick={reload} disabled={loading} />
<IconButton
icon="refresh"
title="Reload Page"
shortcut={shortcutLabel("db.reloadPage")}
onClick={reload}
disabled={loading}
/>
<div className={styles.pager}>
<IconButton
icon="chevron-left"
title="Previous Page"
disabled={offset === 0 || loading}
shortcut={shortcutLabel("db.previousPage")}
disabled={!canPrevious}
onClick={() => setOffset(Math.max(0, offset - limit))}
/>
<span>
@@ -236,7 +279,8 @@ export function TableEditor({ input }: { input: EditorInput }) {
<IconButton
icon="chevron-right"
title="Next Page"
disabled={!page?.result.hasMore || loading}
shortcut={shortcutLabel("db.nextPage")}
disabled={!canNext}
onClick={() => setOffset(offset + limit)}
/>
<Select
@@ -251,11 +295,7 @@ export function TableEditor({ input }: { input: EditorInput }) {
</div>
{editable && (
<>
<IconButton
icon="plus"
title="Add Row"
onClick={() => setEdits((e) => ({ ...e, inserts: [...e.inserts, new Map()] }))}
/>
<IconButton icon="plus" title="Add Row" shortcut={shortcutLabel("db.addRow")} onClick={addRow} />
<Button
size="small"
variant="primary"
@@ -281,23 +321,10 @@ export function TableEditor({ input }: { input: EditorInput }) {
<IconButton
icon="export"
title="Export Data"
shortcut={shortcutLabel("db.exportData")}
data-db-export=""
disabled={!page}
onClick={(e) =>
page &&
showContextMenu(
e,
exportMenu(
{
columns: gridColumns,
rows: page.result.rows,
table: ref.table,
driver: sourceById(ref.id)?.driver ?? "sqlite",
},
`${ref.schema}.${ref.table}`,
extractor,
),
)
}
onClick={(e) => showExport({ x: e.clientX, y: e.clientY })}
/>
<IconButton
icon="import"
@@ -396,12 +423,8 @@ export function TableEditor({ input }: { input: EditorInput }) {
rowMenu={(rows) =>
editable
? [
{ label: "Delete Rows", icon: "trash", run: () => deleteRows(rows) },
{
label: "Restore Rows",
run: () =>
setEdits((e) => ({ ...e, deletes: new Set([...e.deletes].filter((d) => !rows.includes(d))) })),
},
{ kind: "action", action: "db.deleteRows", icon: "trash", arg: { rows, editor: handle } },
{ kind: "action", action: "db.restoreRows", arg: { rows, editor: handle } },
]
: []
}
+38
Переглянути файл
@@ -1,6 +1,8 @@
import { registerActions, type ActionContext } from "@/platform/actions";
import { setContext } from "@/platform/context";
export type CellCopy = "tsv" | "csv" | "onerow" | "header" | "rowsTsv" | "rowsCsv";
export interface CellActions {
canToggle(): boolean;
canSetNull(): boolean;
@@ -11,11 +13,31 @@ export interface CellActions {
setDefault(): void;
/** Opens the local filter of the selected cell's column. */
filter(): void;
canEditCell(): boolean;
editCell(): void;
hasSelection(): boolean;
copy(kind: CellCopy): void;
/** Rows of the selection, top to bottom. */
selectedRows(): number[];
}
const grids = new WeakMap<Element, CellActions>();
let active: CellActions | null = null;
/** The focused grid (not while a text field in it has focus). */
export function activeCellGrid(): CellActions | null {
return active;
}
const COPIES: Array<[CellCopy, string, string]> = [
["tsv", "db.copyAsTsv", "Copy as TSV"],
["csv", "db.copyAsCsv", "Copy as CSV"],
["onerow", "db.copyAsOneRow", "Copy as One-Row"],
["header", "db.copyWithHeader", "Copy with Header"],
["rowsTsv", "db.copyRowsAsTsv", "Copy Rows as TSV"],
["rowsCsv", "db.copyRowsAsCsv", "Copy Rows as CSV"],
];
export function registerCellGrid(root: Element, actions: CellActions): () => void {
grids.set(root, actions);
return () => {
@@ -70,6 +92,22 @@ export function installCellActions(): () => void {
enabled: (c) => handle(c)?.canFilter() ?? false,
run: (c) => handle(c)?.filter(),
},
{
id: "db.editCell",
title: "Edit Cell",
category: "Database",
keyWhen: "dbCellGridFocus",
enabled: (c) => handle(c)?.canEditCell() ?? false,
run: (c) => handle(c)?.editCell(),
},
...COPIES.map(([kind, id, title]) => ({
id,
title,
category: "Database",
keyWhen: "dbCellGridFocus",
enabled: (c: ActionContext) => handle(c)?.hasSelection() ?? false,
run: (c: ActionContext) => handle(c)?.copy(kind),
})),
]);
return () => {
dispose();
+45 -2
Переглянути файл
@@ -8,8 +8,15 @@ import { lazyComponent, lazyWhen, type MenuItem } from "@/ui";
import { activeEditor, lazyEditorExtension, registerEditorContribution } from "@/editor/api";
import { tx } from "@/platform/i18n";
import { onIdeEvent } from "@/platform/ipc";
import { registerActions } from "@/platform/actions";
import { activeTableEditor, installTableEditorFocus } from "./tableEditorFocus";
import { registerActions, type ActionContext } from "@/platform/actions";
import { activeCellGrid } from "./cellActions";
import {
activeTableEditor,
focusedTableEditor,
installTableEditorFocus,
type TableCommand,
type TableCommandTarget,
} from "./tableEditorFocus";
import { useProject } from "@/platform/project";
import {
registerEditorKind,
@@ -53,6 +60,25 @@ function useDatabaseHeaderMenu(): MenuItem[] {
const useDialogOpen = () => useDatabase((s) => !!s.dialog);
/** Table editor / result grid commands as actions (IDEA's data editor actions). */
const TABLE_COMMANDS: Array<[TableCommand, string, string, string[]]> = [
["reload", "db.reloadPage", "Reload Page", ["refresh", "rerun"]],
["firstPage", "db.firstPage", "First Page", ["pagination"]],
["previousPage", "db.previousPage", "Previous Page", ["pagination"]],
["nextPage", "db.nextPage", "Next Page", ["pagination"]],
["lastPage", "db.lastPage", "Last Page", ["pagination"]],
["addRow", "db.addRow", "Add Row", ["insert row", "new row"]],
["exportData", "db.exportData", "Export Data", ["export", "save as"]],
["deleteRows", "db.deleteRows", "Delete Rows", ["remove rows"]],
["restoreRows", "db.restoreRows", "Restore Rows", ["undelete rows"]],
];
/** The editor and rows a menu passed (focus has moved to the menu), else the focused grid's. */
function tableTarget(arg: unknown): TableCommandTarget {
if (arg && typeof arg === "object" && "rows" in arg) return arg as TableCommandTarget;
return { rows: activeCellGrid()?.selectedRows() ?? [], editor: null };
}
export function activate(): () => void {
const disposers = [
onIdeEvent("dbSourcesChanged", () => {
@@ -280,6 +306,23 @@ export function activate(): () => void {
when: "dbTableEditorFocus && dbTableEditorChanges",
run: () => activeTableEditor()?.revert(),
},
...TABLE_COMMANDS.map(([command, id, title, keywords]) => ({
id,
title,
category: "Tools",
keywords: ["table editor", "data editor", ...keywords],
keyWhen: "dbTableEditorFocus",
enabled: ({ arg }: ActionContext) => {
const { rows, editor } = tableTarget(arg);
const handler = (editor ?? focusedTableEditor())?.commands?.[command];
return !!handler && handler.enabled(rows);
},
run: ({ arg }: ActionContext) => {
const { rows, editor } = tableTarget(arg);
const handler = (editor ?? activeTableEditor())?.commands?.[command];
if (handler?.enabled(rows)) handler.run(rows);
},
})),
{
id: "db.explainPlan",
title: "Explain Plan",
+33 -1
Переглянути файл
@@ -2,7 +2,7 @@ import { act, fireEvent, render, screen } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { DbDriver, DbTablePage } from "@/platform/ipc";
import { installKeyboardDispatcher, useKeymap } from "@/platform/keymap";
import { installCellActions } from "./cellActions";
import { activeCellGrid, installCellActions } from "./cellActions";
import { getContext } from "@/platform/context";
import { TableEditor } from "./TableEditor";
import { activeTableEditor, installTableEditorFocus } from "./tableEditorFocus";
@@ -128,6 +128,38 @@ describe("table editor capabilities", () => {
}
});
it("runs the row and toolbar commands of the db.* actions on the focused grid's selection (#3506)", async () => {
backend.driver = "postgres";
const uninstallFocus = installTableEditorFocus();
const uninstallCells = installCellActions();
try {
await act(async () => {
render(<TableEditor input={tableInput("source", "public", "users")} />);
});
const cell = await screen.findByRole("gridcell", { name: "Ann" });
fireEvent.mouseDown(cell, { button: 0 });
act(() => screen.getByRole("grid").focus());
const rows = activeCellGrid()!.selectedRows();
expect(rows).toEqual([0]);
const commands = activeTableEditor()!.commands!;
expect(commands.nextPage!.enabled(rows)).toBe(false);
expect(commands.previousPage!.enabled(rows)).toBe(false);
expect(commands.exportData!.enabled(rows)).toBe(true);
expect(commands.restoreRows!.enabled(rows)).toBe(false);
act(() => commands.deleteRows!.run(rows));
expect(getContext().dbTableEditorChanges).toBe(true);
expect(activeTableEditor()!.commands!.restoreRows!.enabled(rows)).toBe(true);
act(() => activeTableEditor()!.commands!.restoreRows!.run(rows));
expect(getContext().dbTableEditorChanges).toBe(false);
act(() => activeTableEditor()!.commands!.addRow!.run([]));
expect(screen.getAllByRole("row").length).toBeGreaterThan(2);
expect(getContext().dbTableEditorChanges).toBe(true);
} finally {
uninstallCells();
uninstallFocus();
}
});
it("counts the editor-area host focusing the tab as table-editor focus (#2307)", async () => {
backend.driver = "postgres";
const uninstall = installTableEditorFocus();
+31
Переглянути файл
@@ -6,11 +6,37 @@
import { flushSync } from "react-dom";
import { setContext } from "@/platform/context";
/** Toolbar and row commands of a table editor or result grid, run as `db.*` actions. */
export type TableCommand =
| "reload"
| "firstPage"
| "previousPage"
| "nextPage"
| "lastPage"
| "addRow"
| "exportData"
| "deleteRows"
| "restoreRows";
export interface TableCommandHandler {
enabled(rows: number[]): boolean;
/** `rows`: the grid's selected rows (row commands). */
run(rows: number[]): void;
}
/** What a row menu passes to a `db.*` row action: the menu holds focus, not the grid. */
export interface TableCommandTarget {
rows: number[];
editor: TableEditorHandle | null;
}
export interface TableEditorHandle {
dirty: boolean;
submit(): void;
revert(): void;
showColumns(): void;
/** The commands this view has; one it lacks is disabled. */
commands?: Partial<Record<TableCommand, TableCommandHandler>>;
}
const handles = new WeakMap<Element, TableEditorHandle>();
@@ -55,6 +81,11 @@ export function tableEditorChanged(handle: TableEditorHandle) {
if (active === handle) update();
}
/** The active editor as is, for enablement checks (no side effects). */
export function focusedTableEditor(): TableEditorHandle | null {
return active;
}
/** The active editor, after confirming the cell being edited so its value counts. */
export function activeTableEditor(): TableEditorHandle | null {
const el = document.activeElement;
+10 -10
Переглянути файл
@@ -16,7 +16,7 @@
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 16px;
gap: var(--space-2) var(--space-4);
padding: 8px 12px;
border-bottom: 1px solid var(--border);
}
@@ -25,14 +25,14 @@
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.title,
.totals {
display: flex;
flex-wrap: wrap;
align-items: baseline;
column-gap: 12px;
column-gap: var(--space-3);
min-width: 0;
}
.label {
@@ -56,7 +56,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.compare {
width: 200px;
@@ -126,7 +126,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 4px 8px;
border-bottom: 1px solid var(--border);
}
@@ -138,7 +138,7 @@
.note {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 8px 12px;
color: var(--fg-subtle);
}
@@ -177,7 +177,7 @@
display: grid;
grid-template-columns: var(--heap-columns);
align-items: center;
column-gap: 12px;
column-gap: var(--space-3);
width: 100%;
}
.head {
@@ -252,7 +252,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 12px;
gap: var(--space-3);
}
.treeRow > :first-child {
flex: 1;
@@ -274,7 +274,7 @@
.object {
display: inline-flex;
align-items: baseline;
gap: 8px;
gap: var(--space-2);
min-width: 0;
max-width: 100%;
overflow: hidden;
@@ -336,5 +336,5 @@
.openProgress {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
+4 -4
Переглянути файл
@@ -6,7 +6,7 @@
padding: 6px 12px 8px;
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.title {
@@ -31,13 +31,13 @@
.groups {
display: flex;
flex-wrap: wrap;
gap: 4px 20px;
gap: var(--space-1) 20px;
}
.group {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.groupTitle {
@@ -49,6 +49,6 @@
.row {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 22px;
}
+5 -5
Переглянути файл
@@ -9,7 +9,7 @@
.toolbar {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 4px 8px;
border-bottom: 1px solid var(--border);
}
@@ -23,7 +23,7 @@
.categories {
display: flex;
flex: none;
gap: 2px;
gap: var(--space-0-5);
}
.category {
@@ -49,7 +49,7 @@
.actions {
display: flex;
gap: 4px;
gap: var(--space-1);
padding-top: 6px;
}
@@ -78,7 +78,7 @@
.row {
display: grid;
grid-template-columns: minmax(120px, 3fr) minmax(60px, 1.4fr) 64px 88px 76px 76px;
gap: 8px;
gap: var(--space-2);
padding: 0 8px;
align-items: center;
min-height: 22px;
@@ -159,7 +159,7 @@
.header {
display: flex;
gap: 8px;
gap: var(--space-2);
font-family: var(--font-mono);
font-size: var(--fs-small);
user-select: text;
+3 -3
Переглянути файл
@@ -36,7 +36,7 @@
.item {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 24px;
padding: 0 8px 0 12px;
}
@@ -76,7 +76,7 @@
min-width: 0;
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 10px 12px;
}
@@ -126,7 +126,7 @@
.actions {
display: flex;
gap: 8px;
gap: var(--space-2);
}
.note {
+3 -3
Переглянути файл
@@ -12,7 +12,7 @@
flex: none;
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: var(--h-row);
padding: 0 4px 0 12px;
border-bottom: 1px solid var(--border);
@@ -35,7 +35,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 4px 12px;
font-size: var(--fs-ui);
}
@@ -95,7 +95,7 @@
}
.message {
gap: 8px;
gap: var(--space-2);
color: var(--fg-subtle);
}
+6 -6
Переглянути файл
@@ -12,7 +12,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
padding: 4px 8px;
border-bottom: 1px solid var(--border);
}
@@ -52,7 +52,7 @@
flex: none;
display: flex;
align-items: center;
gap: 12px;
gap: var(--space-3);
padding-block: 4px;
border-bottom: 1px solid var(--border);
}
@@ -85,7 +85,7 @@
display: grid;
grid-template-columns: var(--memory-columns);
align-items: center;
column-gap: 12px;
column-gap: var(--space-3);
width: 100%;
}
@@ -106,7 +106,7 @@
flex: 1;
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-width: 0;
height: 100%;
padding: 0;
@@ -161,7 +161,7 @@
.className {
display: flex;
align-items: baseline;
gap: 8px;
gap: var(--space-2);
min-width: 0;
font-family: var(--font-mono);
}
@@ -223,7 +223,7 @@
display: flex;
flex-wrap: wrap;
align-items: baseline;
column-gap: 12px;
column-gap: var(--space-3);
padding: 4px 12px;
border-top: 1px solid var(--border);
color: var(--fg-muted);
+6 -6
Переглянути файл
@@ -23,7 +23,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 0 8px 0 4px;
border-bottom: 1px solid var(--border);
min-width: 0;
@@ -47,7 +47,7 @@
.tabs {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
flex: none;
}
@@ -112,7 +112,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 0 8px;
border-radius: var(--radius-small);
text-align: left;
@@ -180,7 +180,7 @@
flex: none;
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
padding: 0 4px 0 12px;
border-bottom: 1px solid var(--border);
}
@@ -190,7 +190,7 @@
flex: none;
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.prompt {
@@ -231,7 +231,7 @@
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 4px 0;
border-right: 1px solid var(--border);
}
+1 -1
Переглянути файл
@@ -11,7 +11,7 @@
.item {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: var(--h-list-row);
margin: 0 6px;
padding: 0 8px 0 6px;
+11 -11
Переглянути файл
@@ -12,7 +12,7 @@
.field {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
}
.label {
@@ -26,13 +26,13 @@
padding: 10px 12px;
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.bpTitle {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
color: var(--fg-emphasis);
font-weight: 500;
}
@@ -71,14 +71,14 @@
.bpFooter {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
margin-top: 2px;
}
.link {
display: inline-flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
color: var(--accent);
font-size: var(--fs-ui);
cursor: pointer;
@@ -108,7 +108,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 0 8px 0 12px;
border-bottom: 1px solid var(--border-popup);
}
@@ -122,7 +122,7 @@
.chooserRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
width: 100%;
padding: 0 8px;
@@ -185,7 +185,7 @@
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px 8px;
gap: var(--space-1) var(--space-2);
}
/* Grows with the dialog when it is resized. */
@@ -211,7 +211,7 @@
padding: 6px 12px 8px;
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.exceptionsTitle {
font-size: var(--fs-small);
@@ -226,7 +226,7 @@
.exceptionGroup {
display: flex;
flex-direction: column;
gap: 2px;
gap: var(--space-0-5);
}
.exceptionAdapter {
font-size: var(--fs-small);
@@ -260,7 +260,7 @@
.evalInputRow {
display: flex;
align-items: flex-start;
gap: 4px;
gap: var(--space-1);
}
.evalInput {
flex: 1;
+11 -11
Переглянути файл
@@ -10,7 +10,7 @@
flex: none;
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 0 6px;
}
.serverSelect {
@@ -42,14 +42,14 @@
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;
gap: var(--space-2);
padding: 10px;
}
.center {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
gap: var(--space-2);
padding: 16px;
color: var(--fg-subtle);
}
@@ -72,7 +72,7 @@
.report {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
}
.reportErrors {
margin: 0;
@@ -98,7 +98,7 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
gap: var(--space-3);
padding: 10px 16px;
flex: none;
}
@@ -111,7 +111,7 @@
.sync {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
height: 100%;
min-height: 0;
padding: 8px 10px 0;
@@ -121,7 +121,7 @@
flex-wrap: wrap;
align-items: center;
flex: none;
gap: 4px;
gap: var(--space-1);
}
.separator {
height: 20px;
@@ -151,7 +151,7 @@
.fileFilter {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
white-space: nowrap;
}
.compareBy select {
@@ -179,7 +179,7 @@
.comparisonRoots > span {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
border: 1px solid var(--border);
border-radius: var(--radius-control, 4px);
@@ -244,7 +244,7 @@
.fileName {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
overflow: hidden;
text-overflow: ellipsis;
}
@@ -315,7 +315,7 @@
display: flex;
align-items: flex-start;
flex-direction: column;
gap: 12px;
gap: var(--space-3);
}
/* SSH password prompt */
+3 -3
Переглянути файл
@@ -8,7 +8,7 @@
.header {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.login {
color: var(--fg-strong);
@@ -34,7 +34,7 @@
.row {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
width: 100%;
min-width: 0;
}
@@ -68,7 +68,7 @@
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
gap: var(--space-2);
}
.muted {
color: var(--fg-subtle);
+2 -2
Переглянути файл
@@ -7,7 +7,7 @@
import { useMemo, useRef, useState, type MouseEvent, type ReactNode } from "react";
import { buildFileTree, dirKeys, type FileTreeNode } from "@/features/vcs/fileTree";
import { openDiff, withChain } from "@/features/vcs/diffInput";
import { KIND_COLOR, baseName, fileCount, type EffectiveKind } from "@/features/vcs/model";
import { KIND_COLOR, fileCount, renameFrom, type EffectiveKind } from "@/features/vcs/model";
import type { Commit } from "@/platform/ipc";
import { tx } from "@/platform/i18n";
import { Icon, IconButton, Spinner, T, Tree, fileIconName, showContextMenu, type MenuItem } from "@/ui";
@@ -252,7 +252,7 @@ function ChangeRow({ node }: { node: FileTreeNode<CreateChange> }) {
<span className={styles.fileName} style={{ color: KIND_COLOR[kindOf(f)] }}>
{node.name}
</span>
{f.oldPath && <span className={styles.fileDetail}>{tx`renamed from ${baseName(f.oldPath)}`}</span>}
{f.oldPath && <span className={styles.fileDetail}>{renameFrom(f.path, f.oldPath)}</span>}
</span>
);
}
+15 -15
Переглянути файл
@@ -21,7 +21,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 0;
padding: 12px;
text-align: center;
@@ -44,7 +44,7 @@
.textLink {
display: inline-flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
min-width: 0;
padding: 0;
border: none;
@@ -73,7 +73,7 @@
display: flex;
flex: none;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
padding: 8px 12px;
}
@@ -97,7 +97,7 @@
display: flex;
flex: none;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 8px 8px 0;
}
.headRepo > :last-child {
@@ -128,7 +128,7 @@
.headRow {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 100%;
padding: 0 8px;
overflow: hidden;
@@ -157,7 +157,7 @@
display: flex;
flex: none;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
max-height: 50%;
padding: 2px 12px 8px;
overflow: auto;
@@ -165,7 +165,7 @@
.commitsHeader {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-height: 28px;
}
.commitsTitle {
@@ -177,12 +177,12 @@
.commitInfo {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.commitTop {
display: flex;
align-items: flex-start;
gap: 8px;
gap: var(--space-2);
}
.commitTop > .textLink {
flex: none;
@@ -213,7 +213,7 @@
.fileRow {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-width: 0;
white-space: nowrap;
}
@@ -297,7 +297,7 @@
.userItem {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
}
/* Status and the option button */
@@ -312,19 +312,19 @@
.status {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
max-width: 100%;
}
.statusRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
}
.statusText {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-width: 0;
}
.ellipsis {
@@ -375,7 +375,7 @@
.dialogForm {
display: flex;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
}
.dialogLabel {
color: var(--fg);
+2 -2
Переглянути файл
@@ -10,7 +10,7 @@
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type MouseEvent } from "react";
import clsx from "clsx";
import { dirKeys, type FileTreeNode } from "@/features/vcs/fileTree";
import { baseName, dirName, fileCount, KIND_COLOR } from "@/features/vcs/model";
import { dirName, fileCount, KIND_COLOR, renameFrom } from "@/features/vcs/model";
import { currentRepoRoot } from "@/features/vcs/store";
import { useTx } from "@/platform/i18n";
import { Icon, Tree, fileIconName, showContextMenu, T, type MenuItem, type TreeHandle } from "@/ui";
@@ -202,7 +202,7 @@ function ChangeRow(props: {
{node.name}
</span>
{flat && dirName(f.filename) && <span className={styles.fileDir}>{dirName(f.filename)}</span>}
{f.previousFilename && <span className={styles.fileDir}>{tx`renamed from ${baseName(f.previousFilename)}`}</span>}
{f.previousFilename && <span className={styles.fileDir}>{renameFrom(f.filename, f.previousFilename)}</span>}
</>
) : (
<>
+18 -18
Переглянути файл
@@ -16,7 +16,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 0;
padding: 12px;
color: var(--fg-secondary);
@@ -46,7 +46,7 @@
display: inline-flex;
flex: none;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
align-self: flex-start;
max-width: 100%;
padding: 0;
@@ -74,13 +74,13 @@
display: flex;
flex: none;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 16px 14px 16px 16px;
}
.titleRow {
display: flex;
align-items: flex-start;
gap: 8px;
gap: var(--space-2);
}
.title {
flex: 1;
@@ -110,7 +110,7 @@
flex: none;
align-items: center;
justify-content: space-between;
gap: 8px;
gap: var(--space-2);
min-width: 0;
padding: 0 14px 4px 16px;
}
@@ -118,13 +118,13 @@
display: flex;
flex: none;
align-items: center;
gap: 4px;
gap: var(--space-1);
padding: 6px 0 5px;
}
.branch {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
min-width: 0;
padding: 6px 0 5px;
}
@@ -162,7 +162,7 @@
.advertiser {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
margin-top: 4px;
padding: 5px 10px;
border-top: 1px solid var(--border);
@@ -198,7 +198,7 @@
.commitRow {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 100%;
margin: 0 6px;
padding: 0 8px;
@@ -226,7 +226,7 @@
display: flex;
flex: 1;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
min-width: 0;
}
@@ -235,13 +235,13 @@
display: flex;
flex: none;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 0 14px 12px 16px;
}
.commitInfoTop {
display: flex;
align-items: flex-start;
gap: 8px;
gap: var(--space-2);
}
.commitInfoTitle {
flex: 1;
@@ -279,7 +279,7 @@
display: flex;
flex: 1;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
white-space: nowrap;
}
@@ -309,7 +309,7 @@
.counter {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
color: var(--fg-secondary);
}
.readSlot {
@@ -365,7 +365,7 @@
.statusRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
padding: 5px 0;
}
@@ -404,7 +404,7 @@
.progressText {
display: inline-flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
color: var(--fg-secondary);
}
/* JBOptionButton: the main action and an arrow opening the others. */
@@ -439,7 +439,7 @@
.submitPopup {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
width: var(--submit-width);
min-width: 320px;
height: var(--submit-height);
@@ -477,5 +477,5 @@
display: flex;
flex: none;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
}
+1 -1
Переглянути файл
@@ -29,6 +29,6 @@
.page {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 4px 0;
}
+5 -5
Переглянути файл
@@ -42,7 +42,7 @@
display: flex;
flex: 1;
align-items: center;
gap: 4px;
gap: var(--space-1);
min-width: 0;
padding: 2px 10px 4px;
margin-bottom: -2px;
@@ -92,7 +92,7 @@
.chipMain {
display: inline-flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
height: 100%;
max-width: 200px;
padding: 0 4px 0 6px;
@@ -170,7 +170,7 @@
.right {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
}
.left {
@@ -211,7 +211,7 @@
display: inline-flex;
flex: none;
align-items: center;
gap: 4px;
gap: var(--space-1);
padding-right: 1px;
color: var(--fg);
font-variant-numeric: tabular-nums;
@@ -259,7 +259,7 @@
.balloonRow {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: 24px;
white-space: nowrap;
}
+1 -1
Переглянути файл
@@ -16,7 +16,7 @@
display: inline-flex;
align-items: center;
justify-content: center;
gap: 4px;
gap: var(--space-1);
height: 22px;
min-width: 22px;
padding: 0 3px;
+3 -3
Переглянути файл
@@ -44,7 +44,7 @@
.commits {
display: flex;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
}
.commit {
display: flex;
@@ -65,7 +65,7 @@
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
gap: var(--space-1);
max-width: calc(42em + 32px);
padding: 16px 10px;
text-align: center;
@@ -84,7 +84,7 @@
display: inline-flex;
flex-wrap: wrap;
align-items: center;
gap: 4px;
gap: var(--space-1);
}
.composer {
padding: 10px 16px;
+17 -17
Переглянути файл
@@ -31,7 +31,7 @@
display: flex;
flex: 1;
flex-direction: column;
gap: 4px;
gap: var(--space-1);
min-width: 0;
max-width: var(--gh-content-width, 42em);
}
@@ -41,7 +41,7 @@
.header {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-height: 20px;
}
.title {
@@ -49,7 +49,7 @@
flex: 1;
flex-wrap: wrap;
align-items: center;
gap: 8px;
gap: var(--space-2);
min-width: 0;
}
.author {
@@ -68,7 +68,7 @@
display: flex;
flex: none;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
margin-left: auto;
}
.tag {
@@ -109,7 +109,7 @@
.status {
display: flex;
gap: 8px;
gap: var(--space-2);
min-width: 0;
}
.status::before {
@@ -149,7 +149,7 @@
display: flex;
flex: 1;
flex-direction: column;
gap: 6px;
gap: var(--space-1-5);
min-width: 0;
max-width: var(--gh-content-width, 42em);
}
@@ -182,19 +182,19 @@
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 12px;
gap: var(--space-3);
}
.hints {
display: flex;
flex-wrap: wrap;
gap: 12px;
gap: var(--space-3);
min-width: 0;
color: var(--fg-secondary);
font-size: var(--fs-small);
}
.buttons {
display: flex;
gap: 8px;
gap: var(--space-2);
}
.mentions {
max-height: 240px;
@@ -205,7 +205,7 @@
.mention {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 2px 8px;
white-space: nowrap;
cursor: pointer;
@@ -219,12 +219,12 @@
.reactions {
display: flex;
flex-wrap: wrap;
gap: 8px;
gap: var(--space-2);
}
.pill {
display: inline-flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: 24px;
padding: 0 8px 0 6px;
border: 1px solid transparent;
@@ -279,7 +279,7 @@
.threadContent {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
}
.preview {
display: -webkit-box;
@@ -300,7 +300,7 @@
.fileHeader {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 28px;
padding: 2px 6px 2px 10px;
}
@@ -364,7 +364,7 @@
.foldedReplies {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.compactFooter {
display: flex;
@@ -393,7 +393,7 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
gap: var(--space-2);
padding: 4px 8px;
border-bottom: 1px solid var(--gh-bubble-border);
background: var(--bg-editor);
@@ -418,7 +418,7 @@
.commitPopup {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
width: 450px;
padding: 10px;
}
+4 -59
Переглянути файл
@@ -18,25 +18,11 @@
.listTab {
padding-top: 8px;
}
.column {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
}
.grow {
flex: 1;
min-height: 0;
}
.scroll {
height: 100%;
overflow: auto;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
gap: var(--space-1-5);
height: 100%;
color: var(--fg-secondary);
}
@@ -50,24 +36,18 @@
.tabs {
min-width: 0;
}
.repoTitle {
overflow: hidden;
color: var(--fg-secondary);
text-overflow: ellipsis;
white-space: nowrap;
}
/* Repository selector (several GitHub remotes) */
.selector {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 12px;
}
.selectorRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
}
.error {
color: var(--danger);
@@ -79,7 +59,7 @@
display: flex;
flex: none;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 26px;
padding: 0 6px 0 10px;
border-bottom: 1px solid var(--border);
@@ -96,38 +76,3 @@
}
/* Placeholder panels */
.plainRow {
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
padding: 0 13px;
overflow: hidden;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.secondary {
color: var(--fg-secondary);
font-size: var(--fs-small);
}
.detailsTitle {
color: var(--fg-strong);
font-weight: 600;
}
.buttons {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 6px;
}
.timelineStub {
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
max-width: 720px;
text-align: left;
}
+5 -10
Переглянути файл
@@ -87,7 +87,7 @@
display: inline-flex;
flex: none;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
max-width: 100%;
color: var(--fg);
white-space: nowrap;
@@ -120,7 +120,7 @@
.chooserRow {
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
height: 100%;
padding: 0 8px;
overflow: hidden;
@@ -152,7 +152,7 @@
display: flex;
flex: none;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 4px 10px 6px;
color: var(--fg-secondary);
font-size: var(--fs-small);
@@ -227,7 +227,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
gap: var(--space-1-5);
min-height: 0;
padding: 16px;
color: var(--fg-secondary);
@@ -242,14 +242,9 @@
.form {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
padding: 14px;
}
.formRow {
display: flex;
align-items: center;
gap: 10px;
}
.fieldLabel {
color: var(--fg-secondary);
font-size: var(--fs-small);
+6 -9
Переглянути файл
@@ -14,7 +14,7 @@
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
padding: 4px 0;
border-right: 1px solid var(--border);
}
@@ -40,7 +40,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 0 10px;
font-size: var(--fs-ui);
color: var(--fg-subtle);
@@ -51,7 +51,7 @@
min-width: 0;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding-right: 10px;
white-space: nowrap;
}
@@ -68,9 +68,6 @@
.ok {
color: var(--success);
}
.code {
font-weight: 600;
}
.result {
height: 100%;
display: flex;
@@ -82,7 +79,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 0 10px;
white-space: nowrap;
border-bottom: 1px solid var(--border);
@@ -135,7 +132,7 @@
.editorToolbar {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: var(--h-header);
padding: 0 8px;
background: var(--bg-editor);
@@ -272,7 +269,7 @@
.envToolbar {
flex: none;
display: flex;
gap: 2px;
gap: var(--space-0-5);
padding: 2px 4px;
border-bottom: 1px solid var(--border);
}
+5 -5
Переглянути файл
@@ -19,7 +19,7 @@
.toolbar {
display: flex;
align-items: center;
gap: 4px;
gap: var(--space-1);
height: var(--h-header);
padding: 0 8px;
background: var(--bg-editor);
@@ -45,7 +45,7 @@
.entry {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
height: var(--h-list-row);
padding: 0 8px;
border: none;
@@ -66,7 +66,7 @@
.runningRow {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
height: var(--h-list-row);
padding: 0 8px;
color: var(--fg-secondary);
@@ -112,7 +112,7 @@
.statusLine {
display: flex;
align-items: center;
gap: 12px;
gap: var(--space-3);
height: var(--h-header);
padding: 0 8px;
flex: none;
@@ -195,7 +195,7 @@
.pendingLine {
display: flex;
align-items: center;
gap: 8px;
gap: var(--space-2);
color: var(--fg-secondary);
}
.pendingRequest {
+2 -2
Переглянути файл
@@ -10,7 +10,7 @@
flex: none;
display: flex;
align-items: center;
gap: 6px;
gap: var(--space-1-5);
padding: 4px 8px;
border-bottom: 1px solid var(--border);
background: var(--bg-elev);
@@ -53,7 +53,7 @@
left: 0;
width: 100%;
display: flex;
gap: 8px;
gap: var(--space-2);
padding: 0 8px;
box-sizing: border-box;
white-space: pre-wrap;
+4 -4
Переглянути файл
@@ -1,5 +1,5 @@
.status {
gap: 6px;
gap: var(--space-1-5);
}
.dot {
width: 8px;
@@ -10,14 +10,14 @@
.edit {
display: grid;
grid-template-columns: 220px 1fr;
gap: 12px;
gap: var(--space-3);
height: 300px;
padding: 14px;
}
.column {
display: flex;
flex-direction: column;
gap: 8px;
gap: var(--space-2);
min-height: 0;
}
.list {
@@ -34,7 +34,7 @@
}
.buttons {
display: flex;
gap: 6px;
gap: var(--space-1-5);
}
.empty {
padding: 6px 8px;
+5 -1
Переглянути файл
@@ -12,7 +12,7 @@ import {
import { defaultKeymap, indentWithTab } from "@codemirror/commands";
import { bracketMatching, indentOnInput, syntaxHighlighting } from "@codemirror/language";
import type { NotebookCellDoc } from "@/bindings";
import { cellEditorExtensions, embeddedEditorExtensions } from "@/editor/api";
import { cellEditorExtensions, embeddedEditorExtensions, externalHistory } from "@/editor/api";
import { openideaTheme } from "@/editor/core/cm/theme";
import { openideaHighlightStyle } from "@/editor/core/cm/highlight";
import { selectionMarks } from "@/editor/core/cm/selectionMarks";
@@ -97,6 +97,10 @@ export function CellEditor({
]),
),
keymap.of([indentWithTab, ...defaultKeymap]),
externalHistory.of({
undo: () => void session.undo().catch((e) => session.report(e)),
redo: () => void session.redo().catch((e) => session.report(e)),
}),
embeddedEditorExtensions(session.path),
language.of([]),
services.current.of(languageServices(type, initialDoc.current)),
+4 -4
Переглянути файл
@@ -42,7 +42,7 @@
.error {
display: flex;
align-items: flex-start;
gap: 12px;
gap: var(--space-3);
padding: 8px 12px;
color: var(--danger, var(--fg));
border-bottom: 1px solid var(--border);
@@ -93,7 +93,7 @@
.cellToolbar {
display: flex;
align-items: center;
gap: 2px;
gap: var(--space-0-5);
min-height: 28px;
padding: 2px 6px;
background: var(--bg-elev, var(--bg-app));
@@ -202,7 +202,7 @@
.addBar {
display: flex;
justify-content: center;
gap: 8px;
gap: var(--space-2);
flex-wrap: wrap;
padding: 12px 16px 32px;
}
@@ -211,7 +211,7 @@
padding: 5px;
}
.toolbar {
gap: 2px;
gap: var(--space-0-5);
}
.interpreter {
max-width: 180px;
Loaded 100 of 238 files, more files were not shown because too many files have changed in this diff. Show more