diff --git a/src/providers/format.test.ts b/src/providers/format.test.ts index 539f6bdb..e60f2716 100644 --- a/src/providers/format.test.ts +++ b/src/providers/format.test.ts @@ -69,6 +69,7 @@ const formatTests: FormatTest[] = [ { filenameRoot: '290-ifmsgbox' }, { filenameRoot: '291-single-line-comment' }, { filenameRoot: '316-if-object-continuation-section' }, + { filenameRoot: '429-single-line-hotkey' }, { filenameRoot: 'ahk-explorer' }, { filenameRoot: 'align-assignment' }, { filenameRoot: 'demo' }, diff --git a/src/providers/formattingProvider.ts b/src/providers/formattingProvider.ts index 31ca8927..2a03bbfa 100644 --- a/src/providers/formattingProvider.ts +++ b/src/providers/formattingProvider.ts @@ -38,8 +38,8 @@ export const internalFormat = ( /** Level of indentation on previous line */ let prevLineDepth = 0; /** - * It's marker for `Return`, `ExitApp`, `#Directive` commands, which - * allow/disallow for them to be un-indented. + * It's marker for `Return`, `ExitApp`, `#Directive` commands and `Labels`, + * which allow/disallow for them to be un-indented. * * ------------------------------------------------------------------------- * `tagDepth === 0`: @@ -59,15 +59,15 @@ export const internalFormat = ( * Current indentation level is in sync with `Label` indentation level * (no additional indent added by block `{}`, `oneCommandCode`, etc...). * - * `Return` or `ExitApp` commands allowed to be un-indented, so they will - * be placed on same indentation level as `Label`. + * `Return`, `ExitApp`, `Fall-Through Label` allowed to be un-indented, + * so they will be placed on same indentation level as `Label`. * * `Label` allowed to be un-indented for fall-through scenario. * * ------------------------------------------------------------------------- * `tagDepth !== depth`: * - * `Return` or `ExitApp` commands disallowed to be un-indented, so they + * `Return`, `ExitApp`, `Label` disallowed to be un-indented, so they * will obey indentation rules as code above them (`Return` inside * function, block `{}`, `oneCommandCode`, etc... stay on same * indentation level as code above them). @@ -83,8 +83,8 @@ export const internalFormat = ( * * Only `Label` makes syncing `tagDepth` with `depth`. * - * `Case:` and `Default:` must not make syncing to disallow `Return` and - * `ExitApp` un-indent inside `Switch-Case` block. + * `Case:` and `Default:` must not make syncing to disallow `Return`, + * `ExitApp` and `Label` to un-indent inside `Switch-Case` block. */ let tagDepth = 0; @@ -293,11 +293,17 @@ export const internalFormat = ( */ const label = /^[^\s\t,`]+(?