erlang / sourcer

An Erlang language server, providing IDE services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using "sourcer" as a command line application?

jacksonbenete opened this issue · comments

Hello there,

Sorry if my question doesn't makes sense, I'm new to Erlang and even newer to rebar3.

I've been looking for a "code formatter", I've tried rebar3_format and rebar3_steamroller, but seems like they need to be called as "rebar3 <plugin_name>" from the project root, and they format the entire project.
If I enter in the apps/src/ directory and try to call it in there it fails, because it doesn't find the command.

In README, sourcer says "The actual work is done by this application. It is meant to be LSP-agnostic so that it can be used in other contexts and tools.".

Does being used in other context and tools means that it can be somehow compiled and used without calling "rebar3"?

What I'm looking for is to be able to call sourcer file_name.erl in command line and it returns an indented file as output.
As I've said, I'm new to rebar3, I don't know if it can be compiled and called in command line like this.

Hi! Currently, no, there is no command line wrapper that allows you to do that. It is relatively easy to write an utility that reads a file into a string, calls sourcer_indent:all() on it and writes the result in another file.

Note that I haven't been working on this in a while, so I can't guarantee it works with newer Erlang versions, nor that it matches recent versions of the Emacs formatter (which it did when it was written).

Thank you very much, it took me a while to understand how to "bundle" everything together but in the end it turns to be easy as you've said.

The files needed for it to work was sourcer_indent.erl, sourcer_scan.erl and debug.hrl.

Can I assume by what I've read in the Apache license that to distribute those three files I need only to copy the Apache license together with them? (or maybe use the same license in my project)
Can I, or should I, reference your name as creator of this functionality on my README file or you prefer not to?
Sorry about those questions, I don't really understand much about Licenses and Open Source common practices as of yet, it always confuse me a good bit.
I'm playing around in creating a text editor and while I don't have time to write my own code formatter I will be distributing those files together if that's not a problem. I might even just be using them for now on instead of writing my own.

I'll be closing this Issue since I could reproduce your suggestions and it is working.

This licensing stuff is weird, not all licenses are compatible. The LICENSE file says what is needed to do to be compliant - the files don't have a copyright notice, I think you can ´just add a link to to the full license and to the sourcer project. No need to mention my name, the authorship is spread between the contributors. (If you really want to mention a name, sourcer_indent was written by Dan Gudmunsson from the OTP team).

Good luck with your project!