Skip to content

feat: Bundle CDT-LSP plugins with Espressif-IDE#877

Merged
kolipakakondal merged 18 commits into
masterfrom
lsp_integration
Mar 27, 2024
Merged

feat: Bundle CDT-LSP plugins with Espressif-IDE#877
kolipakakondal merged 18 commits into
masterfrom
lsp_integration

Conversation

@kolipakakondal
Copy link
Copy Markdown
Collaborator

@kolipakakondal kolipakakondal commented Dec 26, 2023

This PR enable the following.

  1. Bundle CDT LSP plugin with the IEP update site
  2. Bundle CDT LSP plugin in the Espressif-IDE
  3. Auto configure clangd path
  4. With new project create .clangd file with compiler args

Description

Please include a summary of the change and which issue is fixed.

https://jira.espressif.com:8443/browse/IEP-1117
https://jira.espressif.com:8443/browse/IEP-1149

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • Downloaded PR update site and verified CDT LSP editor preference options
  • Downloaded PR Espressif-IDE and verified LSP editor.
Screenshot 2023-12-26 at 5 34 11 PM Screenshot 2023-12-26 at 5 39 01 PM

https://github.com/espressif/idf-eclipse-plugin/blob/master/docs/clangd_cdt_support.md

Test Configuration:

  • ESP-IDF Version: 5.1
  • OS (Windows,Linux and macOS):macOS

Dependent components impacted by this PR:

  • Update site
  • C/C+ editor

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features

    • Enhanced toolchain management with the ability to find compilers based on target names.
    • Improved project configuration and build process in Eclipse IDE for IoT Development Framework (IDF) projects.
    • Added support for updating .clangd configuration files in IDF projects, enabling better integration with Language Server Protocol (LSP).
    • Expanded the IoT Development Framework (IDF) environment with new dependencies and bundles to enhance development capabilities.
  • Documentation

    • Updated project settings and configurations for Eclipse IDE users, including Java compiler settings and version control ignore settings.
  • Chores

    • Updated plugin dependencies and configurations to support new features and improve the development experience in the Eclipse IDE environment.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 26, 2023

Walkthrough

The recent changes involve enhancing toolchain management, project configuration, and language server support within the Espressif IDF project.

Changes

File Path Change Summary
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java Added getXtensaToolchainExePathForActiveTarget() method to retrieve Xtensa toolchain executable path
bundles/com.espressif.idf.lsp/build.properties Introduced configuration settings for project build process
bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java Extended IDFClangdOptionsDefaults to provide default options for Clangd in IDF environment

🐇✨
In the code's garden, changes bloom,
Tools and settings find their room.
With bundles new and methods found,
The codebase hums with a lively sound! 🌱🛠️
🐾

Related issues

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@kolipakakondal kolipakakondal marked this pull request as ready for review December 26, 2023 12:04
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b1cd6f7 and 2b4088d.
Files ignored due to filter (1)
  • releng/com.espressif.idf.update/category.xml
Files selected for processing (1)
  • releng/com.espressif.idf.product/idf.product (1 hunks)
Files skipped from review due to trivial changes (1)
  • releng/com.espressif.idf.product/idf.product

@kolipakakondal kolipakakondal marked this pull request as draft December 26, 2023 13:35
@kolipakakondal kolipakakondal changed the title feat: Add CDT-LSP Preview plugins with IEP plugin feat: Bundle CDT-LSP plugins with Espressif-IDE Dec 26, 2023
@kolipakakondal kolipakakondal added this to the v2.13.0 milestone Dec 28, 2023
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to change a lot of our classpath files to have Java 17 you can see the warnings when building.
We can have a separate ticket for this

Copy link
Copy Markdown
Collaborator

@alirana01 alirana01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good. A solid effort indeed. Can we please try to add the code formatter for the new project as well.

@kolipakakondal kolipakakondal force-pushed the lsp_integration branch 2 times, most recently from 82c2272 to 14f661a Compare February 28, 2024 20:01
@AndriiFilippov
Copy link
Copy Markdown
Collaborator

@kolipakakondal hi!

Tested under:
OS - Windows 10
ESP-IDF: v5.1.2

  1. the Driver Path does not recognize gcc location.
    image

  2. no colored text highlighting
    image

@AndriiFilippov
Copy link
Copy Markdown
Collaborator

@kolipakakondal hi !

Windows 10

open workspace -> go to "Preferences" - "Editor LSP" (clangd) -> empty Clangd Path
image

Now install tools -> go to "Preferences" - "Editor LSP" (clangd) -> Path hasn't been updated. Eclipse Restart fix issue.

image

@kolipakakondal
Copy link
Copy Markdown
Collaborator Author

@kolipakakondal hi!

Tested under: OS - Windows 10 ESP-IDF: v5.1.2

  1. the Driver Path does not recognize gcc location.
    image
  2. no colored text highlighting
    image

fixed

@AndriiFilippov
Copy link
Copy Markdown
Collaborator

AndriiFilippov commented Mar 18, 2024

@kolipakakondal hi!
Tested under: OS - Windows 10 ESP-IDF: v5.1.2

  1. the Driver Path does not recognize gcc location.
    image
  2. no colored text highlighting
    image

fixed

@kolipakakondal the issue is still persist.

For example, if user does not have tools in .espressif folder installed - then is still shows empty PATH even after installation.
image

Please, delete .espressif folder and follow steps:

open workspace -> go to "Preferences" - "Editor LSP" (clangd) -> empty Clangd Path -> Now install tools -> go to "Preferences" - "Editor LSP" (clangd) -> Still Empty PATH
Eclipse Restart fix issue.

@kolipakakondal kolipakakondal marked this pull request as ready for review March 26, 2024 08:45
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4ede117 and e98e726.
Files ignored due to path filters (6)
  • bundles/com.espressif.idf.lsp/OSGI-INF/com.espressif.idf.lsp.preferences.IDFClangdEnable.xml is excluded by: !**/*.xml
  • bundles/com.espressif.idf.lsp/OSGI-INF/com.espressif.idf.lsp.preferences.IDFClangdOptionsDefaults.xml is excluded by: !**/*.xml
  • bundles/com.espressif.idf.lsp/pom.xml is excluded by: !**/*.xml
  • bundles/pom.xml is excluded by: !**/*.xml
  • features/com.espressif.idf.feature/feature.xml is excluded by: !**/*.xml
  • releng/com.espressif.idf.update/category.xml is excluded by: !**/*.xml
Files selected for processing (18)
  • bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/ESPToolChainManager.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (1 hunks)
  • bundles/com.espressif.idf.lsp/.classpath (1 hunks)
  • bundles/com.espressif.idf.lsp/.gitignore (1 hunks)
  • bundles/com.espressif.idf.lsp/.project (1 hunks)
  • bundles/com.espressif.idf.lsp/.settings/org.eclipse.core.resources.prefs (1 hunks)
  • bundles/com.espressif.idf.lsp/.settings/org.eclipse.jdt.core.prefs (1 hunks)
  • bundles/com.espressif.idf.lsp/META-INF/MANIFEST.MF (1 hunks)
  • bundles/com.espressif.idf.lsp/build.properties (1 hunks)
  • bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ClangdConfigFileHandler.java (1 hunks)
  • bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ILSPConstants.java (1 hunks)
  • bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdEnable.java (1 hunks)
  • bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java (1 hunks)
  • bundles/com.espressif.idf.ui/META-INF/MANIFEST.MF (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/wizard/NewIDFProjectWizard.java (4 hunks)
  • releng/com.espressif.idf.product/idf.product (1 hunks)
  • releng/com.espressif.idf.target/com.espressif.idf.target.target (2 hunks)
Files skipped from review due to trivial changes (5)
  • bundles/com.espressif.idf.lsp/.classpath
  • bundles/com.espressif.idf.lsp/.gitignore
  • bundles/com.espressif.idf.lsp/.settings/org.eclipse.core.resources.prefs
  • bundles/com.espressif.idf.lsp/build.properties
  • bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ILSPConstants.java
Additional comments: 16
bundles/com.espressif.idf.lsp/.settings/org.eclipse.jdt.core.prefs (2)
  • 2-9: The configuration to use Java 17 as the target platform, compliance level, and source level is appropriate, considering Java 17 is an LTS version. This ensures stability and compatibility for the project.
  • 4-7: Configuring compiler problem settings to treat assert and enum identifiers as errors, and disabling preview features, aligns with best practices for maintaining code quality and stability in a Java project.
bundles/com.espressif.idf.lsp/.project (1)
  • 1-32: The project configuration, including the project name, build commands, and project natures, is correctly set up for an Eclipse plugin project. This ensures proper building and packaging of the plugin.
bundles/com.espressif.idf.lsp/META-INF/MANIFEST.MF (1)
  • 1-17: The bundle metadata, including the version increment and required bundles, is correctly defined. This ensures the plugin has the necessary dependencies and is versioned appropriately for future updates.
bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdEnable.java (1)
  • 22-37: The implementation of isEnabledFor method correctly checks for the IDF project nature before enabling the language server, with proper exception handling and logging. This ensures that the language server is only enabled for relevant projects.
bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java (1)
  • 26-42: The implementation of clangdPath and queryDriver methods correctly determines the paths using IDFUtil and handles potential null values gracefully with Optional.ofNullable. Proper logging is also implemented, enhancing debuggability.
bundles/com.espressif.idf.ui/META-INF/MANIFEST.MF (1)
  • 46-49: The addition of org.eclipse.cdt.lsp, org.eclipse.cdt.lsp.clangd, and com.espressif.idf.lsp to the Require-Bundle section is appropriate for integrating LSP support into the IDE, aligning with the PR's objectives.
bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1)
  • 46-48: The addition of org.yaml.snakeyaml, org.yaml.snakeyaml.parser, and org.yaml.snakeyaml.util to the Export-Package section is appropriate for supporting YAML parsing and generation, which may be necessary for project configuration or other purposes.
bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ClangdConfigFileHandler.java (1)
  • 27-57: The implementation of the update method for modifying .clangd configuration files is correctly done, with proper handling of YAML data and logging of errors. However, it's recommended to handle FileNotFoundException more gracefully, potentially by creating the file if it doesn't exist or notifying the user.
releng/com.espressif.idf.product/idf.product (1)
  • 78-78: The addition of org.eclipse.cdt.lsp.feature to the product configuration aligns with the PR's objective to enhance IDE functionality by integrating CDT LSP support. Ensure that the integration of this feature with the rest of the IDE components is thoroughly tested.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/wizard/NewIDFProjectWizard.java (2)
  • 8-8: The addition of the import statement for FileNotFoundException is necessary for the new method updateClangdFile to handle exceptions properly.
  • 144-151: The method updateClangdFile properly updates the Clangd configuration file for new projects, aligning with the PR's objectives. Consider adding error handling for other potential exceptions that might occur during file operations.
releng/com.espressif.idf.target/com.espressif.idf.target.target (2)
  • 79-83: The addition of new units like org.apache.batik.css, org.apache.batik.util, etc., supports new functionalities or dependencies required by the plugin. Ensure their integration and compatibility with the rest of the plugin are thoroughly tested.
  • 83-83: The update to the repository location for some dependencies aims to use the latest or more appropriate versions. Verify the compatibility of the updated dependencies with the plugin to ensure no issues are introduced.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/ESPToolChainManager.java (1)
  • 155-161: The method findCompiler efficiently finds a compiler for a given target name, aligning with the PR's objectives to enhance toolchain management. Consider adding documentation to clarify the expected format of the target name and the behavior when no compiler is found.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (1)
  • 341-354: The newly added method getXtensaToolchainExePathForActiveTarget() lacks error handling and documentation. Consider adding Javadoc comments to explain the method's purpose, parameters, and return value. Additionally, think about how to handle cases where the target or compiler file is not found more gracefully, perhaps by logging a warning or throwing a specific exception to aid in debugging and error tracking.

@kolipakakondal kolipakakondal merged commit cf2b0b5 into master Mar 27, 2024
@kolipakakondal kolipakakondal deleted the lsp_integration branch March 27, 2024 14:09
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e98e726 and 7becbd9.
Files ignored due to path filters (1)
  • bundles/com.espressif.idf.lsp/plugin.xml is excluded by: !**/*.xml
Files selected for processing (3)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (2 hunks)
  • bundles/com.espressif.idf.lsp/build.properties (1 hunks)
  • bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java
  • bundles/com.espressif.idf.lsp/build.properties
  • bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java

AndriiFilippov pushed a commit that referenced this pull request Apr 22, 2024
* feat: Add CDT-LSP Preview plugins with IEP plugin

* feat: Bundle lsp feature in espressif-ide

* feat: Add com.espressif.idf.lsp plugin

* fix: auto-detect clangd from the PATH and set in preferences

* fix: editor color code issues

* fix: Avoid errors with riscv toolchains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants