Comments (18)
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.
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.
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.
Ok, guys, you are both right. I'll add settings page for formatter. But it will take some time.
from intellij-erlang.
We can use emacs formatter in early versions of plugin. I am sure all erlang developers have emacs installed :)
from intellij-erlang.
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.
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.
See https://github.com/erlang/otp/blob/maint/lib/tools/emacs/test.erl.orig for test data.
from intellij-erlang.
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.
@sergeyevstifeev will be possible after http://youtrack.jetbrains.com/issue/IDEA-69685
from intellij-erlang.
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.
Yes, we have an action for formatting with emacs, as well as our own formatter.
from intellij-erlang.
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.
Please see (erlang-indent-current-buffer) in (erlang-mode).
from intellij-erlang.
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.
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.
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.
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)
- Don't offer some functions from erlang module HOT 1
- red code for some types
- red code
- No docs for OTP modules HOT 2
- Better support for rebar3 HOT 1
- generate documentation with code module HOT 9
- get in trouble: Failed to setup debugger environment HOT 3
- 2023.2 support HOT 1
- Search files lost sdk modules HOT 1
- JpsErlangModelSerializerExtension: JVMCFRE199E bad major version 61.0 HOT 2
- I use erlang remote, but I get an error, what should I do?
- Debugging failed with: Failed to setup debugger environment using Intelij 2023.2.5, OSX 13.5.2 (22G91) HOT 6
- Add support for IntelliJ 2023.3 HOT 11
- intellij-erlang-0.11.1205 don't support intelliJ IDEA IC-233.13135.103 HOT 1
- Beam file in MacOs is not created HOT 2
- new function improve
- Add support for IntelliJ 2024.1
- Can not add SDK on Intellij 2024.1 HOT 4
- how to set to format indent macro ifdef?
- Debugging failed with: Failed to setup debugger environment using Intelij 2024.1.3 with intellij-erlang-0.11.1226
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intellij-erlang.