|
4 | 4 | import { VSCodeCheckbox, VSCodeDataGrid, VSCodeDataGridCell, VSCodeDataGridRow, VSCodeDivider, VSCodeDropdown, VSCodeLink, VSCodeOption } from "@vscode/webview-ui-toolkit/react";
|
5 | 5 | import React, { Dispatch, useEffect } from "react";
|
6 | 6 | import { useDispatch, useSelector } from "react-redux";
|
7 |
| -import { updateCompilerSettings, updateAvailableComplianceLevels } from "./compilerConfigurationViewSlice"; |
| 7 | +import { updateCompilerSettings, updateAvailableComplianceLevels, flushCompilerSettingsToEffective } from "./compilerConfigurationViewSlice"; |
8 | 8 | import { CompilerRequest } from "../../vscode/utils";
|
9 | 9 | import { VmInstall } from "../../../types";
|
10 | 10 | import { updateActiveSection } from "../../mainpage/features/commonSlice";
|
11 | 11 | import { updateActiveTab } from "../../classpath/features/classpathConfigurationViewSlice";
|
| 12 | +import Hint from "./components/Hint"; |
12 | 13 |
|
13 | 14 | const CompilerConfigurationView = (): JSX.Element | null => {
|
14 | 15 |
|
@@ -65,6 +66,9 @@ const CompilerConfigurationView = (): JSX.Element | null => {
|
65 | 66 | generateDebugInfo: message.generateDebugInfo,
|
66 | 67 | storeMethodParamNames: message.storeMethodParamNames
|
67 | 68 | }));
|
| 69 | + dispatch(flushCompilerSettingsToEffective({ |
| 70 | + activeProjectIndex, |
| 71 | + })); |
68 | 72 | }
|
69 | 73 | };
|
70 | 74 |
|
@@ -99,14 +103,14 @@ const CompilerConfigurationView = (): JSX.Element | null => {
|
99 | 103 | };
|
100 | 104 |
|
101 | 105 | const onClickUseRelease = (e: any) => {
|
102 |
| - dispatch(updateCompilerSettings({ |
| 106 | + dispatch(updateCompilerSettings({ |
103 | 107 | activeProjectIndex,
|
104 | 108 | useRelease: e.target.checked
|
105 | 109 | }));
|
106 | 110 | };
|
107 | 111 |
|
108 | 112 | const onClickEnablePreview = (e: any) => {
|
109 |
| - dispatch(updateCompilerSettings({ |
| 113 | + dispatch(updateCompilerSettings({ |
110 | 114 | activeProjectIndex,
|
111 | 115 | enablePreview: e.target.checked
|
112 | 116 | }));
|
@@ -153,66 +157,70 @@ const CompilerConfigurationView = (): JSX.Element | null => {
|
153 | 157 | };
|
154 | 158 |
|
155 | 159 | return (
|
156 |
| - <div className="setting-section"> |
157 |
| - <div className={showReleaseFlag ? "" : "invisible"}> |
158 |
| - <VSCodeCheckbox checked={useRelease} onClick={onClickUseRelease}>Use '--release' option for cross-compilation (Java 9 and later)</VSCodeCheckbox> |
159 |
| - </div> |
160 |
| - <div> |
161 |
| - <VSCodeDataGrid gridTemplateColumns="40% 60%"> |
162 |
| - <VSCodeDataGridRow className={showReleaseFlag && useRelease ? "" : "invisible"}> |
163 |
| - <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="1"> |
164 |
| - <span>Bytecode version:</span> |
165 |
| - </VSCodeDataGridCell> |
166 |
| - <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="2"> |
167 |
| - <VSCodeDropdown value={complianceLevel}> |
168 |
| - {jdkLevels(complianceLevel, "compliance", onClickComplianceLevel)} |
169 |
| - </VSCodeDropdown> |
170 |
| - </VSCodeDataGridCell> |
171 |
| - </VSCodeDataGridRow> |
172 |
| - <VSCodeDataGridRow className={showReleaseFlag && useRelease ? "invisible" : ""}> |
173 |
| - <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="1"> |
174 |
| - <span>Source compatibility:</span> |
175 |
| - </VSCodeDataGridCell> |
176 |
| - <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="2"> |
177 |
| - <VSCodeDropdown value={sourceLevel}> |
178 |
| - {jdkLevels(sourceLevel, "source", onClickSourceLevel)} |
179 |
| - </VSCodeDropdown> |
180 |
| - </VSCodeDataGridCell> |
181 |
| - </VSCodeDataGridRow> |
182 |
| - <VSCodeDataGridRow className={showReleaseFlag && useRelease ? "invisible" : ""}> |
183 |
| - <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="1"> |
184 |
| - <span>Target compatibility:</span> |
185 |
| - </VSCodeDataGridCell> |
186 |
| - <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="2"> |
187 |
| - <VSCodeDropdown value={targetLevel}> |
188 |
| - {jdkLevels(targetLevel, "target", onClickTargetLevel)} |
189 |
| - </VSCodeDropdown> |
190 |
| - </VSCodeDataGridCell> |
191 |
| - </VSCodeDataGridRow> |
192 |
| - </VSCodeDataGrid> |
193 |
| - </div> |
194 |
| - <div className={`mt-2 mb-2 ${showSourceTargetWarning ? "" : "invisible"}`}> |
195 |
| - <span className="setting-section-warning"> |
196 |
| - Target compatibility must be equal or greater than source compatibility. |
197 |
| - </span> |
198 |
| - </div> |
199 |
| - <div className={`mt-2 mb-2 ${showJdkLevelWarning ? "" : "invisible"}`}> |
200 |
| - <span className="setting-section-warning"> |
201 |
| - Please make sure to have a compatible JDK configured (currently {currentJdkComplianceLevel}). You can change the JDK under the <VSCodeLink href="" onClick={() => onClickChangeJdk()}>JDK Runtime</VSCodeLink> tab. |
202 |
| - </span> |
203 |
| - </div> |
204 |
| - <div className={showPreviewFlag ? "" : "invisible"}> |
205 |
| - <VSCodeCheckbox checked={enablePreview} onClick={onClickEnablePreview}>Enable preview features</VSCodeCheckbox> |
206 |
| - </div> |
207 |
| - <VSCodeDivider className="mt-3"/> |
208 |
| - <h4 className="mt-3 mb-3">Class File Generation</h4> |
209 |
| - <div> |
210 |
| - <VSCodeCheckbox checked={generateDebugInfo} onClick={onClickGenerateDebugInfo}>Generate debugging information</VSCodeCheckbox> |
211 |
| - </div> |
212 |
| - <div> |
213 |
| - <VSCodeCheckbox checked={storeMethodParamNames} onClick={onClickStoreMethodParamNames}>Store information about method parameters</VSCodeCheckbox> |
| 160 | + <div className="root"> |
| 161 | + <div className="setting-section"> |
| 162 | + <div className={showReleaseFlag ? "" : "invisible"}> |
| 163 | + <VSCodeCheckbox checked={useRelease} onClick={onClickUseRelease}>Use '--release' option for cross-compilation (Java 9 and later)</VSCodeCheckbox> |
| 164 | + </div> |
| 165 | + <div> |
| 166 | + <VSCodeDataGrid gridTemplateColumns="40% 60%"> |
| 167 | + <VSCodeDataGridRow className={showReleaseFlag && useRelease ? "" : "invisible"}> |
| 168 | + <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="1"> |
| 169 | + <span>Bytecode version:</span> |
| 170 | + </VSCodeDataGridCell> |
| 171 | + <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="2"> |
| 172 | + <VSCodeDropdown value={complianceLevel}> |
| 173 | + {jdkLevels(complianceLevel, "compliance", onClickComplianceLevel)} |
| 174 | + </VSCodeDropdown> |
| 175 | + </VSCodeDataGridCell> |
| 176 | + </VSCodeDataGridRow> |
| 177 | + <VSCodeDataGridRow className={showReleaseFlag && useRelease ? "invisible" : ""}> |
| 178 | + <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="1"> |
| 179 | + <span>Source compatibility:</span> |
| 180 | + </VSCodeDataGridCell> |
| 181 | + <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="2"> |
| 182 | + <VSCodeDropdown value={sourceLevel}> |
| 183 | + {jdkLevels(sourceLevel, "source", onClickSourceLevel)} |
| 184 | + </VSCodeDropdown> |
| 185 | + </VSCodeDataGridCell> |
| 186 | + </VSCodeDataGridRow> |
| 187 | + <VSCodeDataGridRow className={showReleaseFlag && useRelease ? "invisible" : ""}> |
| 188 | + <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="1"> |
| 189 | + <span>Target compatibility:</span> |
| 190 | + </VSCodeDataGridCell> |
| 191 | + <VSCodeDataGridCell className="flex-center pl-0 pr-0" gridColumn="2"> |
| 192 | + <VSCodeDropdown value={targetLevel}> |
| 193 | + {jdkLevels(targetLevel, "target", onClickTargetLevel)} |
| 194 | + </VSCodeDropdown> |
| 195 | + </VSCodeDataGridCell> |
| 196 | + </VSCodeDataGridRow> |
| 197 | + </VSCodeDataGrid> |
| 198 | + </div> |
| 199 | + <div className={`mt-2 mb-2 ${showSourceTargetWarning ? "" : "invisible"}`}> |
| 200 | + <span className="setting-section-warning"> |
| 201 | + Target compatibility must be equal or greater than source compatibility. |
| 202 | + </span> |
| 203 | + </div> |
| 204 | + <div className={`mt-2 mb-2 ${showJdkLevelWarning ? "" : "invisible"}`}> |
| 205 | + <span className="setting-section-warning"> |
| 206 | + Please make sure to have a compatible JDK configured (currently {currentJdkComplianceLevel}). You can change the JDK under the <VSCodeLink href="" onClick={() => onClickChangeJdk()}>JDK Runtime</VSCodeLink> tab. |
| 207 | + </span> |
| 208 | + </div> |
| 209 | + <div className={showPreviewFlag ? "" : "invisible"}> |
| 210 | + <VSCodeCheckbox checked={enablePreview} onClick={onClickEnablePreview}>Enable preview features</VSCodeCheckbox> |
| 211 | + </div> |
| 212 | + <VSCodeDivider className="mt-3" /> |
| 213 | + <h4 className="mt-3 mb-3">Class File Generation</h4> |
| 214 | + <div> |
| 215 | + <VSCodeCheckbox checked={generateDebugInfo} onClick={onClickGenerateDebugInfo}>Generate debugging information</VSCodeCheckbox> |
| 216 | + </div> |
| 217 | + <div> |
| 218 | + <VSCodeCheckbox checked={storeMethodParamNames} onClick={onClickStoreMethodParamNames}>Store information about method parameters</VSCodeCheckbox> |
| 219 | + </div> |
214 | 220 | </div>
|
215 |
| - </div>) |
| 221 | + <Hint /> |
| 222 | + </div> |
| 223 | + ) |
216 | 224 | }
|
217 | 225 |
|
218 | 226 | function parseJavaVersion(version: string): number {
|
|
0 commit comments