Skip to content

Commit

Permalink
v2.7.2 (#61)
Browse files Browse the repository at this point in the history
-   Fix indentation with parentheses again (sorry!) ([#58](#58))
  • Loading branch information
mark-wiemer authored Mar 3, 2021
1 parent 1ef84ba commit 8741d6e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.7.2 - 2021-03-02

- Fix indentation with parentheses again (sorry!) ([#58](https://github.com/mark-wiemer/vscode-autohotkey-plus-plus/issues/58))

## 2.7.1 - 2021-02-28

- Fix indentation with parentheses ([#25](https://github.com/mark-wiemer/vscode-autohotkey-plus-plus/issues/25))
Expand Down
4 changes: 3 additions & 1 deletion docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@ The tests should run automatically, and you should see passing output in the Deb

### Publishing

1. `git co dev`
1. `git checkout dev`

1. `git merge v<major>.<minor>.<patch>`

1. Tag the release

1. Delete the release branch in local

1. `git checkout master`

1. `git tag v<major>.<minor>.<patch>`

1. `git push origin v<major>.<minor>.<patch>`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-autohotkey-plus-plus",
"displayName": "AutoHotkey Plus Plus",
"description": "AutoHotkey IntelliSense, debug, and language support for VS Code, forked from AutoHotkey Plus by cweijan",
"version": "2.7.1",
"version": "2.7.2",
"publisher": "mark-wiemer",
"engines": {
"vscode": "^1.30.0"
Expand Down
8 changes: 4 additions & 4 deletions src/providers/formattingProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export class FormatProvider implements vscode.DocumentFormattingEditProvider {

// Check close parens
if (purifiedLine.includes(')')) {
const openCount = purifiedLine.match(/\(/)?.length ?? 0;
const closeCount = purifiedLine.match(/\)/).length;
const openCount = purifiedLine.match(/\(/g)?.length ?? 0;
const closeCount = purifiedLine.match(/\)/g).length;
if (closeCount > openCount) {
depth--;
}
Expand Down Expand Up @@ -184,8 +184,8 @@ export class FormatProvider implements vscode.DocumentFormattingEditProvider {

// Check open parens
if (purifiedLine.includes('(')) {
const openCount = purifiedLine.match(/\(/).length;
const closeCount = purifiedLine.match(/\)/)?.length ?? 0;
const openCount = purifiedLine.match(/\(/g).length;
const closeCount = purifiedLine.match(/\)/g)?.length ?? 0;
if (openCount > closeCount) {
depth++;
}
Expand Down
3 changes: 3 additions & 0 deletions src/test/suite/format/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const defaultOptions: vscode.FormattingOptions = {
insertSpaces: true,
};
const formatTests: FormatTest[] = [
{
filenameRoot: '58-parenthesesIndentation',
},
{ filenameRoot: 'demo' },
{
filenameRoot: 'insertSpacesFalse',
Expand Down
14 changes: 14 additions & 0 deletions src/test/suite/format/samples/58-parenthesesIndentation.in.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; [Issue #58](https://github.com/mark-wiemer/vscode-autohotkey-plus-plus/issues/58)
foo(bar,
(baz) )
x := 1

foo(
bar
(baz)
)

TaskName := "[RunAsTask] " A_ScriptName " @" SubStr( "000000000" DllCall( "NTDLL\RtlComputeCrc32"
, "Int",0, "WStr",CmdLine, "UInt",StrLen( CmdLine ) * 2, "UInt" ), -9 )

x := 1
14 changes: 14 additions & 0 deletions src/test/suite/format/samples/58-parenthesesIndentation.out.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; [Issue #58](https://github.com/mark-wiemer/vscode-autohotkey-plus-plus/issues/58)
foo(bar,
(baz) )
x := 1

foo(
bar
(baz)
)

TaskName := "[RunAsTask] " A_ScriptName " @" SubStr( "000000000" DllCall( "NTDLL\RtlComputeCrc32"
, "Int",0, "WStr",CmdLine, "UInt",StrLen( CmdLine ) * 2, "UInt" ), -9 )

x := 1

0 comments on commit 8741d6e

Please sign in to comment.