For some reason, when using IntelliJ and Scalafmt 2.7.5, typing /** followed by [ENTER] results in the following sort of docstring:
As you can see, the first asterisk has no indentation... Since I have "format on save" enabled, hitting [CTRL]+[S] results in a correctly formatted docstring:
It doesn't surprise me that the initial format wouldn't match up with scalafmt's, and that the formatting isn't really applied until saving or compiling (if that's enabled). However, the lack of indentation on the first asterisk -- even if it's only present until I save or compile -- is driving me mad.
Does anyone know how to resolve this without using the built-in IntelliJ formatter? This is actually tempting me to scrap scalafmt and just use the IntelliJ formatter for my team's project. Thanks :)
Here's the .scalafmt.conf for reference:
version = 2.7.5
project.git = true
preset = IntelliJ
Related
I have coded in Java with IntelliJ and found that the code completion works perfectly. But when I tried to code in a new language (Dart), the auto-completion does not work as expected.
When I type a string of characters (e.g. "String"), the code completion pops up with incorrect suggestions initially, then refreshes to show a larger list of suggestions containing the desired completion.
Initially:
After a few hundred milliseconds:
It takes a while for the full list of suggestions to appear. In the first photo, there is a spinning loading icon in the bottom right. I assume that IntelliJ is providing me with an incomplete list of suggestions before fully loading all the suggestions.
But if I hit [ENTER] or type [SPACE] immediately after typing "String", I get the incorrect "EquatableConfig.stringify" autocomplete, whereas I just want a String.
Is there a way to fix this?
This may happen while analysis is in progress. For example, soon after project opening or after a major source or pubspec modification. Some completion variants appear sooner than others, and this causes confusion. Once the project is warmed up, code completion should include String item right away.
Note that you may disable completion item insertion on Space in Settings (Preferences) | Editor | General | Code Completion.
I have been having issues with getting my scala worksheet to evaluate the inside of my objects. The goal is to get something like this:
However I instead get this:
I have taken a look at both of these questions asked in the past:
Scala worksheet does not evaluate object in IntelliJ IDEA 2016.2
Print out Scala worksheet results in interactive mode in IntelliJ
I tried copy pasting the code from the accepted solutions as well as checking the Use "eclipse compatibility" mode in preferences but nothing seems to work.
change the Scala worksheet settings.
change run type to plain (original it was REPL)
You can get to settings by clicking the settings icon on the Scala worksheet.
I use CUDA 8.0's version of nsight (Eclipse platform 4.4.0, CDT 8.4.0). My Eclipse C/++ formatter is configured to indent as follows (image is from the Formatter config prev:
but if I have this code:
and I press enter, get to the next line (the cursor is placed under the span), and type in an opening brace, it is not placed at the beginning of the line, but is rather kept indented:
Is this a bug or have I misconfigured something?
Notes:
I tried both the built-in formatter and the "CUDA C" formatter; they behave the same in this case
I see this behaviour in stock CDT as well. It looks like a bug. Please file a bug report.
I guess I'm a quick typer because if I type the characters
ArrayList myArray;
myArray.size(
NetBeans auto complete puts the following in my editor
ArrayList myArray;
myArray.add(someVar);
Why? Because the auto completion doesn't have time to find and filter all the method names by the time I type '('. So it takes the the first one from the list it has created and filtered so far: "add". Grrrr!!!
I want to keep method name completion, but I don't want it to happen on '('. I haven't been able to find out how to fine tune this awesome feature to stop it from mangling my code.
I cannot reproduce you problem in NetBeans 7.1.2. Maybe I'm not typing fast enough...
Take a look at the Options to switch off some of the code completion options: Tools->Options, select the Editor section, then the Code Completion tab.
A.S. This is a comment but I don't have the rep.
I definitely experience this issue, and similar ones in other IDEs like Eclipse or Qt Creator - though I can't always be bothered figuring out how they happened. For example in Qt Creator I type:
size_t len = array.size();
and it becomes
size_t len = array.size(;)
because it didn't recognize quickly enough that I wanted to type over the closing ')'.
It is even more annoying when the editor doesn't allow overwriting or tab-jumping those braces as you have to press Right arrow.
As I was playing around for the first time with CoffeeScript, I ran in to a problem. In order to debug my problem, I tried replacing my whole file with one of the example bits of code from the coffee script site:
kids =
brother:
name: "Max"
age: 11
sister:
name: "Ida"
age: 9
However, when I try to compile that code, I get:
Error: In coffee/main.coffee, Parse error on line 3: Unexpected 'INDENT'
at Object.parseError (/usr/lib/coffeescript/parser.js:501:11)
at Object.parse (/usr/lib/coffeescript/parser.js:573:32)
at Object.compile (/usr/lib/coffeescript/coffee-script.js:23:22)
at /usr/lib/coffeescript/command.js:99:27
at /usr/lib/coffeescript/command.js:72:28
at fs:84:13
at node.js:773:9
In coffee/main.coffee, Parse error on line 3: Unexpected 'INDENT'
Since this is code from the CoffeeScript site, I assume the code itself isn't the problem. However, the compiler also seems to be working properly; if I compile:
a = 2
it generates a file with:
(function(){
var a;
a = 2;
})();
as expected. So in other words, the code is good, the compiler is good, and yet somehow I'm getting this Unexpected 'IDENT' error ... can anyone help me understand what is going on?
I am pretty sure this is a tabs-vs-spaces issue. Tell your editor not to convert spaces to tabs if it does that. Also, go through your code with the cursor and make sure it doesn't jump over blank areas.
The issue is that while normal editors see a tab as equivalent to two or four spaces, coffeescript sees it as one space, so the indentation gets messed up.
If this all doesn't help, make sure you have a recent coffeescript version, e.g. 1.1.0 or newer.
If you are using a JetBrains IDE (IntelliJ, PHPStorm, etc) the change of setting that worked for me is:
File > Settings > Project Settings > Code Style > CoffeeScript > Tabs
and Indents
Tick "Use tab character" & "Smart tabs"
Code is fine. Make sure you haven't messed up the whitespace (strange control chars showing as blanks, tabs or similar).
If you have the same problem, but your indentation is okay,
then you must be suffering from bug 2868.
Basically, the error is misleading. Check for indentation
errors in the required files.
When in Atom you can automatically convert tabs to spaces:
Packages > Whitespace > Convert Tabs to Spaces
You can resolve this two ways
1. IF using webstorm File->Default Settings as said above
2. Other workaround, is to use a different editor like Sublime, there u can press enter on earlier line and it will auto tab it for you with spaces