Skip to content

Commit

Permalink
Fix block style none (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-wiemer authored Oct 19, 2024
1 parent 234ebd1 commit c05e25e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run validate
- run: npm run validate:ci
26 changes: 0 additions & 26 deletions client/src/test/formatting/array_object_style.ahk

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
;* No directive
list := [{ name: 1, age: 2
}, { name: 2, age: 3
}]
list := [{ name: 1, age: 2 }, { name: 2, age: 3 }]
;@format array_style: expand, object_style: expand
list := [
{
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@
"sort-package-json": "sort-package-json --check",
"sort-package-json:fix": "sort-package-json",
"test": "npm run test:grammar && npm run test:unit && npm run test:e2e",
"test:ci": "npm run test:grammar && npm run test:unit && npm run test:e2e:ci",
"pretest:e2e": "npm run build:e2e",
"test:e2e": "vscode-test",
"test:e2e:ci": "npm run test:e2e -- --forbid-only",
"test:grammar": "vscode-tmgrammar-snap \"tmgrammar-test/*.ahk\"",
"pretest:unit": "npm run compile-ts",
"test:unit": "mocha",
"prevalidate": "npm run clean",
"validate": "npm run lint && npm run test && echo ✅ All checks passed",
"validate:ci": "npm run lint && npm run test:ci && echo ✅ All checks passed",
"prevalidate:fix": "npm run clean",
"validate:fix": "npm run lint:fix && npm run test && echo ✅ All checks passed",
"vscode:prepublish": "npm run validate",
Expand Down
4 changes: 2 additions & 2 deletions server/src/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5509,7 +5509,7 @@ export class Lexer {
const style = flags.array_style ?? opt.array_style;
if (style === OBJECT_STYLE.collapse || last_text === '[' || flags.indentation_level >= previous_flags.indentation_level)
trim_newlines();
else if (style || input_wanted_newline && opt.preserve_newlines)
else if (style !== 'none' || input_wanted_newline && opt.preserve_newlines)
print_newline(true);
} else if ((last_type === 'TK_END_EXPR' || last_type === 'TK_END_BLOCK') && flags.indentation_level >= previous_flags.indentation_level)
trim_newlines();
Expand Down Expand Up @@ -5576,7 +5576,7 @@ export class Lexer {
const style = flags.object_style ?? opt.object_style;
if (style === OBJECT_STYLE.collapse || last_text === '{')
trim_newlines();
else if (style || input_wanted_newline && opt.preserve_newlines)
else if (style !== 'none' || input_wanted_newline && opt.preserve_newlines)
print_newline(true);
output_space_before_token = space_in_other && last_text !== '{';
} else if (opt.brace_style !== 'Preserve' || input_wanted_newline)
Expand Down

0 comments on commit c05e25e

Please sign in to comment.