Please see the below images.
The first image shows the issue at hand; When writing a markdown file with the markdown plugin in intellij, the line wrapping adds a space at the beginning of the next line, and it accumulates for each new line. The bottom three images shows what I believe are the relevant settings.
Any idea why these extra spaces are being added? Is it a bug or a problem with my settings? It is really annoying having to always go back and delete the extra spaces.
This is the bug:
https://youtrack.jetbrains.com/issue/IDEA-220392
You can disable hard wrap for Markdown (Preferences | Editor | Code Style | Markdown > Wrap on typing) and use only soft wrap (Preferences | Editor | General > Soft Wraps)
Related
How can I increase the number of spaces of a single tab indent?
I noticed that in another project a tab corresponds to four white spaces, but in the current one it is only two.
It is a simple question, but I have not found an answer and it would save me a lot of time.
It's configurable in the code style settings: Settings (Preferences on macOS) | Editor | Code Style | Java | Tabs and Indents | Tab size.
Some projects may override it via EditorConfig. If you don't want it, disable Settings (Preferences on macOS) | Editor | Code Style | Enable EditorConfig support.
IDEA: 2021.1.3
Svelte plugin: 0.19.0
I have the Svelte IDEA plugin installed and it keeps trying to indent everything with 2 spaces, instead of 4 spaces (the rest of the project uses 4 spaces).
I can't figure out how to customise it.
There's no "Svelte" entry under File | Settings | Editor | Code Style
All other code styles are set to 4 spaces (typescript, html, javascript, etc.)
There's no .editorconfig file in my project source
I could swear this thing was indenting consistent with the rest of the project just a few weeks ago, but now I'm not sure.
How do I tell IDEA to use 4 spaces for indenting Svelte files?
Svelte inherits indentation from HTML and JavaScript. Pay attention to the following settings:
Preferences / Settings | Editor | Code Style | JavaScript | Tabs and Indents | Indent.
Preferences / Settings | Editor | Code Style | HTML | Tabs and Indents | Indent.
If the settings are set to 4, check your .editorconfig file (if it exists) and finds indent_size = 2 entries. You can try to temporarily remove the .editorconfig file to make sure that the issue isn't related to it.
For me, the answer the was to turn off "detect and use existing file indents".
The indenting widget in the bottom right of the editor will tell you if IDEA has decided your file is "2 spaces" or "4 spaces". You can also use this widget to force re-indent to 4 spaces.
This auto-detection probably explains why IDEA suddenly started to behave differently. Maybe there was a change int he recent IDEA patch, or perhaps my project files changed through editing to trigger the algorithm into thinking the Svelte files were using 2 spaces for indenting.
In the <template> area Intellij is using 2 spaces for indention and for the <script> part it's using 4 spaces. I get errors running npm run dev because of the different indention.
I have set Intellij to use 4 spaces for all filetypes that I could find (not including JS or .vue). The project itself uses 2 spaces (I would like to change that).
However, now like I said it's using two different indention styles within the same file and that causes a whole lot of problems.
Code -> Reformat code changes the code to this style with 2 different indentions.
Any idea what's going on? Thanks!
First, make sure you don't have Detect and use existing file indents for editing enabled in Settings/Preferences | Editor | Code Style. If you do, when you auto-indent, it might apply the wrong settings.
Then, try reformatting the code using Control+Alt+L or Code -> Reformat Code.
On Intellij IDEA 14, I have tried to set my preferences in Editor > Code Style > LESS to do 2 space indents but no matter what I do, my code ends up getting formatted with 4 space indents. How do I get it to do 2 space indents for LESS?
If your project has an ".editorconfig" file, IntelliJ 14 uses that by default (which overwrites your settings). If you absolutely do not wish to use these settings, you need to disable the editorconfig plugin.
Not as likely, but if you make a scratch buffer and rename it to filename.ext. It does not honor the code style for *.ext, it defaults to tabs. You have to copy the scratch buffer to a real file and then it will apply the code style for *.ext.
I really like Intellij's line wrapping feature with icons marking line wraps. Hovewer the default wrapping icon's readability is far from ideal.. is there any way I could fix this little problem?
Current solution is to use standard unicode symbols from supplementary arrows set: 2925 and 2926.
You can modify that by specifying other unicode (hex) codes via idea.editor.wrap.soft.before.code and idea.editor.wrap.soft.after.code properties in idea.properties file. Note that it's necessary to define both symbols, e.g. add to the idea.properties something like below:
idea.editor.wrap.soft.before.code=2906
idea.editor.wrap.soft.after.code=2907
Note that not all the fonts contain all the Unicode characters, so you have to choose the proper font in Settings | Editor | Colors & Fonts and specify the symbol code that exists in the font that you are using.
To clarify what CrazyCoder said:
On a Mac, you'll need to go into finder and "show package contents" on the Intellij IDEA.app, then you can add lines to the idea.properties file in the "bin" folder. Here's the arrow codes I went with:
idea.editor.wrap.soft.before.code=219e
idea.editor.wrap.soft.after.code=21a0
Don't forget, you can also change their color in the program's preferences under "editor > colors and fonts > general > soft wrap sign".