diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/BooleanPreferences.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/BooleanPreferences.java index a24d2a5..1d31b44 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/BooleanPreferences.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/BooleanPreferences.java @@ -20,7 +20,8 @@ public enum BooleanPreferences implements Preference { UPDATE_GEM("AutoUpdate", "Automatically update gems", true), SYSTEM_RUBY("SystemRuby", "Launch files using the Ruby installation from the PATH environment variable", true), - DEBUG_READAPT("DebugReadapt", "Troubleshoot the Readapt debugger by adding an output to the Console view", false); + DEBUG_READAPT("DebugReadapt", "Troubleshoot the Readapt debugger by adding an output to the Console view", false), + SOLARGRAPH_DIAGNOSTICS("SolargraphDiagnostics", "Display compiler warnings and other diagnostics (restart needed)", true); private final String key; private final String desc; diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferenceInitializer.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferenceInitializer.java index 27029db..008fe38 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferenceInitializer.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019-2021 Pierre-Yves B. and others. + * Copyright (c) 2019-2024 Pierre-Yves B. and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,6 +13,7 @@ package io.github.pyvesb.eclipse_solargraph.preferences; import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.DEBUG_READAPT; +import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.SOLARGRAPH_DIAGNOSTICS; import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.SYSTEM_RUBY; import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.UPDATE_GEM; import static io.github.pyvesb.eclipse_solargraph.preferences.StringPreferences.GEM_PATH; @@ -36,6 +37,7 @@ public void initializeDefaultPreferences() { defaultPreferences.putBoolean(UPDATE_GEM.getKey(), UPDATE_GEM.getDef()); defaultPreferences.putBoolean(SYSTEM_RUBY.getKey(), SYSTEM_RUBY.getDef()); defaultPreferences.putBoolean(DEBUG_READAPT.getKey(), DEBUG_READAPT.getDef()); + defaultPreferences.putBoolean(SOLARGRAPH_DIAGNOSTICS.getKey(), SOLARGRAPH_DIAGNOSTICS.getDef()); defaultPreferences.put(RUBY_DIR.getKey(), RUBY_DIR.getDef()); } diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferencePage.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferencePage.java index 093903d..b4d39b5 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferencePage.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/preferences/PreferencePage.java @@ -13,6 +13,7 @@ package io.github.pyvesb.eclipse_solargraph.preferences; import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.DEBUG_READAPT; +import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.SOLARGRAPH_DIAGNOSTICS; import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.SYSTEM_RUBY; import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.UPDATE_GEM; import static io.github.pyvesb.eclipse_solargraph.preferences.StringPreferences.GEM_PATH; @@ -105,9 +106,13 @@ public void createFieldEditors() { addField(rubyDirFieldEditor); Group optionsGroup = new Group(parent, SWT.NONE); - optionsGroup.setText("Miscellaneous"); + optionsGroup.setText("Other options"); optionsGroup.setLayout(new GridLayout(1, false)); optionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + BooleanFieldEditor solargraphDiagnosticsFieldEditor = new BooleanFieldEditor(SOLARGRAPH_DIAGNOSTICS.getKey(), + SOLARGRAPH_DIAGNOSTICS.getDesc(), optionsGroup); + solargraphDiagnosticsFieldEditor.getDescriptionControl(optionsGroup).setFont(defaultFont); + addField(solargraphDiagnosticsFieldEditor); BooleanFieldEditor debugReadaptFieldEditor = new BooleanFieldEditor(DEBUG_READAPT.getKey(), DEBUG_READAPT.getDesc(), optionsGroup); debugReadaptFieldEditor.getDescriptionControl(optionsGroup).setFont(defaultFont); diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java index 5b63c39..ff384a4 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java @@ -12,6 +12,7 @@ *******************************************************************************/ package io.github.pyvesb.eclipse_solargraph.server; +import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.SOLARGRAPH_DIAGNOSTICS; import static io.github.pyvesb.eclipse_solargraph.preferences.BooleanPreferences.UPDATE_GEM; import static io.github.pyvesb.eclipse_solargraph.preferences.StringPreferences.GEM_PATH; @@ -44,7 +45,7 @@ public SolargraphStreamConnectionProvider() { @Override public Object getInitializationOptions(URI rootUri) { - return Map.of("diagnostics", true); + return Map.of("diagnostics", SOLARGRAPH_DIAGNOSTICS.getValue()); } @Override