Giter Site home page Giter Site logo

Comments (18)

ignatov avatar ignatov commented on July 17, 2024

Seems, the good idea is a provide path to emacs and after that we can
use emacs formatter like:
http://erlang.org/pipermail/erlang-questions/2009-February/041720.html

And leave the standard formatter as well.

from intellij-erlang.

horkhe avatar horkhe commented on July 17, 2024

That would be a perfect quick hack to do the job while a native formatter is being adjusted. But IMHO it is not acceptable as a permanent solution for several reasons:

  • Emacs needs to be installed to do as simple thing as formatting which definitely prevent your plugin from being good out-of-the-box;
  • The default formatter as it is produces unsatisfactory result. It does not recognize type specifications, very bad with tuple and record formating; and indention from some of my functions was removed altogether. The default formatter should be something that is used but the majority of developers and that is not what we have now;
  • Performance might become a problem since Emacs is not a light-weight thing;
  • I have a filling that Formatter and Auto-Indentation are somewhat dependent features. Auto-indentation needs to insert indentation based on the effective formatter.

from intellij-erlang.

vovakyrychenko avatar vovakyrychenko commented on July 17, 2024

It is better to make formatter adjustable like in other intellij ides, and maybe provide emacs-style config for people who need this. Because whether emacs style is de-facto "standard" it is a) usually violated (and there are good reasons for it) and b) have too much "variants" for style of the similar code like C-c C-a.

from intellij-erlang.

ignatov avatar ignatov commented on July 17, 2024

Ok, guys, you are both right. I'll add settings page for formatter. But it will take some time.

from intellij-erlang.

yzh44yzh avatar yzh44yzh commented on July 17, 2024

We can use emacs formatter in early versions of plugin. I am sure all erlang developers have emacs installed :)

from intellij-erlang.

yzh44yzh avatar yzh44yzh commented on July 17, 2024

Code Style -> Erlang -> Tabs and Indents
Tab size and indent should be 8 chars long by default.

See screenshots and explanation here https://plus.google.com/u/0/111796213623287288776/posts/BiuFW8qatsM

from intellij-erlang.

yzh44yzh avatar yzh44yzh commented on July 17, 2024

Emacs compatibility is absolutely needed, so we can use it

exec '!emacs --eval "(progn (find-file \"' . expand('%:p') . '\")' .
   \ '(erlang-indent-current-buffer) (save-buffer) '.
   \ '(save-buffers-kill-emacs))"'

as temporary solution. Till we found a better way.

from intellij-erlang.

ignatov avatar ignatov commented on July 17, 2024

See https://github.com/erlang/otp/blob/maint/lib/tools/emacs/test.erl.orig for test data.

from intellij-erlang.

sergeyevstifeev avatar sergeyevstifeev commented on July 17, 2024

It would be great if the formatter could pay attention to file-specific emacs-configs, like this footer:

%%% Local Variables:
%%% erlang-indent-level: 2
%%% End:

or this header:

%% -*- erlang-indent-level: 2 -*-

Different files within one project may have different indentation level specified (usually some have 2 spaces, some have 4 spaces).

from intellij-erlang.

ignatov avatar ignatov commented on July 17, 2024

@sergeyevstifeev will be possible after http://youtrack.jetbrains.com/issue/IDEA-69685

from intellij-erlang.

artburkart avatar artburkart commented on July 17, 2024

Does this still use emacs? I'm trying to take a stab at a formatter, but it's not as simple as I'd hoped.

from intellij-erlang.

deadok22 avatar deadok22 commented on July 17, 2024

Yes, we have an action for formatting with emacs, as well as our own formatter.

from intellij-erlang.

amir343 avatar amir343 commented on July 17, 2024

Hi,

It might be a stupid mistake by me but when I try "Reformat code with Emacs", the whole code is indented with 4 spaces. I even tried to set indent level. Any idea?

from intellij-erlang.

ignatov avatar ignatov commented on July 17, 2024

Please see (erlang-indent-current-buffer) in (erlang-mode).

from intellij-erlang.

amir343 avatar amir343 commented on July 17, 2024

I mean in IntelliJ IDEA, when I use Code -> "Reformat Code with Emacs", the indentation is with 4 spaces. Do you mean that I need to fix it in Emacs itself?

from intellij-erlang.

NobbZ avatar NobbZ commented on July 17, 2024

Yes, because it runs in an hidden emacs. It's called indend WITH emacs, not
LIKE emacs.

αmir μoulavi [email protected] schrieb am Mo., 14. März 2016 21:45:

I mean in IntelliJ IDEA, when I use Code -> "Reformat Code with Emacs",
the indentation is with 4 spaces. Do you mean that I need to fix it in
Emacs itself?


Reply to this email directly or view it on GitHub
#10 (comment)
.

from intellij-erlang.

amir343 avatar amir343 commented on July 17, 2024

Ok, I set erlang-indent-level in my .emacs file and I tested to see if the erlang-indent-current-buffer works and it did. However the IntelliJ still format the code differently. What am I doing wrong here?

from intellij-erlang.

amir343 avatar amir343 commented on July 17, 2024

I was reading the code in "src/org/intellij/erlang/actions/ErlangEmacsFormatAction.java" and I was wondering the way java handles processes, does it read .emacs file from home directory?

from intellij-erlang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.