Skip to content

Commit 87af98b

Browse files
authored
Merge pull request #2455 from Haehnchen/feature/yaml-schema-validation-notif
Add notification banner for "Symfony 7.4 JSON schema hint for better autocompletion"
2 parents 7f86d8f + a468c52 commit 87af98b

File tree

6 files changed

+456
-11
lines changed

6 files changed

+456
-11
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/Settings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public class Settings implements PersistentStateComponent<Settings> {
6464
public boolean twigBundleNamespaceSupport = false;
6565

6666
public boolean dismissEnableNotification = false;
67+
public boolean dismissYamlSchemaNotification = false;
6768

6869
public boolean profilerLocalEnabled = false;
6970
public String profilerLocalUrl = "http://127.0.0.1:8000";

src/main/java/fr/adrienbrault/idea/symfony2plugin/SettingsForm.form

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
<rowspec value="center:max(d;4px):noGrow"/>
4141
<rowspec value="top:4dlu:noGrow"/>
4242
<rowspec value="center:max(d;4px):noGrow"/>
43+
<rowspec value="top:4dlu:noGrow"/>
44+
<rowspec value="center:max(d;4px):noGrow"/>
4345
<colspec value="fill:max(d;4px):noGrow"/>
4446
<colspec value="left:4dlu:noGrow"/>
4547
<colspec value="fill:d:grow"/>
@@ -209,7 +211,7 @@
209211
</component>
210212
<component id="58414" class="javax.swing.JLabel" binding="directoryToAppLabel">
211213
<constraints>
212-
<grid row="30" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
214+
<grid row="32" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
213215
<forms/>
214216
</constraints>
215217
<properties>
@@ -218,7 +220,7 @@
218220
</component>
219221
<component id="c6525" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="directoryToApp">
220222
<constraints>
221-
<grid row="30" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
223+
<grid row="32" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
222224
<preferred-size width="150" height="-1"/>
223225
</grid>
224226
<forms defaultalign-horz="false"/>
@@ -227,7 +229,7 @@
227229
</component>
228230
<component id="b7268" class="javax.swing.JButton" binding="directoryToAppReset">
229231
<constraints>
230-
<grid row="30" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
232+
<grid row="32" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
231233
<forms/>
232234
</constraints>
233235
<properties>
@@ -236,7 +238,7 @@
236238
</component>
237239
<component id="4cd0" class="javax.swing.JLabel">
238240
<constraints>
239-
<grid row="28" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
241+
<grid row="30" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
240242
<forms/>
241243
</constraints>
242244
<properties>
@@ -245,14 +247,24 @@
245247
</component>
246248
<component id="3c3bc" class="javax.swing.JCheckBox" binding="featureTypeProvider">
247249
<constraints>
248-
<grid row="26" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
250+
<grid row="28" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
249251
<forms/>
250252
</constraints>
251253
<properties>
252254
<text value="Type Provider"/>
253255
<toolTipText value="Resolve return type via parameter eg &quot;ContainerInterface::get, EntityManager::find&quot;"/>
254256
</properties>
255257
</component>
258+
<component id="dismissYamlSchema" class="javax.swing.JCheckBox" binding="dismissYamlSchemaNotification">
259+
<constraints>
260+
<grid row="26" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
261+
<forms/>
262+
</constraints>
263+
<properties>
264+
<text value="Dismiss YAML Schema Notification"/>
265+
<toolTipText value="Don't show notification banner suggesting to add YAML schema hint for Symfony service files"/>
266+
</properties>
267+
</component>
256268
</children>
257269
</grid>
258270
<component id="2ef99" class="javax.swing.JCheckBox" binding="pluginEnabled">

src/main/java/fr/adrienbrault/idea/symfony2plugin/SettingsForm.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class SettingsForm implements Configurable {
6767
private JCheckBox featureTwigIcon;
6868
private JButton buttonAutoConfigure;
6969
private JCheckBox featureTypeProvider;
70+
private JCheckBox dismissYamlSchemaNotification;
7071

7172
public SettingsForm(@NotNull final Project project) {
7273
this.project = project;
@@ -143,6 +144,7 @@ public boolean isModified() {
143144
|| !codeFoldingTwigConstant.isSelected() == getSettings().codeFoldingTwigConstant
144145
|| !featureTwigIcon.isSelected() == getSettings().featureTwigIcon
145146
|| !featureTypeProvider.isSelected() == getSettings().featureTypeProvider
147+
|| !dismissYamlSchemaNotification.isSelected() == getSettings().dismissYamlSchemaNotification
146148

147149
|| !directoryToApp.getText().equals(getSettings().directoryToApp)
148150
|| !directoryToWeb.getText().equals(getSettings().directoryToWeb)
@@ -165,6 +167,7 @@ public void apply() throws ConfigurationException {
165167
getSettings().codeFoldingTwigConstant = codeFoldingTwigConstant.isSelected();
166168
getSettings().featureTwigIcon = featureTwigIcon.isSelected();
167169
getSettings().featureTypeProvider = featureTypeProvider.isSelected();
170+
getSettings().dismissYamlSchemaNotification = dismissYamlSchemaNotification.isSelected();
168171

169172
getSettings().directoryToApp = directoryToApp.getText();
170173
getSettings().directoryToWeb = directoryToWeb.getText();
@@ -198,6 +201,7 @@ private void updateUIFromSettings() {
198201
codeFoldingTwigConstant.setSelected(getSettings().codeFoldingTwigConstant);
199202
featureTwigIcon.setSelected(getSettings().featureTwigIcon);
200203
featureTypeProvider.setSelected(getSettings().featureTypeProvider);
204+
dismissYamlSchemaNotification.setSelected(getSettings().dismissYamlSchemaNotification);
201205

202206
directoryToApp.setText(getSettings().directoryToApp);
203207
directoryToWeb.setText(getSettings().directoryToWeb);
@@ -275,7 +279,7 @@ public static void show(@NotNull Project project) {
275279
panel1 = new JPanel();
276280
panel1.setLayout(new GridLayoutManager(2, 5, new Insets(0, 0, 0, 0), -1, -1));
277281
final JPanel panel2 = new JPanel();
278-
panel2.setLayout(new FormLayout("fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow", "center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:6dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
282+
panel2.setLayout(new FormLayout("fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow", "center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:6dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
279283
panel1.add(panel2, new GridConstraints(1, 0, 1, 5, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
280284
directoryToWebLabel = new JLabel();
281285
directoryToWebLabel.setText("Web Directory");
@@ -332,19 +336,23 @@ public static void show(@NotNull Project project) {
332336
panel2.add(featureTwigIcon, cc.xy(3, 25));
333337
directoryToAppLabel = new JLabel();
334338
directoryToAppLabel.setText("App Directory");
335-
panel2.add(directoryToAppLabel, cc.xy(1, 31));
339+
panel2.add(directoryToAppLabel, cc.xy(1, 33));
336340
directoryToApp = new TextFieldWithBrowseButton();
337-
panel2.add(directoryToApp, cc.xy(3, 31, CellConstraints.FILL, CellConstraints.DEFAULT));
341+
panel2.add(directoryToApp, cc.xy(3, 33, CellConstraints.FILL, CellConstraints.DEFAULT));
338342
directoryToAppReset = new JButton();
339343
directoryToAppReset.setText("Default");
340-
panel2.add(directoryToAppReset, cc.xy(5, 31));
344+
panel2.add(directoryToAppReset, cc.xy(5, 33));
341345
final JLabel label5 = new JLabel();
342346
label5.setText("Legacy Features");
343-
panel2.add(label5, cc.xy(1, 29));
347+
panel2.add(label5, cc.xy(1, 31));
344348
featureTypeProvider = new JCheckBox();
345349
featureTypeProvider.setText("Type Provider");
346350
featureTypeProvider.setToolTipText("Resolve return type via parameter eg \"ContainerInterface::get, EntityManager::find\"");
347-
panel2.add(featureTypeProvider, cc.xy(3, 27));
351+
panel2.add(featureTypeProvider, cc.xy(3, 29));
352+
dismissYamlSchemaNotification = new JCheckBox();
353+
dismissYamlSchemaNotification.setText("Dismiss YAML Schema Notification");
354+
dismissYamlSchemaNotification.setToolTipText("Don't show notification banner suggesting to add YAML schema hint for Symfony service files");
355+
panel2.add(dismissYamlSchemaNotification, cc.xy(3, 27));
348356
pluginEnabled = new JCheckBox();
349357
pluginEnabled.setText("Enable for Project (needs restart)");
350358
panel1.add(pluginEnabled, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));

0 commit comments

Comments
 (0)