Skip to content

Commit

Permalink
End of newline was always stripped, closes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Feb 23, 2020
1 parent 233ca85 commit ae4b331
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.3.4

* End of newline was always stripped. #13 - [@vknabel](https://github.com/vknabel/)

# 1.3.3

* Introduced extension logo. - [@vknabel](https://github.com/vknabel/)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/vknabel/vscode-swiftformat"
},
"version": "1.3.3",
"version": "1.3.4",
"license": "MIT",
"author": {
"name": "Valentin Knabel",
Expand Down
26 changes: 12 additions & 14 deletions src/SwiftFormatEditProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,18 @@ function format(request: {
? `${request.formatting.tabSize}`
: "tabs"
];
const newContents = childProcess
.execFileSync(
Current.config.swiftFormatPath(request.document),
[
...userDefinedParams,
...(request.parameters || []),
...formattingParameters
],
{
encoding: "utf8",
input
}
)
.slice(0, -1);
const newContents = childProcess.execFileSync(
Current.config.swiftFormatPath(request.document),
[
...userDefinedParams,
...(request.parameters || []),
...formattingParameters
],
{
encoding: "utf8",
input
}
);
return newContents !== request.document.getText(request.range)
? [
vscode.TextEdit.replace(
Expand Down

0 comments on commit ae4b331

Please sign in to comment.