redhat-developer / redhat-developer/vscode-java
Extension needs Eclipse project files upon initial import if lifecycle mapping is done for compile
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 547
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
From this blog entry it seems that the old Eclipse project files; .project and .classpath, would no longer be neccessary. However, this is not the case: The files are no longer auto-generated, but if they are not present, the project won't open correctly.
Environment
- Operating System: Ubuntu Linux 20.04
- JDK version: OpenJDK 17.0.5
- Visual Studio Code version: 1.74.3
- Java extension version: 1.14.0
Steps To Reproduce
- Remove the ~/.vscode directory containing any other extensions
- Remove the ~/.config/Code directory containing all non-default VS Code settings
- Open VS Code; install the "redhat.java" extension, and close again
- Repeat step 2 to clear all settings
- Create the directory ~/.config/Code/User and unzip settings.json from the attached settings.zip into it
- Unzip both the attached project.zip and eclfiles.zip into a new directory
- Open the project in VSCode through the project file foo.code-workspace. Click that you trust the authors of the workspace.
- Observe that after the "Project are imported into the workspace" popup has appeared, you can go into the Program.java file, right-click on the word "Program" after "class" on the first line, and select Find All References from the menu; three results will appear in the References panel.
- Type Ctrl-Shift-P, Java: Open Java Extension Log File; this will be a file ~/.config/Code/User/workspaceStorage/xxx/redhat.java/client.log.yyy where xxx is a generated identifier and yyy is today's date. Similarly will Java: Open Language Server Log File give a file ~/.config/Code/User/workspaceStorage/xxx/redhat.java/jdt_ws/.metadata/.log
- Quit VS Code, and repeat step 2 and 5 to clear any settings
- Delete the .project and .classpath files in the project directory.
- Open the project again in the same way as in step 7
- Observe that the "Opening Java projects" popup appear, but "Projects are imported into the workspace" do not. If you open the Program.java file and right-click on the "Program" identifier after the "class" keyword and select Find All References you get no results.
- Quit VSCode and restore the .project and .classpath files by unzipping eclfiles.zip again
- Do not clear any settings this time, but repeat step 7
- Observe that the project now works again after the files were restored.
The issue is also reproducible if the settings are not cleared, or if the full Extension Pack for Java is installed.
Current Result
In step 13 above the language server appears broken.
Expected Result
Step 13 above should be similar to step 8.
Additional Informations
In the case where the import is successful (step 8), the language server receives a workspace/executeCommand java.project.getSettings, which it does not if the Eclipse project files are missing (step 13).
If you have a multi-module Maven project which was imported in an old version of VSCode, and had .project and .classpath generated for the existing modules at the time, and you now add a new module for instance by pulling an update from a Git repository, the project files are not automatically generated for this new module and the project looks partially broken.
project.zip
eclfiles.zip
settings.zip
step8-client.log
step8-jdt_ws.log
step13-client.log
step13-jdt_ws.log
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的 project.zip、eclfiles.zip、settings.zip 以及第 8 步和第 13 步的客户端和 language-server 日志开始。比较导入路径,尤其要确认在缺少 .project 和 .classpath 时是否会发送 workspace/executeCommand java.project.getSettings。完成标准是:不含这些文件的项目能够导入,并提供与正常工作情况相同的 Java language-server 引用行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, typescript, vscode
- 领域
- developer-experience, devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100