Skip to content

Commit 2c43add

Browse files
authored
fix: JDK runtime setting not working with keyboard arrow (#1503)
1 parent bfcbddd commit 2c43add

File tree

1 file changed

+12
-5
lines changed
  • src/project-settings/assets/classpath/features/components

1 file changed

+12
-5
lines changed

src/project-settings/assets/classpath/features/components/JdkRuntime.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ const JdkRuntime = (): JSX.Element => {
3636
}
3737
}
3838

39+
const handleDropdownChange = (event: any) => {
40+
const selectedValue = event.target.value;
41+
handleSelectJdk(selectedValue);
42+
}
43+
3944
const onDidChangeJdk = (event: OnDidChangeJdkEvent) => {
4045
const {data} = event;
4146
if (data.command === "classpath.onDidChangeJdk") {
@@ -66,10 +71,8 @@ const JdkRuntime = (): JSX.Element => {
6671
className="setting-section-option"
6772
key={vmInstall.path}
6873
value={vmInstall.path}
69-
selected={vmInstall.path === activeVmInstallPath}
7074
onMouseEnter={() => setOptionDescription(vmInstall.path)}
7175
onMouseLeave={() => setOptionDescription(activeVmInstallPath)}
72-
onClick={() => handleSelectJdk(vmInstall.path)}
7376
>
7477
<span>{vmInstall.name}</span>
7578
</VSCodeOption>
@@ -84,7 +87,6 @@ const JdkRuntime = (): JSX.Element => {
8487
id="add-new-jdk"
8588
onMouseEnter={() => setOptionDescription("Select a JDK from the local file system.")}
8689
onMouseLeave={() => setOptionDescription(activeVmInstallPath)}
87-
onClick={() => handleSelectJdk("add-new-jdk")}
8890
>
8991
<div className="setting-section-option-action">
9092
<span className="codicon codicon-folder-opened"/>Find a local JDK...
@@ -100,7 +102,6 @@ const JdkRuntime = (): JSX.Element => {
100102
id="download-jdk"
101103
onMouseEnter={() => setOptionDescription("Download a new JDK.")}
102104
onMouseLeave={() => setOptionDescription(activeVmInstallPath)}
103-
onClick={() => handleSelectJdk("download-jdk")}
104105
>
105106
<div className="setting-section-option-action">
106107
<span className="codicon codicon-desktop-download"/>Download a new JDK...
@@ -112,7 +113,13 @@ const JdkRuntime = (): JSX.Element => {
112113
<div className="setting-section">
113114
<div className="flex-center mt-2">
114115
<span className="setting-section-description mr-1">JDK:</span>
115-
<VSCodeDropdown id="jdk-dropdown" value={activeVmInstallPath} className="setting-section-dropdown" position="below">
116+
<VSCodeDropdown
117+
id="jdk-dropdown"
118+
value={activeVmInstallPath}
119+
className="setting-section-dropdown"
120+
position="below"
121+
onChange={handleDropdownChange}
122+
>
116123
<div className="dropdown-description dropdown-above-description">
117124
<p>{optionDescription ?? activeVmInstallPath}</p>
118125
<VSCodeDivider></VSCodeDivider>

0 commit comments

Comments
 (0)