From e8455e10a0600a58c7c2bac18a9e6208341524e0 Mon Sep 17 00:00:00 2001 From: Philip Langer Date: Mon, 18 May 2020 11:28:43 +0200 Subject: [PATCH] Bug 563280 Split language server flags into separate commands Change-Id: If7c8e823f7da289a4567b8cb6030f504a830364f Signed-off-by: Philip Langer (cherry picked from commit 081069afcda09fbe815e4745b1bd80809612b57a) --- lsp/org.eclipse.cdt.lsp.core/META-INF/MANIFEST.MF | 2 +- .../cdt/lsp/core/CPPStreamConnectionProvider.java | 7 +++++-- lsp/org.eclipse.cdt.lsp.ui/META-INF/MANIFEST.MF | 2 +- .../cdt/lsp/internal/ui/LspUiMessages.properties | 7 ++++--- .../preferences/CPPLanguageServerPreferencePage.java | 10 +++++----- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lsp/org.eclipse.cdt.lsp.core/META-INF/MANIFEST.MF b/lsp/org.eclipse.cdt.lsp.core/META-INF/MANIFEST.MF index 7306dd26bc2..0bbebb61ddb 100644 --- a/lsp/org.eclipse.cdt.lsp.core/META-INF/MANIFEST.MF +++ b/lsp/org.eclipse.cdt.lsp.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Automatic-Module-Name: org.eclipse.cdt.lsp.core Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.eclipse.cdt.lsp.core;singleton:=true -Bundle-Version: 1.1.0.qualifier +Bundle-Version: 1.1.100.qualifier Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/CPPStreamConnectionProvider.java b/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/CPPStreamConnectionProvider.java index 94f16733231..719208874ac 100644 --- a/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/CPPStreamConnectionProvider.java +++ b/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/CPPStreamConnectionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017-2019 Ericsson and others. + * Copyright (c) 2017-2020 Ericsson and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -10,6 +10,7 @@ * Contributors: * Ericsson - initial API and implementation * Alexander Fedorov - Bug 558516 + * Philip Langer - Bug 563280 *******************************************************************************/ package org.eclipse.cdt.lsp.core; @@ -20,10 +21,12 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.eclipse.cdt.internal.cquery.core.CqueryLanguageServer; import org.eclipse.cdt.lsp.internal.core.LspCoreMessages; +import org.eclipse.cdt.utils.CommandLineUtil; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResourceChangeListener; @@ -66,7 +69,7 @@ public class CPPStreamConnectionProvider extends ProcessStreamConnectionProvider if (languageServerLocation != null) { commands.add(languageServerLocation.getAbsolutePath()); if (!flags.isEmpty()) { - commands.add(flags); + commands.addAll(Arrays.asList(CommandLineUtil.argumentsToArray(flags))); } parent = languageServerLocation.getParent(); } diff --git a/lsp/org.eclipse.cdt.lsp.ui/META-INF/MANIFEST.MF b/lsp/org.eclipse.cdt.lsp.ui/META-INF/MANIFEST.MF index 6d232ceea45..d560c99d9de 100644 --- a/lsp/org.eclipse.cdt.lsp.ui/META-INF/MANIFEST.MF +++ b/lsp/org.eclipse.cdt.lsp.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Automatic-Module-Name: org.eclipse.cdt.lsp.ui Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.eclipse.cdt.lsp.ui;singleton:=true -Bundle-Version: 0.1.0.qualifier +Bundle-Version: 0.1.100.qualifier Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/LspUiMessages.properties b/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/LspUiMessages.properties index 2fc0c93d5e5..9f6f0b68048 100644 --- a/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/LspUiMessages.properties +++ b/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/LspUiMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2019 Eclipse Foundation and others +# Copyright (c) 2019-2020 Eclipse Foundation and others # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License 2.0 which is available at @@ -10,6 +10,7 @@ # Contributors: # Eclipse Foundation - initial API and implementation # Alexander Fedorov - Bug 558484 +# Philip Langer - Bug 563280 ############################################################################### CPPLanguageServerPreferencePage_clangd=ClangD @@ -17,6 +18,6 @@ CPPLanguageServerPreferencePage_clangd=ClangD CPPLanguageServerPreferencePage_cquery=CQuery CPPLanguageServerPreferencePage_description=Preferences for the C/C++ Language Server\n\n -CPPLanguageServerPreferencePage_server_options=Enter any command-line options for the server -CPPLanguageServerPreferencePage_server_path=Browse path to the server executable +CPPLanguageServerPreferencePage_server_options=Command-line options for the server +CPPLanguageServerPreferencePage_server_path=Path to the server executable CPPLanguageServerPreferencePage_server_selector=Please select the C/C++ Language Server you want to use in Eclipse : diff --git a/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/preferences/CPPLanguageServerPreferencePage.java b/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/preferences/CPPLanguageServerPreferencePage.java index 407952a90d6..8087402603f 100644 --- a/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/preferences/CPPLanguageServerPreferencePage.java +++ b/lsp/org.eclipse.cdt.lsp.ui/src/org/eclipse/cdt/lsp/internal/ui/preferences/CPPLanguageServerPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018-2019 Manish Khurana, Nathan Ridge and others. + * Copyright (c) 2018-2020 Manish Khurana, Nathan Ridge and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -11,6 +11,7 @@ * Manish Khurana - initial API and implementation * Nathan Ridge - initial API and implementation * Alexander Fedorov - Bug 558516 + * Philip Langer - Bug 563280 *******************************************************************************/ package org.eclipse.cdt.lsp.internal.ui.preferences; @@ -21,11 +22,11 @@ import org.eclipse.cdt.lsp.core.CPPStreamConnectionProvider; import org.eclipse.cdt.lsp.core.PreferenceConstants; import org.eclipse.cdt.lsp.internal.ui.LspUiActivator; import org.eclipse.cdt.lsp.internal.ui.LspUiMessages; +import org.eclipse.cdt.ui.newui.MultiLineTextFieldEditor; import org.eclipse.jface.preference.FieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.FileFieldEditor; import org.eclipse.jface.preference.RadioGroupFieldEditor; -import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; @@ -38,7 +39,7 @@ public class CPPLanguageServerPreferencePage extends FieldEditorPreferencePage i private FileFieldEditor serverPath; private RadioGroupFieldEditor serverChoice; - private StringFieldEditor serverOptions; + private MultiLineTextFieldEditor serverOptions; public CPPLanguageServerPreferencePage() { super(GRID); @@ -48,7 +49,6 @@ public class CPPLanguageServerPreferencePage extends FieldEditorPreferencePage i @Override public void createFieldEditors() { - serverChoice = new RadioGroupFieldEditor(PreferenceConstants.P_SERVER_CHOICE, LspUiMessages.CPPLanguageServerPreferencePage_server_selector, 1, new String[][] { @@ -62,7 +62,7 @@ public class CPPLanguageServerPreferencePage extends FieldEditorPreferencePage i LspUiMessages.CPPLanguageServerPreferencePage_server_path, getFieldEditorParent()); addField(serverPath); - serverOptions = new StringFieldEditor(PreferenceConstants.P_SERVER_OPTIONS, + serverOptions = new MultiLineTextFieldEditor(PreferenceConstants.P_SERVER_OPTIONS, LspUiMessages.CPPLanguageServerPreferencePage_server_options, getFieldEditorParent()); addField(serverOptions); }