-
Notifications
You must be signed in to change notification settings - Fork 312
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
build: add support for Visual Studio Code #4573
build: add support for Visual Studio Code #4573
Conversation
As pointed out by @GregoryIvo this also works with Eclipse Theia. Here's a screenshot of Theia Blueprint reporting the expected diagnostics for the Kura codebase: The installation process is the same, the only difference is that vscode-pde is not in the Open VSX Registry and therefore I needed to manually install it using the command "Extensions: Install from VSIX..." available in Theia. See Theia docs for details. |
636670e
to
1c59973
Compare
This reverts commit b631acb.
We'll add it in a future PR
1c59973
to
701f319
Compare
Q: How can I test this on my branch?1. Clone the Kura repository in a new folder (Eclipse IDE gets angry if it shares the sources with VSCode)git clone git@github.com:eclipse/kura.git vscode-kura && cd vscode-kura
2. Build the code following the README or with:mvn -f target-platform/pom.xml clean install -B mvn -f kura/pom.xml clean install -Dmaven.test.skip=true mvn -f kura/pom.xml test-compile 3. Apply the vscode patchcurl -L https://github.com/eclipse/kura/files/11376409/vscode.patch | git apply ℹ️ This command won't affect the git history of your branch. 4. Open VSCode in the
|
Note: the missing projectName variable might limit functionalities
Superseded by #5563 |
VSCode as Kura Development Environment
This PR adds support for Visual Studio Code as development environment for the Kura codebase.
Changes:
.classpath
and.project
filesjavaConfig.json
in thekura
directory, required by vscode-pde extensionvscode
folder with workspace settings and recommended extensionsThis is a WIP. Some more testing is required.
Requirements
See https://github.com/eclipse/kura/blob/6445232dd0a9d447bac1b7b2312d64ec73f594a7/kura/.vscode/extensions.json
Changes details
1. Created
javaConfig.json
fileAdd the
javaConfig.json
file in thekura
directory.2. Modified the target platform to use the
${container_loc}
variableUpdate the
${kura_git_folder}/kura/target-definition/kura-equinox_3.16.0.target
file to not use the${git_work_tree}
variable. For details see: testforstephen/vscode-pde#533.
.classpath
and.project
files are now tracked under gitVSCode PDE Extension needs the
.project
and.classpath
files to be able to open the projects and feed them to the JDT LS.This means:
Other projects that relies on the
vscode-pde
extension track their.classpath
and.project
under git:Environment setup instructions
1. Build project
To have full diagnostics and autocompletion we only need the following:
Looks like -DskipTests will not compile our tests so we need to tell mvn to do it explicitly
Note: we need to build the tests too.
2. You can then open VSCode at
${kura_git_folder}/kura/
This will kick in the Java project build and, after it completes, you should see a lot of errors (>30K). This is due to the fact that, upon first opening the project, the
${container_loc}
variable is not correctly populated and the Target Platform is not resolved.To fix this press: Ctrl + Shift + P (Cmd + Shift + P for Mac users) and run the "Developer: Reload Window" command (this is needed only once, the first time you import the project).
... and you're done!
Troubleshooting
LSP Out of memory error:
Looks like the JVM running the LSP server requires some additional RAM to parse through Kura. Add a
.vscode/settings.json
file in the root workspace directory containing the following:Open issues:
.classpath
and.project
filesCan we track them under git? All the projects using the extension do it. Requires some more testing but it is ok for me.
Is there a way to fix it? Resolved in: 5623ca7. An alternative (arguably more robust) solution is provided in: feat: POC for target-definition file build during platform build mattdibi/kura#7
Not all option we set are supported
Review project setup and remove possible errors