fiatjaf / module-linker

browse modules by clicking directly on "import" statements on GitHub
https://module-linker.fiatjaf.com/
MIT License
251 stars 20 forks source link

Scala/SBT support? #18

Closed laughedelic closed 7 years ago

laughedelic commented 7 years ago

I don't know how this works, but I see a variety of different languages, so I guess you have some flexible solution. Would it be possible to add Scala support?

Actually, if there were some contribution docs, I could try to add it myself..

fiatjaf commented 7 years ago

Yes, it is possible. There are no contribution docs, but if there were some, they would fit in the following 3 paragraphs:

The flexibility is so huge here that actually each language stands on its own and there's no framework whatsoever. Each file at ./languages must export a function that takes no arguments and just handles the DOM by itself.

At ./helpers.js there are a bunch of useful functions used by each of the standalone language file, but you don't actually need to use any of those.

See ./languages/c.js for an example of a very simple language file that makes almost no use of helper functions.


That said, Scala runs in the JVM, right? I looked into that, but it seemed too complicated to me. I actually started a branch to implement Clojure support, because I thought it would have clearer dependency resolving and a simpler module system, but gave up after I saw they use the same old Java libraries I couldn't resolve in the client.

That's probably because I never worked with any JVM language, so maybe you'll make it. The key is to come up with way to tell where we'll find metadata for an imported module just from the name we're importing.

If you solve that, I'll be happy to help with the code integration or help you with anything.

laughedelic commented 7 years ago

Thanks for the explanation! I'll take a look at the existing code and then think whether it's worth trying.

Another question: have you seen the sourcegraph service? It's not the same thing, but they also have a Chrome extension and have some related functionality. What do you think about it?

fiatjaf commented 7 years ago

Sourcegraph is doing a much more powerful and complicated thing than this extension, that's why they have a lot of servers reading and storing code from GitHub and then parsing it to get to know what is what and then show it with the Chrome Extension. I don't know exactly, but it seems to me they're providing a little bit of overkill, they're, for example, taking years to make their Go backend work, and only now starting to add support for another language, maybe this is just a wasteful usage of developer time and computer cycles.

Anyway, I've used the Chrome Extension for a while and it's pretty cool. I don't use it anymore because it adds so many tags to GitHub's HTML that it clashes with Module Linker.

fiatjaf commented 7 years ago

Any news on this, @laughedelic? I would be glad if you could explain me overall how the Scala/SBT module names and imports work. If it is possible I'll add support to it right away.