3

I'm using Google's Chrome Dev Editor - developer preview. It is a Chrome extension available in the Chrome store. When I use the tab key on my keyboard, 2 spaces are indented. My aim is to change this to 4 spaces.

I've tried going to the Settings menu but there are very few options available and setting the default tab size isn't one of them.

Any idea how I can change the default tab size to 4 spaces?

3
  • 1
    I have found documentation on the file ide/web/prefs.json where the "indentation" section looks pretty promising. It contains values for "useTabs" and for "width", whose default is 2. See if you can find such a file in your distribution and change width to 4. See also ide/web/test/editor_config_test.dart.
    – harrymc
    Feb 8, 2015 at 20:52
  • Thanks, I'll try to find that file. It does look promising! Feb 8, 2015 at 21:56
  • Any news about these 2 files ?
    – harrymc
    Feb 12, 2015 at 7:32

3 Answers 3

1

How about an Autohotkey solution ("When native tools fail: AUTOHOTKEY!")? Small, portable, customizable.

#IfWinActive Chrome Dev Editor (developer preview)
TAB::
Send {space 4}
sleep 20 

The first line indicates that TAB works normally unless the Dev Editor window is active. Note that this matches the name exactly, so if the window-title changed in future, the script would break.

The last line is a delay in ms between repeated SEND events to prevent spamming. You can alter it depending on typing speed.

1
  • 1
    Thanks for the idea. I'll definitely keep it in mind but I'd prefer to learn how to change the app's config in some way. Feb 15, 2015 at 11:46
1

Examining the sources of the Chrome Dev Editor, I have found documentation on two files that look pretty promising :

ide/web/prefs.json

{
  "stripWhitespaceOnSave": true,
  "editorFontSize": 12,
  "editorTheme": null,
  "keyBindings": null,
  "indentation":{
    "default":{
      "useTabs": false,
      "width": 2
    },
    "dart":{
      "useTabs": false,
      "width": 2
    }
  }
}

The "indentation" section contains width, whose default is 2. See if you can find such a file in your distribution and change the width to 4.

ide/web/test/editor_config_test.dar

This contains a section on the edit configuration per file-type. It might be useful.

4
  • Thanks for answering. I'm using Ubuntu 14.04 (trusty). Do you know where I can find the prefs.json file in my file system? Feb 14, 2015 at 16:35
  • Should be easy enough to find : find / prefs.json or similar.
    – harrymc
    Feb 14, 2015 at 19:22
  • I found the file! Unfortunately, the change you suggested didn't work in my case. Tabs remain 2 spaces even when I update the file with sudo privileges. Feb 15, 2015 at 11:45
  • For the other file, is editor_config_test.dar relevant for you ? It might be that this file negates the change in the other one. Of course, as part of the sources, a recompile of the Chrome Dev Editor might be required to have effect (but if so this would be very poor software design).
    – harrymc
    Feb 15, 2015 at 13:24
0

According to this link:

https://github.com/dart-lang/chromedeveditor/issues/3861

the file to change is ide/web/lib/ace.dart.

change the line session.tabSize = 2;

PS: The folder is located in ~/.config/chromium/Default/Extensions

2
  • Thanks for the answer. I opened that issue, and if you take a look at the last few replies in the thread, you'll see the solution didn't work for me. Feb 15, 2015 at 11:43
  • Sorry. I should have looked
    – jkd
    Feb 15, 2015 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .