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

..
Автор SHA1 Повідомлення Дата
l0ng-ai 0f0cd312f6 Merge remote-tracking branch 'origin/main' into fix/diff-viewer-text-cursor 2026-11-26 20:10:18 +08:00
l0ng-ai 14f143b703 fix(vcs): load no Amend message with several repositories (#6175)
With several roots, Amend loaded the HEAD message of the repository last selected in the branch
widget, log or push dialog, whatever the included files were, and the commit then amended every
included repository with it. The commit to amend is ambiguous there: no message is loaded, and
the typed one amends each repository's HEAD.

Fixes #6149
2026-11-26 20:09:19 +08:00
Alexis f2a372428c fix(vcs): select a Push dialog repository row without unticking it (#6169)
In the multi-repository Push dialog, clicking a repository row to see its outgoing files also
unticked it, because the row's click toggled the checkbox. A click on the row or its name now
only selects it; the checkbox, or Space on the selected row, includes or excludes it.

Closes #6151

Co-authored-by: Rhombicdodecahedron <[email protected]>
2026-11-26 19:32:33 +08:00
faysouтаfaysou 89524bd583 fix(markdown): show Structure for large files (#6164)
Markdown files above the 5 MiB large-file threshold showed no symbols in Structure: the
large-file outline returned nothing when no language server supplied symbols. Large Markdown
files now get the heading outline from the syntax parser, within its own 16 MiB limit; other
large-file limits stay in place.

Co-authored-by: faysou <[email protected]>
2026-11-26 19:31:03 +08:00
l0ng-ai f90d94538d fix(debugger): use the spacing token for the frames error gap (#6172)
#6158 added a raw 6px gap to the frames error note, which the spacing scale test rejects on main; it now uses var(--space-1-5).
2026-11-26 19:27:47 +08:00
l0ng-aiтаCursor 2177f67e5a fix(vcs): use text cursor in read-only diff and merge viewer panes
Co-authored-by: Cursor <[email protected]>
2026-11-26 17:15:25 +08:00
12 змінених файлів з 111 додано та 32 видалено

No files matched your search

+3 -3
Переглянути файл
@@ -81,8 +81,8 @@ pub async fn doc_set_line_ending(host: &Host, window: &str, doc: DocId, line_end
/// Structure view: LSP document symbols when available (with tree-sitter
/// visibility and type-alias kinds), tree-sitter otherwise.
/// Tree-sitter answers come from the per-document tree cache (incremental
/// re-parse); large documents get no syntax structure.
/// Normal files reuse the per-document tree cache. Large Markdown files use
/// the syntax parser's size limit for heading outlines.
#[command(trust = always)]
pub async fn doc_outline(host: &Host, window: &str, doc: DocId) -> IdeResult<Vec<OutlineItem>> {
let project = host.project(window)?;
@@ -118,7 +118,7 @@ pub async fn doc_outline(host: &Host, window: &str, doc: DocId) -> IdeResult<Vec
}
items
}
None if snap.large => Vec::new(),
None if snap.large && snap.language.as_str() != "markdown" => Vec::new(),
None => syntax(),
})
})
+28 -1
Переглянути файл
@@ -2,7 +2,7 @@
mod common;
use ide_core::{ChangeSet, TextChange};
use ide_core::{ChangeSet, Pos, Range, SymbolKind, TextChange};
use ide_host::{Host, catalogue::TrustClass, ops};
use std::sync::Arc;
use std::time::Duration;
@@ -51,6 +51,33 @@ async fn edits_loose_files_without_project_services() {
assert!(!Arc::ptr_eq(&project, &light));
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn large_markdown_has_structure_after_embedded_images() {
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("paper.md");
let image = format!("![Figure](data:image/png;base64,{})\n\n", "A".repeat(64 * 1024));
let text = format!("# Paper\n\n{}```text\n## Inside code\n```\n\n## Results\n", image.repeat(84));
std::fs::write(&path, text).unwrap();
let host = host(&tmp.path().join("app"));
host.open_light("main", &path).unwrap();
let doc = ops::doc::doc_open(&host, "main", path).await.unwrap();
assert!(doc.large);
let outline = ops::doc::doc_outline(&host, "main", doc.id).await.unwrap();
assert_eq!(outline.len(), 1);
let paper = &outline[0];
assert_eq!(paper.kind, SymbolKind::Key);
assert_eq!(paper.name, "Paper");
assert_eq!(paper.selection_range, Range::new(Pos::new(0, 2), Pos::new(0, 7)));
assert_eq!(paper.children.len(), 1);
let results = &paper.children[0];
assert_eq!(results.kind, SymbolKind::Key);
assert_eq!(results.name, "Results");
assert_eq!(results.selection_range, Range::new(Pos::new(174, 3), Pos::new(174, 10)));
assert!(results.children.is_empty());
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn light_windows_ignore_project_scoped_settings() {
let tmp = tempfile::tempdir().unwrap();
+1 -2
Переглянути файл
@@ -8,8 +8,7 @@ use std::io::Write;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU32, Ordering};
/// Files above this size open with expensive features (LSP, tree-sitter
/// structure, folding) disabled.
/// Files above this size open with reduced editor features.
pub const LARGE_FILE_THRESHOLD: u64 = 5 * 1024 * 1024;
/// Files above this size open read-only.
pub const READ_ONLY_THRESHOLD: u64 = 50 * 1024 * 1024;
+2 -2
Переглянути файл
@@ -29,8 +29,8 @@ pub struct DocumentInfo {
/// (archive entries, JDT sources with an editable attachment encoding,
/// Git revisions); false for server-generated content (decompiled code).
pub can_reload_encoding: bool,
/// Larger than `ide_vfs::LARGE_FILE_THRESHOLD`: language servers, syntax
/// structure and folding are disabled; the editor should drop heavy features.
/// Marks files above `ide_vfs::LARGE_FILE_THRESHOLD` for reduced editor
/// features such as disabling language servers and folding.
#[specta(optional)]
pub large: bool,
/// Effective `.editorconfig` properties, when any section applies.
+4 -4
Переглянути файл
@@ -594,8 +594,8 @@ export const commands = {
/**
* Structure view: LSP document symbols when available (with tree-sitter
* visibility and type-alias kinds), tree-sitter otherwise.
* Tree-sitter answers come from the per-document tree cache (incremental
* re-parse); large documents get no syntax structure.
* Normal files reuse the per-document tree cache. Large Markdown files use
* the syntax parser's size limit for heading outlines.
*/
docOutline: (doc: DocId) => typedError<OutlineItem[], IdeError>(__TAURI_INVOKE("doc_outline", { doc })),
/** Python class facts for the inheritance inspections: tree-sitter, no language server. */
@@ -6432,8 +6432,8 @@ export type DocumentInfo = {
*/
canReloadEncoding: boolean,
/**
* Larger than `ide_vfs::LARGE_FILE_THRESHOLD`: language servers, syntax
* structure and folding are disabled; the editor should drop heavy features.
* Marks files above `ide_vfs::LARGE_FILE_THRESHOLD` for reduced editor
* features such as disabling language servers and folding.
*/
large?: boolean,
/** Effective `.editorconfig` properties, when any section applies. */
+10
Переглянути файл
@@ -221,6 +221,16 @@ describe("commit message draft (#4423)", () => {
expect(useCommit.getState()).toMatchObject({ author: "", authorDate: scoped.authorDate, amend: false });
});
it("loads no message for Amend with several repositories (#6149)", async () => {
useVcs.setState({ root: "/a", roots: ["/a", "/a/b"] });
type("my draft");
await setAmend(true);
expect(vcsLog).not.toHaveBeenCalled();
expect(useCommit.getState()).toMatchObject({ amend: true, message: "my draft" });
await setAmend(false);
expect(useCommit.getState()).toMatchObject({ amend: false, message: "my draft" });
});
it("keeps the typed draft, not the amended commit's message, while Amend is on", async () => {
type("my draft");
flushDraft();
+23
Переглянути файл
@@ -392,6 +392,29 @@ it("lists every repository on Push all, checks those with commits, expands none
expect(mocks.ops[0]?.repo).toBe("/p/a");
});
it("selects a repository row to show its files without unticking it; the checkbox or Space includes it", async () => {
await openPushDialog();
const box = () => screen.getByRole("checkbox", { name: "b" });
expect(box()).toBeChecked();
const name = screen.getByTitle("b");
fireEvent.mouseDown(name);
fireEvent.click(name);
expect(await screen.findByText("b.txt")).toBeInTheDocument();
expect(box()).toBeChecked();
fireEvent.click(box());
expect(box()).not.toBeChecked();
fireEvent.click(box());
expect(box()).toBeChecked();
const tree = screen.getByRole("tree", { name: "Outgoing commits" });
fireEvent.keyDown(tree, { key: " " });
expect(box()).not.toBeChecked();
fireEvent.keyDown(tree, { key: " " });
expect(box()).toBeChecked();
});
it("shows only the repository Push was invoked from without a checkbox, its files shown at once", async () => {
render(<VcsDialogHost />);
await act(() => showPushDialog({ repo: "/p/b" }));
+19
Переглянути файл
@@ -57,4 +57,23 @@ describe("viewer caret", () => {
expect(glides()).toBe(false);
release();
});
it("uses the text cursor on read-only viewer content while keeping default on scroller and gutters", () => {
const prevCursor = document.body.style.cursor;
document.body.style.cursor = "default";
try {
const view = new EditorView({
state: EditorState.create({ doc: "a\nb\n", extensions: viewerBase({ readOnly: true }) }),
parent: document.body,
});
views.push(view);
expect(getComputedStyle(view.contentDOM).cursor).toBe("text");
expect(getComputedStyle(view.scrollDOM).cursor).toBe("default");
const gutters = view.dom.querySelector(".cm-gutters");
expect(gutters).not.toBeNull();
expect(getComputedStyle(gutters!).cursor).toBe("default");
} finally {
document.body.style.cursor = prevCursor;
}
});
});
+1
Переглянути файл
@@ -417,6 +417,7 @@ export const viewerTheme = EditorView.theme(
".cm-content": {
padding: "0 0 4px",
caretColor: "var(--caret, var(--fg-strong))",
cursor: "text",
WebkitUserSelect: "text",
userSelect: "text",
},
+3
Переглянути файл
@@ -449,6 +449,9 @@ export async function setAmend(on: boolean, target: EarlierAmend | null = null)
if (data) scheduleDraft();
return;
}
// With several repositories the commit to amend is ambiguous: as in IDEA, no message is
// loaded, and the one typed amends each repository's HEAD.
if (!target && roots.length > 1) return;
const current = () => request === amendRequest && useCommit.getState().amend && useVcs.getState().root === project;
let head = target?.commit;
try {
-3
Переглянути файл
@@ -730,9 +730,6 @@
flex: 1;
min-width: 0;
}
.pushRepoName {
min-width: 20px;
}
.pushRepoLabel,
.pushSourceBranch {
display: block;
+17 -17
Переглянути файл
@@ -772,7 +772,17 @@ function MultiPushDialog({
diff={diff}
onClose={closeDiff}
commits={
<div className={styles.pushTreeWrap}>
<div
className={styles.pushTreeWrap}
onKeyDown={(e) => {
// Space on a selected repository row includes or excludes it, as its checkbox does.
const target = e.target as HTMLElement;
if (e.key !== " " || e.metaKey || e.ctrlKey || e.altKey || only !== undefined) return;
if (!shown || shown.commit || target.closest("input, button, textarea, [contenteditable]")) return;
e.preventDefault();
toggle(shown.repo.root);
}}
>
{loadErrors.map(({ root, message }) => (
<div key={root} className={styles.error} role="alert">
<strong>{repoName(root)}</strong> {message}
@@ -826,28 +836,18 @@ function MultiPushDialog({
<span
className={styles.pushRepoRow}
data-idle={(!!n.repo.branch.upstream && !n.children?.length) || undefined}
// A row click toggles the checkbox, like before; only the chevron collapses.
onClick={(e) => {
if (only === undefined && !(e.target as HTMLElement | null)?.closest?.("label"))
toggle(n.repo.root);
}}
>
{only === undefined ? (
{/* A row click only selects it (its outgoing files); the checkbox, or Space, includes it. */}
{only === undefined && (
<Checkbox
checked={checked.has(n.repo.root)}
onChange={() => toggle(n.repo.root)}
className={styles.pushRepoName}
label={
<span className={styles.pushRepoLabel} title={repoName(n.repo.root)}>
{repoName(n.repo.root)}
</span>
}
aria-label={repoName(n.repo.root)}
/>
) : (
<span className={styles.pushRepoLabel} title={repoName(n.repo.root)}>
{repoName(n.repo.root)}
</span>
)}
<span className={styles.pushRepoLabel} title={repoName(n.repo.root)}>
{repoName(n.repo.root)}
</span>
<span
className={styles.pushSourceBranch}
title={n.repo.review?.revision ?? n.repo.branch.head ?? detachedTitle(n.repo.branch.headCommit)}