Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Conversation

@BoykoAlex
Copy link
Contributor

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.

@damieng
Copy link
Contributor

damieng commented Mar 21, 2018

How can I try this out?

@BoykoAlex
Copy link
Contributor Author

We are working on the extension for RedHat Java LS to get classpath from JDT instead of calculating it ourselves with maven API...
We haven't tried it with Atom yet, but will try it out very soon. This is just some preparation work to see whether this patch looks acceptable. Ideally it should work since the only thing required is absolute path to jars in the init message. I'll post how to test it once we get closer to the completion of our Java LS extension

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))));
Copy link
Contributor

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.

Copy link
Contributor Author

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()

Copy link
Contributor Author

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([]));
  }

Copy link
Contributor

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 :)

@damieng damieng merged commit 7e489da into atom:master Mar 22, 2018
@damieng
Copy link
Contributor

damieng commented Mar 22, 2018

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).

@BoykoAlex
Copy link
Contributor Author

@damieng thank you!-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants