-
Notifications
You must be signed in to change notification settings - Fork 34
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
Projects with same app name seem to not get full snippet support (Updated) #259
Comments
So this only occurs when it is the same app name in more than one project? If so, that does not seem like it would be very common in the real world? |
Yes, it appears the app names must be the same to hit this bug. I agree, I don't think this would be a common scenario for users. I don't think this should be a stop ship. |
Receiving the following error when opening a Maven project folder: Issue opened to address this: #312 |
Based on my understanding, the issue seems to be that Visual Studio Code treats all Java projects within the same workspace as a single project, causing interference between them. Despite attempting various solutions such as: Through my investigation, it appears that the only effective way to avoid the warning and receive snippet suggestions is to individually open each project's root folder by using the "Add folder to Workspace" option. By doing so, we do not receive diagnostics, and we receive snippet suggestions. |
@anusreelakshmi934 Can you show the steps to go from a broken project to a working one using the "Add folder to Workspace" option? What does the project/workspace structure look like before and after? Can both projects be added to the same Workspace? And then can both projects be open in VS Code at the same time if they are part of the same Workspace? On a separate note, what do you mean by "we do not receive diagnostics"? |
When using the "Add folder to Workspace" feature, snippet suggestions become available when opening two projects with the same app name. Here's how it works:
Now the workspace is UNTITLED (WORKSPACE). Even after saving the workspace, suggestions continue to be available. Both projects can be added to the same workspace and opened. Regarding diagnostics, when I mentioned "We do not receive diagnostics," I meant that the diagnostic message "filename.java is a non-project file, only syntax errors are reported" is not displayed when adding projects using the "Add folder to Workspace" feature. |
I'm currently facing difficulties with the workaround; I'm not receiving suggestions as expected. Additionally, I occasionally encounter a "unit is null" error when trying to open a Java file after adding the project using "Add folder to Workspace". This pertains to Issue #326 on GitHub for further context. Also I am encountering #312 while trying to start the language server after few attempts. |
Still the workaround doesnt seem to be working. May need to further investigate some other ways for the issue. |
Looked for multiple solutions. But as of now, cleaning the Java language server workspace, adding folders to the Java source path, setting sourcePaths in the the settings.json doesn’t work. Also adding projects individually to the workspace does not fix the problem. I was also able to find similar issues reported in the redhat language support for java repo: redhat-developer/vscode-java#2545. After duplicating this issue it was evident that there is no issue while having multiple projects in same workspace with different names. But the issue exists for multiple projects with the same name. I checked to see if the same issue exists in other extensions. For this I tried with Project Manager for Java by Microsoft. There also same kind of issue exists where the extension does not identify multiple projects with the same name. See the below screenshot. There are two projects with name app-name-samename imported to the workspace. But only one of them is recognised as the java project. Do the following steps as workaround for this issue:
|
Choosing a parent dir with multiple projects as the main folder seems to mess with our language server snippet suggestions. Instead, if you open each project's root folder through
Add folder to Workspace...
, normal behavior resumes.My project structure has a dir named 'starters' which contain the Maven and Gradle starter apps. Each app gets recognized by the dashboard correctly. Liberty actions work.
It seems MicroProfile snippets only appear for one project. In this case, it only appears on my Gradle Java files.
Attempting to fetch
rest_*
snippets in Maven yield irrelevant answers, and attemptingrest_*
in the Gradle project gave me onlyrest_get
.This final screenshot is the expected snippet list for
rest_*
. Here, only the Maven project is open in the workspace.The text was updated successfully, but these errors were encountered: