Skip to content

Commit

Permalink
Add diagnostics preference
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Jul 17, 2024
1 parent 8af4847 commit fb77cc5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public enum BooleanPreferences implements Preference<Boolean> {

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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fb77cc5

Please sign in to comment.