Sunday, 15 September 2013

javascript - Changing JS Indenting in Atom Keymap.cson -



javascript - Changing JS Indenting in Atom Keymap.cson -

i'm trying update keymap.cson file javascript source indented differently. not want de-indent case , default statements in switch.

by default, atom format way:

switch(x) { case 1: //stuff case 2: //stuff default: //stuff }

i case statements indented 1 time (and //stuff indented 1 time more).

so i'm trying edit keymap create format things way:

switch(x) { case 1: //stuff case 2: //stuff default: //stuff }

unfortunately, whatever try, can't stop decreasing indentation nail spacebar after "case".

from the keymaps documentation looks putting next coffeescript in keymap.cson file should disable default behavior , add together new behavior (which omits |case|default sec line of regular expression) should trick i'm not sure why it's not working:

'.source.js': 'editor': 'decreaseindentpattern': 'unset!' '.source.js': 'editor': 'decreaseindentpattern': '(?x) ^(.*\\*/)?\\s*(\\}|\\)) | ^\\s* else \\s*$ '

i think original keymap in language-javascript bundle here.

i determined isn't technically keymap can't overridden in keymap.cson. ended doing forking language-javascript repo, making change, uninstalling original language-javascript package, , installing custom fork instead.

would still know if there way update @ runtime instead; solution have manually maintain fork date upstream changes.

edit: update particular change, accepted official language-javascript bundle via pr #36.

javascript keymapping atom-editor

No comments:

Post a Comment