-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#149] Add interface and service to change configuration visibility #160
Merged
ghentschke
merged 2 commits into
eclipse-cdt:master
from
ghentschke:hide-prefer-lsp-checkbox
Aug 4, 2023
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { | ||
ruspl-afed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have barely used let alone reviewed this type of pattern - so I defer to @ruspl-afed to review this aspect. It looks ok to me, but I don't know what I could be missing.