Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/javadoc/JavadocMarkdownEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useObservable } from "../utils/UseObservable";
import { currentResult } from "../logic/Decompiler";
import { useEffect, useRef } from "react";
import type { editor } from "monaco-editor";
import { JavdocCompletionProvider } from "./JavadocCmpletionProvider";
import { JavdocCompletionProvider } from "./JavadocCompletionProvider";

const JavadocMarkdownEditor = ({
value,
Expand Down Expand Up @@ -47,4 +47,4 @@ const JavadocMarkdownEditor = ({
);
};

export default JavadocMarkdownEditor;
export default JavadocMarkdownEditor;
3 changes: 2 additions & 1 deletion src/logic/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const agreedEula = new BooleanSetting('eula', false);
export const enableTabs = new BooleanSetting('enable_tabs', true);
export const displayLambdas = new BooleanSetting('display_lambdas', false);
export const bytecode = new BooleanSetting('bytecode', false);
export const showLines = new BooleanSetting('showLines', true);
export const focusSearch = new KeybindSetting('focus_search', 'Ctrl+ ');

export const supportsPermalinking = combineLatest([displayLambdas.observable, bytecode.observable]).pipe(
Expand All @@ -130,4 +131,4 @@ export const supportsPermalinking = combineLatest([displayLambdas.observable, by
export function resetPermalinkAffectingSettings(): void {
displayLambdas.value = false;
bytecode.value = false;
}
}
8 changes: 6 additions & 2 deletions src/ui/FileList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { selectedFile } from '../logic/State';
import { useState } from 'react';
import type { Key } from 'antd/es/table/interface';
import { openTab } from '../logic/Tabs';
import { showLines } from '../logic/Settings';

// Sorts nodes with children first (directories before files), then alphabetically
const sortTreeNodes = (nodes: TreeDataNode[] = []) => {
Expand Down Expand Up @@ -41,7 +42,7 @@ const data: Observable<TreeDataNode[]> = classesList.pipe(
title: part.replace('.class', ''),
key: parts.slice(0, index + 1).join('/'),
children: [],
isLeaf: index === parts.length - 1
isLeaf: index === parts.length - 1,
};
currentLevel.push(existingNode);
}
Expand Down Expand Up @@ -74,8 +75,10 @@ function getPathKeys(filePath: string): Key[] {
const FileList = () => {
const [expandedKeys, setExpandedKeys] = useState<Key[]>();

const showLine = useObservable(showLines.observable);
const selectedKeys = useObservable(selectedFileKeys);
const classes = useObservable(classesList);

const onSelect: TreeProps['onSelect'] = (selectedKeys) => {
if (selectedKeys.length === 0) return;
if (!classes || !classes.includes(selectedKeys[0] as string)) return;
Expand All @@ -88,9 +91,10 @@ const FileList = () => {
setExpandedKeys(getPathKeys(selectedKeys[0]));
}


return (
<Tree.DirectoryTree
showLine
showLine={showLine}
switcherIcon={<CaretDownFilled />}
selectedKeys={selectedKeys}
onSelect={onSelect}
Expand Down
5 changes: 3 additions & 2 deletions src/ui/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Modal, type CheckboxProps, Form, Tooltip } from "antd";
import { SettingOutlined } from '@ant-design/icons';
import { Checkbox } from 'antd';
import { useObservable } from "../utils/UseObservable";
import { BooleanSetting, enableTabs, displayLambdas, focusSearch, KeybindSetting, type KeybindValue, bytecode } from "../logic/Settings";
import { BooleanSetting, enableTabs, showLines, displayLambdas, focusSearch, KeybindSetting, type KeybindValue, bytecode } from "../logic/Settings";
import { capturingKeybind, rawKeydownEvent } from "../logic/Keybinds";
import { BehaviorSubject } from "rxjs";

Expand Down Expand Up @@ -30,6 +30,7 @@ const SettingsModal = () => {
>
<Form layout="horizontal" labelCol={{ span: 8 }} wrapperCol={{ span: 16 }}>
<BooleanToggle setting={enableTabs} title={"Enable Tabs"} />
<BooleanToggle setting={showLines} title={"Show Lines"} />
<BooleanToggle setting={displayLambdas} title={"Lambda Names"} tooltip="Display lambda names as inline comments. Does not support permalinking." disabled={bytecodeValue} />
<BooleanToggle setting={bytecode} title={"Show Bytecode"} tooltip="Show bytecode instructions alongside decompiled source. Does not support permalinking." disabled={displayLambdasValue} />
<KeybindControl setting={focusSearch} title={"Focus Search"} />
Expand Down Expand Up @@ -111,4 +112,4 @@ const KeybindControl: React.FC<KeybindProps> = ({ setting, title }) => {
);
};

export default SettingsModal;
export default SettingsModal;