forked from eclipse-cdt/cdt-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-cdt#149] Add interface and service to change configuration v…
…isibility The new interface ClangdConfigurationVisibility allows vendors to hide the 'Prefer C/C++ Editor (LSP)' check-box and the 'clangd options' group in the preference/properties page. fixes eclipse-cdt#149 eclipse-cdt#153
- Loading branch information
1 parent
b1a5dd6
commit d94da46
Showing
6 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...t.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.clangd.DefaultClangdConfigurationVisibility.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.cdt.lsp.clangd.DefaultClangdConfigurationVisibility"> | ||
<property name="service.ranking" type="Integer" value="0"/> | ||
<service> | ||
<provide interface="org.eclipse.cdt.lsp.clangd.ClangdConfigurationVisibility"/> | ||
</service> | ||
<implementation class="org.eclipse.cdt.lsp.clangd.DefaultClangdConfigurationVisibility"/> | ||
</scr:component> |
35 changes: 35 additions & 0 deletions
35
....eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfigurationVisibility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Bachmann electronic GmbH 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 https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Gesa Hentschke (Bachmann electronic GmbH) - initial implementation | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.lsp.clangd; | ||
|
||
/** | ||
* Provides access to the visibility of configuration elements in the UI taking into account the scope (project or workspace) | ||
* | ||
*/ | ||
public interface ClangdConfigurationVisibility { | ||
|
||
/** | ||
* Changes the visibility of the 'Prefer C/C++ Editor (LSP)' check-box. | ||
* @param isProjectScope | ||
* @return true when the check-box should be displayed. | ||
*/ | ||
boolean showPreferClangd(boolean isProjectScope); | ||
|
||
/** | ||
* Changes the visibility of the 'clangd options' group. | ||
* @param isProjectScope | ||
* @return true when the clangd options group should be displayed. | ||
*/ | ||
boolean showClangdOptions(boolean isProjectScope); | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...e.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/DefaultClangdConfigurationVisibility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Bachmann electronic GmbH 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 https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Gesa Hentschke (Bachmann electronic GmbH) - initial implementation | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.lsp.clangd; | ||
|
||
import org.osgi.service.component.annotations.Component; | ||
|
||
@Component(property = { "service.ranking:Integer=0" }) | ||
public class DefaultClangdConfigurationVisibility implements ClangdConfigurationVisibility { | ||
|
||
@Override | ||
public boolean showPreferClangd(boolean isProjectScope) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean showClangdOptions(boolean isProjectScope) { | ||
return !isProjectScope; // TODO: return true when multiple LS per workspace are supported | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters