-
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
feat: Bundle CDT-LSP plugins with Espressif-IDE #877
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
751c50a
feat: Add CDT-LSP Preview plugins with IEP plugin
kolipakakondal bbe9210
feat: Bundle lsp feature in espressif-ide
kolipakakondal 3946d8b
feat: Add com.espressif.idf.lsp plugin
kolipakakondal fba6c16
fix: auto-detect clangd from the PATH and set in preferences
kolipakakondal 0b6a14e
fix: update query driver in the preference
kolipakakondal f0807a7
fix: set empty if the query is not found
kolipakakondal a182337
fix: resolve conflicts and merge new changes
kolipakakondal dcd5d57
fix: Address plugin loading issues
kolipakakondal 441527c
fix: update clangd file changes with v1.1
kolipakakondal 6cd7e56
fix: Add lsp plugin to bundles list
kolipakakondal 9b9d3f1
fix: build issues and update lsp version
kolipakakondal e200cd7
fix: editor color code issues
kolipakakondal 1a82b79
fix: tag specific lsp version
kolipakakondal f9cfddd
fix: batik.css 1.16.0 required for lsp editor
kolipakakondal 854467b
fix: Avoid errors with riscv toolchains
kolipakakondal 798d40c
fix: Unable to update on existing ide due to batik.util depen
kolipakakondal e98e726
fix: Address updatesite issues
kolipakakondal 7becbd9
fix: code clean up relalated to query driver
kolipakakondal 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
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
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,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,2 @@ | ||
/target/ | ||
/bin/ |
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,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>com.espressif.idf.lsp</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ds.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
2 changes: 2 additions & 0 deletions
2
bundles/com.espressif.idf.lsp/.settings/org.eclipse.core.resources.prefs
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,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
9 changes: 9 additions & 0 deletions
9
bundles/com.espressif.idf.lsp/.settings/org.eclipse.jdt.core.prefs
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,9 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=17 |
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,23 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-SymbolicName: com.espressif.idf.lsp;singleton:=true | ||
Bundle-Vendor: ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD | ||
Bundle-Version: 1.0.1.qualifier | ||
Export-Package: com.espressif.idf.lsp | ||
Require-Bundle: org.eclipse.ui, | ||
org.eclipse.core.runtime, | ||
org.eclipse.cdt.lsp.clangd, | ||
org.eclipse.core.resources, | ||
org.eclipse.cdt.lsp, | ||
com.espressif.idf.core, | ||
org.eclipse.cdt.core, | ||
org.apache.batik.i18n;bundle-version="1.16.0", | ||
org.apache.batik.css;bundle-version="1.16.0", | ||
org.apache.batik.util;bundle-version="1.16.0", | ||
org.apache.batik.constants;bundle-version="1.16.0" | ||
Bundle-RequiredExecutionEnvironment: JavaSE-17 | ||
Automatic-Module-Name: com.espressif.idf.lsp | ||
Bundle-ActivationPolicy: lazy | ||
Bundle-Name: ESP-IDF LSP Plugin | ||
Service-Component: OSGI-INF/com.espressif.idf.lsp.preferences.IDFClangdEnable.xml, | ||
OSGI-INF/com.espressif.idf.lsp.preferences.IDFClangdOptionsDefaults.xml |
8 changes: 8 additions & 0 deletions
8
bundles/com.espressif.idf.lsp/OSGI-INF/com.espressif.idf.lsp.preferences.IDFClangdEnable.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="com.espressif.idf.lsp.preferences.IDFClangdEnable"> | ||
<property name="service.ranking" type="Integer" value="100"/> | ||
<service> | ||
<provide interface="org.eclipse.cdt.lsp.editor.LanguageServerEnable"/> | ||
</service> | ||
<implementation class="com.espressif.idf.lsp.preferences.IDFClangdEnable"/> | ||
</scr:component> |
8 changes: 8 additions & 0 deletions
8
...espressif.idf.lsp/OSGI-INF/com.espressif.idf.lsp.preferences.IDFClangdOptionsDefaults.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="com.espressif.idf.lsp.preferences.IDFClangdOptionsDefaults"> | ||
<property name="service.ranking" type="Integer" value="100"/> | ||
<service> | ||
<provide interface="org.eclipse.cdt.lsp.clangd.ClangdOptionsDefaults"/> | ||
</service> | ||
<implementation class="com.espressif.idf.lsp.preferences.IDFClangdOptionsDefaults"/> | ||
</scr:component> |
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,19 @@ | ||
############################################################################### | ||
# Copyright (c) 2023 Contributors to the Eclipse Foundation. | ||
# | ||
# 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: | ||
# See git history | ||
############################################################################### | ||
|
||
bin.includes = META-INF/,\ | ||
.,\ | ||
OSGI-INF/,\ | ||
plugin.xml | ||
source.. = src/ | ||
output.. = bin/ |
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,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
|
||
</plugin> |
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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>com.espressif.idf.lsp</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
<packaging>eclipse-plugin</packaging> | ||
|
||
<parent> | ||
<groupId>com.espressif.idf</groupId> | ||
<artifactId>com.espressif.idf.bundles</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
</project> |
65 changes: 65 additions & 0 deletions
65
bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ClangdConfigFileHandler.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,65 @@ | ||
/******************************************************************************* | ||
* Copyright 2024 Espressif Systems (Shanghai) PTE LTD. All rights reserved. | ||
* Use is subject to license terms. | ||
*******************************************************************************/ | ||
package com.espressif.idf.lsp; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.io.Writer; | ||
import java.util.Map; | ||
|
||
import org.eclipse.core.resources.IFile; | ||
import org.eclipse.core.resources.IProject; | ||
import org.yaml.snakeyaml.Yaml; | ||
|
||
import com.espressif.idf.core.logging.Logger; | ||
|
||
/** | ||
* @author Kondal Kolipaka <[email protected]> | ||
*/ | ||
public class ClangdConfigFileHandler | ||
{ | ||
@SuppressWarnings("unchecked") | ||
public void update(IProject project) throws FileNotFoundException | ||
{ | ||
File file = getClangdConfigFile(project); | ||
|
||
// Load existing clangd file | ||
FileInputStream inputStream = new FileInputStream(file); | ||
Check warning on line 32 in bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ClangdConfigFileHandler.java GitHub Actions / spotbugsOBL_UNSATISFIED_OBLIGATION
Raw output
|
||
Yaml yaml = new Yaml(); | ||
Object obj = yaml.load(inputStream); | ||
if (obj instanceof Map) | ||
{ | ||
Map<String, Object> data = (Map<String, Object>) obj; | ||
|
||
// Add new attribute to CompileFlags | ||
Map<String, Object> compileFlags = (Map<String, Object>) data.get("CompileFlags"); //$NON-NLS-1$ | ||
compileFlags.put("Remove", new String[] { "-m*", "-f*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
|
||
// Write updated clangd back to file | ||
try (Writer writer = new FileWriter(file)) | ||
Check warning on line 44 in bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ClangdConfigFileHandler.java GitHub Actions / spotbugsDM_DEFAULT_ENCODING
Raw output
|
||
{ | ||
yaml.dump(data, writer); | ||
} | ||
catch (IOException e) | ||
{ | ||
Logger.log("Error writing .clangd file: " + e.getMessage()); //$NON-NLS-1$ | ||
} | ||
} | ||
else | ||
{ | ||
Logger.log("Invalid .clangd file format."); //$NON-NLS-1$ | ||
} | ||
} | ||
|
||
private File getClangdConfigFile(IProject project) | ||
{ | ||
// Path to the existing clangd file | ||
IFile file = project.getFile(ILSPConstants.CLANGD_CONFIG_FILE); | ||
return file.getLocation().toFile(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/ILSPConstants.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,14 @@ | ||
/******************************************************************************* | ||
* Copyright 2024 Espressif Systems (Shanghai) PTE LTD. All rights reserved. | ||
* Use is subject to license terms. | ||
*******************************************************************************/ | ||
package com.espressif.idf.lsp; | ||
|
||
/** | ||
* @author Kondal Kolipaka <[email protected]> | ||
*/ | ||
public interface ILSPConstants | ||
{ | ||
String CLANGD_EXECUTABLE = "clangd"; //$NON-NLS-1$ | ||
String CLANGD_CONFIG_FILE = ".clangd"; // $NON-NLS-1$ | ||
} |
39 changes: 39 additions & 0 deletions
39
bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdEnable.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,39 @@ | ||
/******************************************************************************* | ||
* Copyright 2024 Espressif Systems (Shanghai) PTE LTD. All rights reserved. | ||
* Use is subject to license terms. | ||
*******************************************************************************/ | ||
package com.espressif.idf.lsp.preferences; | ||
|
||
import org.eclipse.cdt.lsp.editor.LanguageServerEnable; | ||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.runtime.CoreException; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
import com.espressif.idf.core.IDFProjectNature; | ||
import com.espressif.idf.core.logging.Logger; | ||
|
||
/** | ||
* @author Kondal Kolipaka <[email protected]> | ||
*/ | ||
@Component(property = { "service.ranking:Integer=100" }) | ||
public class IDFClangdEnable implements LanguageServerEnable | ||
{ | ||
|
||
@Override | ||
public boolean isEnabledFor(IProject project) | ||
{ | ||
if (project != null) | ||
{ | ||
try | ||
{ | ||
return project.hasNature(IDFProjectNature.ID); // IDF nature | ||
} | ||
catch (CoreException e) | ||
{ | ||
Logger.log(e); | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
...com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.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,34 @@ | ||
/******************************************************************************* | ||
* Copyright 2024 Espressif Systems (Shanghai) PTE LTD. All rights reserved. | ||
* Use is subject to license terms. | ||
*******************************************************************************/ | ||
package com.espressif.idf.lsp.preferences; | ||
|
||
import java.util.Optional; | ||
|
||
import org.eclipse.cdt.lsp.clangd.BuiltinClangdOptionsDefaults; | ||
import org.eclipse.cdt.lsp.clangd.ClangdOptionsDefaults; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
import com.espressif.idf.core.logging.Logger; | ||
import com.espressif.idf.core.util.IDFUtil; | ||
import com.espressif.idf.lsp.ILSPConstants; | ||
|
||
/** | ||
* @author Kondal Kolipaka <[email protected]> | ||
* | ||
*/ | ||
@SuppressWarnings("restriction") | ||
@Component(service = ClangdOptionsDefaults.class, property = { "service.ranking:Integer=100" }) | ||
public class IDFClangdOptionsDefaults extends BuiltinClangdOptionsDefaults | ||
{ | ||
|
||
@Override | ||
public String clangdPath() | ||
{ | ||
String clandPath = IDFUtil.findCommandFromBuildEnvPath(ILSPConstants.CLANGD_EXECUTABLE); | ||
Logger.log("clangd: " + clandPath); //$NON-NLS-1$ | ||
return Optional.ofNullable(clandPath).orElse(ILSPConstants.CLANGD_EXECUTABLE); | ||
} | ||
|
||
} |
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
Oops, something went wrong.
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.
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 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