-
Notifications
You must be signed in to change notification settings - Fork 13
[#83] Rework access to preferences #83 #117
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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
9 changes: 9 additions & 0 deletions
9
...cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdConfigurationAccess.xml
This file contains hidden or 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,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.eclipse.cdt.lsp.internal.clangd.ClangdConfigurationAccess"> | ||
<service> | ||
<provide interface="org.eclipse.cdt.lsp.clangd.ClangdConfiguration"/> | ||
ghentschke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</service> | ||
<reference cardinality="1..1" field="preferences" interface="org.eclipse.core.runtime.preferences.IPreferencesService" name="preferences"/> | ||
<reference cardinality="1..1" field="workspace" interface="org.eclipse.core.resources.IWorkspace" name="workspace"/> | ||
<implementation class="org.eclipse.cdt.lsp.internal.clangd.ClangdConfigurationAccess"/> | ||
</scr:component> |
This file contains hidden or 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 hidden or 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 hidden or 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
60 changes: 60 additions & 0 deletions
60
bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfiguration.java
This file contains hidden or 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,60 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 ArSysOp. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Alexander Fedorov (ArSysOp) - Initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.lsp.clangd; | ||
|
||
import java.net.URI; | ||
|
||
import org.eclipse.core.resources.IResource; | ||
import org.eclipse.core.runtime.preferences.IPreferenceMetadataStore; | ||
import org.eclipse.core.runtime.preferences.IScopeContext; | ||
|
||
/** | ||
* Provides access to the clangd options according to the required scope | ||
* | ||
* @see ClangdOptions | ||
* @see IScopeContext | ||
* | ||
*/ | ||
public interface ClangdConfiguration { | ||
|
||
/** | ||
* Returns the clangd options for the given context like {@link IResource} or {@link URI}, must not return <code>null</code> | ||
* @param context to be adapter to the proper scope | ||
* | ||
* @return clangd options | ||
*/ | ||
ClangdOptions options(Object context); | ||
|
||
/** | ||
* Returns the clangd preference store for the given context like {@link IResource} or {@link URI}, must not return <code>null</code> | ||
* @param context to be adapter to the proper scope | ||
* | ||
* @return preference store | ||
*/ | ||
IPreferenceMetadataStore storage(Object context); | ||
|
||
/** | ||
* Return the metadata for clangd options, must not return <code>null</code> | ||
* | ||
* @return the clangd option metadata | ||
*/ | ||
ClangdMetadata metadata(); | ||
|
||
/** | ||
* Default qualifier to use for preference storage | ||
* @return preference qualifier | ||
*/ | ||
String qualifier(); | ||
|
||
} |
89 changes: 89 additions & 0 deletions
89
bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdMetadata.java
This file contains hidden or 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,89 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 ArSysOp. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Alexander Fedorov (ArSysOp) - Initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.lsp.clangd; | ||
|
||
import org.eclipse.core.runtime.preferences.PreferenceMetadata; | ||
|
||
/** | ||
* The metadata for options to configure clangd | ||
* | ||
* @see ClangdOptions | ||
* | ||
*/ | ||
public interface ClangdMetadata { | ||
|
||
/** | ||
* Returns the metadata for the "Prefer clangd" option, must not return <code>null</code>. | ||
* | ||
* @return the metadata for the "Prefer clangd" option | ||
* | ||
* @see ClangdOptions#preferClangd() | ||
*/ | ||
PreferenceMetadata<Boolean> preferClangd(); | ||
|
||
/** | ||
* Returns the metadata for the "Clangd path" option, must not return <code>null</code>. | ||
* | ||
* @return the metadata for the "Clangd path" option | ||
* | ||
* @see ClangdOptions#clangdPath() | ||
*/ | ||
PreferenceMetadata<String> clangdPath(); | ||
|
||
/** | ||
* Returns the metadata for the "Enable clang-tidy" option, must not return <code>null</code>. | ||
* | ||
* @return the metadata for the "Enable clang-tidy" option | ||
* | ||
* @see ClangdOptions#useTidy() | ||
*/ | ||
PreferenceMetadata<Boolean> useTidy(); | ||
|
||
/** | ||
* Returns the metadata for the "Background index" option, must not return <code>null</code>. | ||
* | ||
* @return the metadata for the "Background index" option | ||
* | ||
* @see ClangdOptions#useBackgroundIndex() | ||
*/ | ||
PreferenceMetadata<Boolean> useBackgroundIndex(); | ||
|
||
/** | ||
* Returns the metadata for the "Completion style" option, must not return <code>null</code>. | ||
* | ||
* @return the metadata for the "Completion style" option | ||
* | ||
* @see ClangdOptions#completionStyle() | ||
*/ | ||
PreferenceMetadata<String> completionStyle(); | ||
|
||
/** | ||
* Returns the metadata for the "Pretty print" option, must not return <code>null</code>. | ||
* | ||
* @return the metadata for the "Pretty print" option | ||
* | ||
* @see ClangdOptions#prettyPrint() | ||
*/ | ||
PreferenceMetadata<Boolean> prettyPrint(); | ||
|
||
/** | ||
* Returns the metadata for the "Query driver" option, must not return <code>null</code>. | ||
* | ||
* @return the metadata for the "Query driver" option | ||
* | ||
* @see ClangdOptions#queryDriver() | ||
*/ | ||
PreferenceMetadata<String> queryDriver(); | ||
|
||
} |
82 changes: 82 additions & 0 deletions
82
bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdOptions.java
This file contains hidden or 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,82 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 ArSysOp. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Alexander Fedorov (ArSysOp) - Initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.lsp.clangd; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider; | ||
|
||
/** | ||
* Options to configure clangd | ||
* | ||
*/ | ||
public interface ClangdOptions { | ||
|
||
/** | ||
* Prefer to use clangd language server and related editor implementation | ||
* | ||
* @return if clangd language server should be preferred | ||
*/ | ||
boolean preferClangd(); | ||
|
||
/** | ||
* Path to clangd executable to be launched, must not return <code>null</code> | ||
* | ||
* @return path to clangd | ||
*/ | ||
String clangdPath(); | ||
|
||
/** | ||
* Use clang-tidy diagnostics | ||
* | ||
* @return if clang-tidy diagnostics is enabled | ||
*/ | ||
boolean useTidy(); | ||
|
||
/** | ||
* Index project code in the background and persist index on disk | ||
* | ||
* @return if background index is enabled | ||
*/ | ||
boolean useBackgroundIndex(); | ||
|
||
/** | ||
* Granularity of code completion suggestions either <code>detailed</code> or <code>bundled</code>, must not return <code>null</code> | ||
* | ||
* @return granularity of code completion suggestions | ||
*/ | ||
String completionStyle(); | ||
|
||
/** | ||
* Pretty-print JSON output | ||
* | ||
* @return if pretty-print for JSON output is enabled | ||
*/ | ||
boolean prettyPrint(); | ||
|
||
/** | ||
* Comma separated list of globs for white-listing gcc-compatible drivers that are safe to execute, must not return <code>null</code> | ||
* | ||
* @return comma separated list of globs | ||
*/ | ||
String queryDriver(); | ||
|
||
/** | ||
* Provides list of commands suitable for {@link ProcessStreamConnectionProvider} | ||
* | ||
* @return list of commands | ||
*/ | ||
List<String> toList(); | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdQualifier.java
This file contains hidden or 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,25 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 ArSysOp. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Alexander Fedorov (ArSysOp) - Initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.lsp.clangd; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public final class ClangdQualifier implements Supplier<String> { | ||
|
||
@Override | ||
public String get() { | ||
return "org.eclipse.cdt.lsp.clangd"; //$NON-NLS-1$ | ||
} | ||
|
||
} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.