-
Notifications
You must be signed in to change notification settings - Fork 123
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
IEP-1246 Set --compile-commands-dir=<path> for the current project which the user is trying to build #973
Conversation
WalkthroughThe changes primarily focus on integrating Language Server Protocol (LSP) support into the Espressif IDF core and UI bundles. Dependencies on LSP-related bundles were added to the core, while redundant dependencies were removed from the UI. Additionally, a new Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant LaunchBarListener
participant LspService
participant LSPServer
User->>LaunchBarListener: Initiate Build
LaunchBarListener->>LspService: restartLspServers()
LspService->>LSPServer: Restart
LSPServer->>LspService: Confirm Restart
LspService->>LaunchBarListener: Servers Restarted
LaunchBarListener->>User: Build Completed
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1 hunks)
- bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (2 hunks)
- bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java (1 hunks)
- bundles/com.espressif.idf.ui/META-INF/MANIFEST.MF (1 hunks)
- bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/LaunchBarListener.java (4 hunks)
Files skipped from review due to trivial changes (1)
- bundles/com.espressif.idf.ui/META-INF/MANIFEST.MF
Additional comments not posted (2)
bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1)
32-34
: The addition of LSP-related dependencies aligns with the PR's objectives to enhance LSP functionalities.bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/LaunchBarListener.java (1)
63-65
: Integration ofLspService
inactiveLaunchTargetChanged
method is implemented correctly. Ensure this behavior is verified on all supported platforms as mentioned in the PR checklist.
public class LspService | ||
{ | ||
private final Configuration configuration; | ||
private final Stream<LanguageServerWrapper> languageServerWrappers; | ||
|
||
public LspService() | ||
{ | ||
this(PlatformUI.getWorkbench().getService(ClangdConfiguration.class), LspUtils.getLanguageServers()); | ||
} | ||
|
||
public LspService(Configuration configuration, Stream<LanguageServerWrapper> languageServerWrappers) | ||
{ | ||
this.configuration = configuration; | ||
this.languageServerWrappers = languageServerWrappers; | ||
} | ||
|
||
public void restartLspServers() | ||
{ | ||
languageServerWrappers.forEach(w -> { | ||
try | ||
{ | ||
w.restart(); | ||
} | ||
catch (IOException e) | ||
{ | ||
Logger.log(e); | ||
} | ||
}); | ||
} | ||
|
||
public void updateAdditionalOptions(String additionalOptions) | ||
{ | ||
if (configuration.metadata() instanceof ClangdMetadata metadata) | ||
{ | ||
String qualifier = configuration.qualifier(); | ||
InstanceScope.INSTANCE.getNode(qualifier).put(metadata.additionalOptions().identifer(), additionalOptions); | ||
} | ||
} | ||
|
||
public void updateLspQueryDrivers() | ||
{ | ||
if (configuration.metadata() instanceof ClangdMetadata metadata) | ||
{ | ||
String qualifier = configuration.qualifier(); | ||
InstanceScope.INSTANCE.getNode(qualifier).put(metadata.queryDriver().identifer(), | ||
metadata.queryDriver().defaultValue()); | ||
} | ||
} |
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.
The implementation of LSP service methods appears correct and efficient. Consider adding unit tests to ensure functionality works as expected under various scenarios.
Would you like me to help with creating unit tests for these methods?
LspService lspService = new LspService(); | ||
lspService.updateAdditionalOptions(String.format("--compile-commands-dir=%s", buildDir)); //$NON-NLS-1$ | ||
lspService.restartLspServers(); |
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.
The integration of LspService
and setting of --compile-commands-dir
in runCmakeBuildCommand
are implemented correctly. Consider adding documentation to describe this new behavior and its impact on the build process.
Would you like help with drafting the documentation?
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.
LGTM
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.
Self reviewed
@sigmaaa hi! Tested under: build project -> check additional lsp options -> --compile-commands-dir points to the right path ✔️ |
Hi @AndriiFilippov We can remove troubleshooting from the build console and move it to clangd documentation area |
Description
Set --compile-commands-dir= for the current project which the user is trying to build
Fixes # (IEP-1246)
Type of change
Please delete options that are not relevant.
How has this been tested?
Test A:
build project -> check additional lsp options -> --compile-commands-dir points to the right path
Test B:
change the target -> check query drivers -> points to correct toolchain
Test Configuration:
Dependent components impacted by this PR:
Checklist
Summary by CodeRabbit
New Features
Refactor
LspService
methods for better functionality.