Sublime Forum

Sublime Text on the word "default"

#1

I’m having this problem in ST4 v4169. It only happens when I type “default”.

sublime_text_LiNJwasuHZ

Is there a way to fix this?

1 Like

#2

Appears it is recognized as default keyword of a switch-case statement by indentation rules and thus automatically unindented.

Maybe it could be fixed by moving case and default to a dedicated ruleset which only applies on meta.switch meta.block.

Interesting, that default is not a global keyword.

1 Like

#3

I thought it’s just a simple remove-this-and-voila solution. Guess I just have to hope for an update :confused:

0 Likes

#4

Is there a way to do that in the settings?

0 Likes

#5

Not via settings, but you could override the file by extracting it and placing it to Packages/JavaScript/ folder. OverrideAudit package may assist you with that.

0 Likes

#6

@deathaxe I installed it. What should I do next? I’m sorry, I’m not familiar with this so I’m running in blind. :sweat_smile:

0 Likes

#7
1 Like

#8

Thank you! :grin:

0 Likes

#9

@deathaxe I am having this same issue in C (with case and default).

0 Likes

#10

Not the same issue: Indentation rules in C/C++ are designed to keep case / default on same indentation level as switch, because …

  1. default rules support only one style of indentations
  2. ST’s indentation engine is not able to handle dedenting closing } of a switch (foo) { ... } block by 2 indentation levels, which would be required to indent case and `default``.

see also: https://github.com/sublimehq/Packages/issues/3960

0 Likes