дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 08:43:07 +02:00
Порівняти коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
0f0cd312f6 | ||
|
|
14f143b703 | ||
|
|
f2a372428c | ||
|
|
89524bd583 | ||
|
|
f90d94538d | ||
|
|
2177f67e5a |
No files matched your search
@@ -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(),
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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!("\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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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" }));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -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",
|
||||
},
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -730,9 +730,6 @@
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.pushRepoName {
|
||||
min-width: 20px;
|
||||
}
|
||||
.pushRepoLabel,
|
||||
.pushSourceBranch {
|
||||
display: block;
|
||||
|
||||
@@ -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)}
|
||||
|
||||
Reference in new issue
Заблокувати користувача