Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only two spaces of indentation in JavaScript in RubyMine?

Is there a way to configure RubyMine 3.1 to only use two spaces to indent JavaScript?

like image 544
pupeno Avatar asked Apr 04 '11 14:04

pupeno


People also ask

How do you indent in Rubymine?

If you need to adjust indentation settings, in the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style. On the appropriate language page, on the Tabs and Indents tab, specify the appropriate indents options and click OK.

How many spaces is a JavaScript indent?

Spacing and indentation should be consistent throughout your code. Many developers choose to use 4-space or 2-space indentation. In JavaScript, each nested statement (e.g., a statement following a "{" brace) should be indented exactly once more than the previous line's indentation.

How do I change tabs to 4 spaces in IntelliJ?

In IntelliJ IDEA, to convert existing tabs to spaces or vice versa, use File → Edit → Convert Indents → To Spaces (or To Tabs). The Reformat code shortcut Ctrl + Alt + L will also do this, while applying other changes.

How do I change the default indentation in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style. Select the Detect and use existing file indents for editing checkbox. Apply the changes and close the dialog.


1 Answers

Which version of RubyMine are you using?

The JetBrains site of reference for v3.1 reads as follows:

Settings dialog -> Project settings -> Code style -> General -> Indent

Indent:

In this text box, specify the number of spaces (or tabs if the Use Tab Character check box is selected) to be inserted for each indent level.

As for altering this specifically for Javascript, I don't see a possible solution - or at least not an easy one. You might be able to configure these general settings per file type, however. But I'm no expert in this field.

like image 162
Grant Thomas Avatar answered Oct 17 '22 10:10

Grant Thomas