diff --git a/src/index.css b/src/index.css index 013d870..ebdcdb8 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 "/*" */ diff --git a/src/ui/CodeHoverProvider.ts b/src/ui/CodeHoverProvider.ts index 53a4909..a9da4da 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 16e88e6..df74008 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; }