From be205a35765bce0fca6472a2cd25e208335e457f Mon Sep 17 00:00:00 2001 From: WisW <78122384+winsrewu@users.noreply.github.com> Date: Sat, 15 Aug 2026 07:35:49 +0800 Subject: [PATCH 1/2] Fix findTokenAtPosition() using wrong position closes #79 closes #179 --- src/ui/CodeHoverProvider.ts | 2 +- src/ui/CodeUtils.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ui/CodeHoverProvider.ts b/src/ui/CodeHoverProvider.ts index 53a49098..a9da4da1 100644 --- a/src/ui/CodeHoverProvider.ts +++ b/src/ui/CodeHoverProvider.ts @@ -142,7 +142,7 @@ export function createHoverProvider( ) { return { provideHover(model: editor.ITextModel, position: IPosition) { - const token = findTokenAtPosition(editorRef.current!, decompileResultRef.current, classListRef.current, false); + const token = findTokenAtPosition(editorRef.current!, decompileResultRef.current, classListRef.current, position, false); // Check for tokens first (classes, methods, fields, etc.) if (token) { diff --git a/src/ui/CodeUtils.ts b/src/ui/CodeUtils.ts index 16e88e6d..df740086 100644 --- a/src/ui/CodeUtils.ts +++ b/src/ui/CodeUtils.ts @@ -1,4 +1,4 @@ -import { editor } from "monaco-editor"; +import { editor, type IPosition } from "monaco-editor"; import { type Token } from '../logic/Tokens'; import { toClassFilePath, type ClassFilePath } from "../utils/Names"; @@ -6,6 +6,7 @@ export function findTokenAtPosition( editor: editor.ICodeEditor, decompileResult: { tokens: Token[]; } | undefined, classList: ClassFilePath[] | undefined, + position: IPosition | undefined | null = undefined, useClassList = true ): Token | null { const model = editor.getModel(); @@ -13,7 +14,10 @@ export function findTokenAtPosition( return null; } - const position = editor.getPosition(); + if (!position) { + position = editor.getPosition(); + } + if (!position) { return null; } From 2e239cf0ea508b1d6218888afe3c47867d72b90a Mon Sep 17 00:00:00 2001 From: WisW <78122384+winsrewu@users.noreply.github.com> Date: Sat, 15 Aug 2026 07:51:06 +0800 Subject: [PATCH 2/2] Remove point cursor style while hovering certain tokens Try to fix #78, but that requires successful target analysis, which can't be done easily. --- src/index.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/index.css b/src/index.css index 013d8706..ebdcdb88 100644 --- a/src/index.css +++ b/src/index.css @@ -52,19 +52,16 @@ html, body, #root { .class-token-decoration-pointer { color: var(--token-class) !important; - cursor: pointer; } .field-token-decoration-pointer, .parameter-token-decoration-pointer, .local-token-decoration-pointer { color: var(--token-field) !important; - cursor: pointer; } .method-token-decoration-pointer { color: var(--token-method) !important; - cursor: pointer; } /* Control comment marker and content color, eg "/*" */