Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/architecture/windows-development-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ platform contract and enabled in the UI only when the capability exists.
2. Route workspace search, Local History, remaining non-Java LSP, Java/Maven,
and run configurations through the same dispatcher. Built-in Java LSP now
starts through the Windows host (`jdtls` + JDK discovery) and
`lsp.startServer` with `providerId: "java"`.
`lsp.startServer` with `providerId: "java"`. Spring configuration, `@Value`,
and bean-injection navigation uses `spring.index` before falling back to LSP.
3. Implement Windows-owned process, debug, update, and secure-storage flows in
Rust where the current UI exposes them.
4. Hide or capability-gate future feature surfaces until their shared backend
Expand Down
2 changes: 2 additions & 0 deletions windows/tauri/src/features/bootstrap/use-app-bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "@/features/file-system/services/file-watcher-listener";
import { useOnboardingStore } from "@/features/onboarding/stores/onboarding.store";
import { useLspInitialization } from "@/features/editor/hooks/use-lsp-initialization";
import { useSpringIndex } from "@/features/spring/hooks/use-spring-index";
import { useKeymapContext } from "@/features/keymaps/hooks/use-keymap-context";
import { useKeymaps } from "@/features/keymaps/hooks/use-keymaps";
import { useWhatsNewStore } from "@/features/settings/stores/whats-new.store";
Expand Down Expand Up @@ -42,6 +43,7 @@ export function useAppBootstrap() {
useKeymaps();
useContextMenuPrevention();
useLspInitialization();
useSpringIndex();

useEffect(() => {
let timer: number | null = null;
Expand Down
17 changes: 16 additions & 1 deletion windows/tauri/src/features/editor/components/monaco-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { useEditorStateStore } from "../stores/state.store";
import type { EditorContentChangeOptions, Position, Range } from "../types/editor.types";
import { getBufferById } from "../utils/buffer-index";
import { fileOpenBenchmark } from "../utils/file-open-benchmark";
import { isEditorGoToDefinitionModifierClick } from "../utils/go-to-definition-gesture";
import { getLanguageIdFromPath } from "../utils/language-id";
import { toggleCaseText } from "../utils/text-operations";
import { editorAPI } from "../extensions/api";
Expand Down Expand Up @@ -798,7 +799,21 @@ export function MonacoEditor({
syncCursorAndSelection();
}),
editor.onMouseDown((event) => {
if (event.event.leftButton) mouseSelectingRef.current = true;
const mouseEvent = event.event;
if (
isEditorGoToDefinitionModifierClick(mouseEvent) &&
event.target.type === monacoEditor.MouseTargetType.CONTENT_TEXT &&
event.target.position
) {
mouseEvent.preventDefault();
mouseEvent.stopPropagation();
mouseSelectingRef.current = false;
editor.setPosition(event.target.position);
syncCursorAndSelection();
void keymapRegistry.executeCommand("editor.goToDefinition");
return;
}
if (mouseEvent.leftButton) mouseSelectingRef.current = true;
}),
editor.onMouseUp(() => {
if (!mouseSelectingRef.current) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export function buildEditorContextMenuItems({
id: "find-references",
label: t("editor.findAllReferences"),
icon: <Search />,
keybinding: <Keybinding keys={["Shift", "F12"]} className="opacity-60" />,
keybinding: <Keybinding binding="cmd+b" className="opacity-60" />,
disabled: isDisabled(onFindReferences),
onClick: onFindReferences ?? noop,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { describe, expect, test } from "bun:test";
import { languageServerUnavailableMessage } from "./language-server-navigation";

describe("language server jump messages", () => {
test("does not warn when a session is already connected", () => {
expect(
languageServerUnavailableMessage({
languageId: "java",
status: "connected",
hasSession: true,
}),
).toBeNull();
});

test("reports startup, failure, and not-ready states", () => {
expect(
languageServerUnavailableMessage({
languageId: "java",
status: "connecting",
hasSession: false,
}),
).toBe("Java language server is starting.");
expect(
languageServerUnavailableMessage({
languageId: "java",
status: "error",
lastError: "Could not find jdtls. Install Eclipse JDT Language Server and add it to PATH.",
hasSession: false,
}),
).toBe("Could not find jdtls. Install Eclipse JDT Language Server and add it to PATH.");
expect(
languageServerUnavailableMessage({
languageId: "java",
status: "disconnected",
hasSession: false,
}),
).toBe("Java language server is not ready.");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { LspStatus } from "./stores/lsp.store";

export function languageDisplayName(languageId: string | undefined): string {
if (!languageId) return "Language";
if (languageId === "java") return "Java";
return languageId;
}

export function languageServerUnavailableMessage(args: {
languageId?: string;
status: LspStatus;
lastError?: string;
hasSession: boolean;
}): string | null {
if (args.hasSession && args.status === "connected") return null;

const name = languageDisplayName(args.languageId);
if (args.status === "connecting") {
return `${name} language server is starting.`;
}
if (args.status === "error") {
return args.lastError?.trim() || `${name} language server failed.`;
}
return args.lastError?.trim() || `${name} language server is not ready.`;
}
4 changes: 4 additions & 0 deletions windows/tauri/src/features/editor/lsp/lsp-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ export class LspClient {
}
}

hasSessionForFile(filePath: string): boolean {
return this.findServerKeyForFile(filePath, languageIdForEditorFile(filePath)) !== null;
}

/**
* Get display name for a language ID
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { describe, expect, test } from "bun:test";
import { isEditorGoToDefinitionModifierClick } from "./go-to-definition-gesture";

describe("IDEA-style go to definition click", () => {
test("accepts unmodified Ctrl or Cmd left clicks", () => {
expect(
isEditorGoToDefinitionModifierClick({ leftButton: true, ctrlKey: true }),
).toBe(true);
expect(
isEditorGoToDefinitionModifierClick({ leftButton: true, metaKey: true }),
).toBe(true);
});

test("ignores right clicks and extra modifiers", () => {
expect(isEditorGoToDefinitionModifierClick({ leftButton: false, ctrlKey: true })).toBe(false);
expect(
isEditorGoToDefinitionModifierClick({
leftButton: true,
ctrlKey: true,
shiftKey: true,
}),
).toBe(false);
expect(
isEditorGoToDefinitionModifierClick({
leftButton: true,
ctrlKey: true,
altKey: true,
}),
).toBe(false);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export function isEditorGoToDefinitionModifierClick(event: {
leftButton?: boolean;
ctrlKey?: boolean;
metaKey?: boolean;
altKey?: boolean;
shiftKey?: boolean;
}): boolean {
return Boolean(
event.leftButton &&
(event.ctrlKey || event.metaKey) &&
!event.altKey &&
!event.shiftKey,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ const navigationCommands: Command[] = [
id: "editor.goToReferences",
title: "Go to References",
category: "Navigation",
keybinding: "shift+F12",
keybinding: "cmd+b",
execute: goToReferences,
},
{
Expand Down
Loading
Loading