-
Notifications
You must be signed in to change notification settings - Fork 401
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
Stop generating metadata files at project's root #1900
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Sheng Chen <[email protected]>
Signed-off-by: Sheng Chen <[email protected]>
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFsUtils.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFsUtils.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFsUtils.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFileSystem.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JdtlsFsUtils.java
Outdated
Show resolved
Hide resolved
Signed-off-by: sheche <[email protected]>
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFile.java
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFileSystem.java
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFsUtils.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFileSystem.java
Show resolved
Hide resolved
Signed-off-by: sheche <[email protected]>
Signed-off-by: sheche <[email protected]>
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.
Change is working well for me. Played around with java.settings.url
outside workspace, and within, and couldn't see any breakage.
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFile.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFsUtils.java
Show resolved
Hide resolved
That's currently a system property. It should be more configurable. We have a large source code base which is modified by many different editors/IDEs. This change would break VS Code users unless the setting is detected somehow at startup/during import. |
@guw Because the file system contribution will take effect at very begin before the server and client start communication via LSP. So it is a system property instead of a preference. I don't think the change will break the users because we considered the compatibility in implementation:
In the code base you mentioned:
If in your implementation, you want to deal with those metadata files. You can use the standard API to do it. For example if you want to update the project nature, use: If you do want to get the file instance of the metadata files, for example, for the |
Signed-off-by: Sheng Chen <[email protected]>
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.
LGTM. Have a try, it works with Maven/Gradle/Invisible project.
Feel free to combine the commits and merge when ready. |
lsp-java used to treat this as a configuration property of jdtls. However it is not a standard lsp configuration property. Instead it must be passed as a Java System Property on the command line invoking jdtls. See [JLFsUtils.java](https://github.com/eclipse-jdtls/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.filesystem/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFsUtils.java#L192-L197) for how this property is read. Also see [eclipse-jdtls/eclipse.jdt.ls#1900](eclipse-jdtls/eclipse.jdt.ls#1900 (comment)) for an explanation of why this is a system property and not a regular LSP configuration property. Use a regular `defcustom` instead of using `lsp-defcustom` for declaring lsp-java-import-generates-metadata-files-at-project-root. Use this defcustom variable lsp-java--ls-command to pass an appropriate value for `java.import.generatesMetadataFilesAtProjectRoot`. With this change importing a Gradle-based java project into LSP will nolonger create `.classpath`, `.settings`, and `.project` entries at the root of the project.
lsp-java used to treat this as a configuration property of jdtls. However it is not a standard lsp configuration property. Instead it must be passed as a Java System Property on the command line invoking jdtls. See [JLFsUtils.java](https://github.com/eclipse-jdtls/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.filesystem/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFsUtils.java#L192-L197) for how this property is read. Also see [eclipse-jdtls/eclipse.jdt.ls#1900](eclipse-jdtls/eclipse.jdt.ls#1900 (comment)) for an explanation of why this is a system property and not a regular LSP configuration property. Use a regular `defcustom` instead of using `lsp-defcustom` for declaring lsp-java-import-generates-metadata-files-at-project-root. Use this defcustom variable in `lsp-java--ls-command` to pass an appropriate value for `java.import.generatesMetadataFilesAtProjectRoot`. With this change importing a Gradle-based java project into LSP will nolonger create `.classpath`, `.settings`, and `.project` entries at the root of the project.
lsp-java used to treat this as a configuration property of jdtls. However it is not a standard lsp configuration property. Instead it must be passed as a Java System Property on the command line invoking jdtls. See [JLFsUtils.java](https://github.com/eclipse-jdtls/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.filesystem/src/org/eclipse/jdt/ls/core/internal/filesystem/JLSFsUtils.java#L192-L197) for how this property is read. Also see [eclipse-jdtls/eclipse.jdt.ls#1900](eclipse-jdtls/eclipse.jdt.ls#1900 (comment)) for an explanation of why this is a system property and not a regular LSP configuration property. Use a regular `defcustom` instead of using `lsp-defcustom` for declaring lsp-java-import-generates-metadata-files-at-project-root. Use this defcustom variable in `lsp-java--ls-command` to pass an appropriate value for `java.import.generatesMetadataFilesAtProjectRoot`. With this change importing a Gradle-based java project into LSP will nolonger create `.classpath`, `.settings`, and `.project` entries at the root of the project.
resolve redhat-developer/vscode-java#618, requires redhat-developer/vscode-java#2153
There is a setting called
java.import.generatesMetadataFilesAtProjectRoot
to control whether the project metadata files will be generated at project root. By default it'sfalse
, meaning those files will be hidden.Some known issues I found:
1. Buildship hard code the.settings/
folder location: eclipse/buildship#11112. When calling .getLocation() from the metadata file(i.e.
project.getFile(".project").getLocation()
), the file location always points to the project root. This is because the upstream implementation does not depend onFileStore
to resolve the location, seeFileSystemResourceManager#locationFor()
. ButgetLocationURI()
works fine.Signed-off-by: Sheng Chen [email protected]