-
Notifications
You must be signed in to change notification settings - Fork 61
Support javaExtensions
#66
Conversation
|
How can I try this out? |
|
We are working on the extension for RedHat Java LS to get classpath from JDT instead of calculating it ourselves with maven API... |
lib/main.js
Outdated
| const allExtensions = []; | ||
| atom.packages.getLoadedPackages() | ||
| .filter(pkg => Array.isArray(pkg.metadata.javaExtensions)) | ||
| .forEach(pkg => allExtensions.push(...pkg.metadata.javaExtensions.map(p => path.resolve(pkg.path, p)))); |
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.
Feels weird to build a new collection from inside a forEach... In C# I would have just done a SelectMany here and returned the collection that way.
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.
It does :-) but there is no flatMap() in JS6... would have to improvise with map() and reduce()
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.
This is how it'd look like:
collectJavaExtensions() {
return atom.packages.getLoadedPackages()
.filter(pkg => Array.isArray(pkg.metadata.javaExtensions))
.map(pkg => pkg.metadata.javaExtensions.map(p => path.resolve(pkg.path, p)))
.reduce(e => e.concat([]));
}
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.
That looks good - functional FTW :)
c4f52b5 to
acde872
Compare
|
Thanks! I'll mark this as 'experimental' in the CHANGELOG until we've proven it with the other side of the equation (the extension packages). |
|
@damieng thank you!-) |
VSCode has support RedHat Java LS extensions/plugins: https://github.com/redhat-developer/vscode-java/wiki/Contribute-a-Java-Extension
This needs to be mirrored in Atom because the LS is the same I think.