Skip to content

Commit

Permalink
Use restart() method from LanguageServerWrapper
Browse files Browse the repository at this point in the history
Since the LanguageServerWrapper provides a restart method we should use
this method instead of stop(). See
eclipse-lsp4e/lsp4e#839
  • Loading branch information
ghentschke committed Oct 11, 2023
1 parent e888082 commit 3b9393b
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

package org.eclipse.cdt.lsp.internal.clangd.editor;

import java.io.IOException;

import org.eclipse.cdt.lsp.LspUtils;
import org.eclipse.cdt.lsp.clangd.ClangdConfiguration;
import org.eclipse.cdt.lsp.clangd.ClangdMetadata;
Expand All @@ -22,11 +24,13 @@
import org.eclipse.cdt.lsp.editor.ConfigurationArea;
import org.eclipse.cdt.lsp.editor.EditorConfigurationPage;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.statushandlers.StatusManager;

public final class ClangdConfigurationPage extends EditorConfigurationPage {

Expand Down Expand Up @@ -93,7 +97,13 @@ private void openRestartDialog() {
new String[] { IDialogConstants.NO_LABEL, LspEditorUiMessages.LspEditorPreferencePage_restart_button },
1);
if (dialog.open() == 1) {
LspUtils.getLanguageServers().forEach(w -> w.stop());
LspUtils.getLanguageServers().forEach(w -> {
try {
w.restart();
} catch (IOException e) {
StatusManager.getManager().handle(Status.error("Could not restart language servers", e)); //$NON-NLS-1$
}
});
}
}

Expand Down

0 comments on commit 3b9393b

Please sign in to comment.