дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-13 13:15:42 +02:00
Порівняти коміти
1
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
4a667b2cd2 |
No files matched your search
@@ -46,7 +46,7 @@ it("keeps mapped lenses across edits instead of clearing them (#2710)", async ()
|
||||
data: [
|
||||
{
|
||||
range: { start: { line: 1, col: 0 }, end: { line: 1, col: 3 } },
|
||||
command: { title: "Run test", command: "csharp.runTest", arguments: [] },
|
||||
command: { title: "1 reference", command: "csharp.showReferences", arguments: [] },
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -67,27 +67,5 @@ it("keeps mapped lenses across edits instead of clearing them (#2710)", async ()
|
||||
const after = view.state.facet(codeLenses);
|
||||
expect(after).toHaveLength(1);
|
||||
expect(after[0]!.pos).toBe(posBefore + 1);
|
||||
expect(after[0]!.title).toBe("Run test");
|
||||
});
|
||||
|
||||
it("leaves reference counts to Code Vision's usages", async () => {
|
||||
vi.useFakeTimers();
|
||||
const lens = (line: number, title: string) => ({
|
||||
range: { start: { line, col: 0 }, end: { line, col: 1 } },
|
||||
command: { title, command: "csharp.showReferences", arguments: [] },
|
||||
});
|
||||
ipc.lspCodeLens.mockResolvedValue({
|
||||
status: "ok",
|
||||
data: [lens(0, "3 Reference(s)"), lens(1, "1 reference"), lens(2, "12 references"), lens(3, "2 implementations")],
|
||||
});
|
||||
const view = new EditorView({
|
||||
state: EditorState.create({
|
||||
doc: "a\nb\nc\nd",
|
||||
extensions: serverCodeLenses({ doc: 1, path: "/p/a.cs", language: "csharp", uiMode: null, readOnly: false }),
|
||||
}),
|
||||
parent: document.body,
|
||||
});
|
||||
views.push(view);
|
||||
await vi.advanceTimersByTimeAsync(400);
|
||||
expect(view.state.facet(codeLenses).map((l) => l.title)).toEqual(["2 implementations"]);
|
||||
expect(after[0]!.title).toBe("1 reference");
|
||||
});
|
||||
@@ -6,12 +6,6 @@ import { call, commands } from "@/platform/ipc";
|
||||
import { onNavigationProvidersChanged } from "@/editor/navigationProviders";
|
||||
import { posToOffset } from "./positions";
|
||||
import { onLspRefresh, onServerSettled } from "./availability";
|
||||
/**
|
||||
* A server's reference count ("3 references", csharp-ls's "3 Reference(s)"): Code Vision's
|
||||
* Usages shows the same count above the declaration, under its own setting.
|
||||
*/
|
||||
const REFERENCE_COUNT = /^\s*\d+\s+references?(\(s\))?\s*$/i;
|
||||
|
||||
const set = StateEffect.define<CodeLens[]>();
|
||||
const field = StateField.define<CodeLens[]>({
|
||||
create: () => [],
|
||||
@@ -68,7 +62,7 @@ export function serverCodeLenses(ctx: EditorDocContext): Extension {
|
||||
view.dispatch({
|
||||
effects: set.of(
|
||||
result.flatMap((l) =>
|
||||
l.command && !REFERENCE_COUNT.test(l.command.title)
|
||||
l.command
|
||||
? [
|
||||
{
|
||||
pos: posToOffset(text, l.range.start),
|
||||
|
||||
@@ -48,11 +48,6 @@ import { forgetMemory } from "./memory/memoryState";
|
||||
const useAnyOverlay = () =>
|
||||
useOverlays((s) => !!(s.popover || s.evaluate || s.breakpoints || s.chooser || s.attach || s.smartStep));
|
||||
|
||||
/** The Debug stripe button's badge, like Run's: how many debug sessions (child sessions aside) are live. */
|
||||
function useLiveSessionCount(): number | null {
|
||||
return useDebug((s) => Object.values(s.sessions).filter((x) => x.parent === null && isLive(x)).length || null);
|
||||
}
|
||||
|
||||
export function activate(): () => void {
|
||||
useDebugRunSessions.setState({
|
||||
Console: lazyComponent(() => import("./ui/DebugConsole").then((m) => m.DebugServiceConsole)),
|
||||
@@ -76,7 +71,6 @@ export function activate(): () => void {
|
||||
order: 20,
|
||||
component: lazyComponent(() => import("./ui/DebugToolWindow").then((m) => m.DebugToolWindow)),
|
||||
headerContent: lazyComponent(() => import("./ui/DebugToolWindow").then((m) => m.DebugTabs)),
|
||||
useBadge: useLiveSessionCount,
|
||||
}),
|
||||
registerEditorKind(heapEditorKind),
|
||||
installHeapContext(),
|
||||
|
||||
@@ -176,7 +176,30 @@ export function DebugToolWindow() {
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<div className={styles.toolbar} role="toolbar" aria-label={tx("Debugger actions")}>
|
||||
{/* IDEA's XDebugger.ToolWindow.TopToolbar3 (+ its "More" group), then the views. */}
|
||||
<div role="tablist" aria-label={tx("Debug views")} className={styles.tabs}>
|
||||
{(
|
||||
[
|
||||
["variables", "Threads & Variables"],
|
||||
["console", "Console"],
|
||||
...(hasMemory ? [["memory", "Memory"] as const] : []),
|
||||
] as const
|
||||
).map(([id, label]) => (
|
||||
<button
|
||||
key={id}
|
||||
type="button"
|
||||
role="tab"
|
||||
id={`debug-tab-${id}`}
|
||||
aria-selected={tab === id}
|
||||
aria-controls={`debug-panel-${id}`}
|
||||
className={clsx(styles.tab, tab === id && styles.tabActive)}
|
||||
onClick={() => setView({ session: active.startedAt, status: active.status, tab: id })}
|
||||
>
|
||||
{tx(label)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{/* IDEA's XDebugger.ToolWindow.TopToolbar3 (+ its "More" group). */}
|
||||
<span className={styles.sep} aria-hidden />
|
||||
<ToolButton action="debug.rerun" icon="rerun" />
|
||||
<ToolButton action="debug.stop" icon="stop" tone="danger" />
|
||||
<span className={styles.sep} aria-hidden />
|
||||
@@ -210,29 +233,6 @@ export function DebugToolWindow() {
|
||||
onClick={() => setMuted(!muted)}
|
||||
/>
|
||||
<MoreActions />
|
||||
<span className={styles.sep} aria-hidden />
|
||||
<div role="tablist" aria-label={tx("Debug views")} className={styles.tabs}>
|
||||
{(
|
||||
[
|
||||
["variables", "Threads & Variables"],
|
||||
["console", "Console"],
|
||||
...(hasMemory ? [["memory", "Memory"] as const] : []),
|
||||
] as const
|
||||
).map(([id, label]) => (
|
||||
<button
|
||||
key={id}
|
||||
type="button"
|
||||
role="tab"
|
||||
id={`debug-tab-${id}`}
|
||||
aria-selected={tab === id}
|
||||
aria-controls={`debug-panel-${id}`}
|
||||
className={clsx(styles.tab, tab === id && styles.tabActive)}
|
||||
onClick={() => setView({ session: active.startedAt, status: active.status, tab: id })}
|
||||
>
|
||||
{tx(label)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div role="tabpanel" id={`debug-panel-${tab}`} aria-labelledby={`debug-tab-${tab}`} className={styles.panel}>
|
||||
{tab === "variables" ? (
|
||||
@@ -251,12 +251,7 @@ export function DebugToolWindow() {
|
||||
|
||||
function ThreadsAndVariables({ session }: { session: DebugSession }) {
|
||||
return (
|
||||
<SplitGroup
|
||||
orientation="horizontal"
|
||||
id="debug-threads-variables"
|
||||
storageKey="openidea.debug.threadsVariables"
|
||||
className={styles.split}
|
||||
>
|
||||
<SplitGroup orientation="horizontal" id="debug-threads-variables" className={styles.split}>
|
||||
<SplitPanel id="frames" defaultSize="34%" minSize="160px">
|
||||
<FramesPane session={session} />
|
||||
</SplitPanel>
|
||||
|
||||
Reference in new issue
Заблокувати користувача