Skip to content

Commit

Permalink
Formatting new files lead to an error #6
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Mar 1, 2019
1 parent 5dc875a commit 9d6dadd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 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.1

* Formatting new files lead to an error. #6 - [@vknabel](https://github.com/vknabel/)

# 1.3.0

* Automatically load SwiftFormat config files. #5 - [@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.0",
"version": "1.3.1",
"license": "MIT",
"author": {
"name": "Valentin Knabel",
Expand Down
4 changes: 3 additions & 1 deletion src/SwiftFormatEditProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ function userDefinedFormatOptionsForDocument(
if (formatOptions.indexOf("--config") != -1) return formatOptions;
const workspaceFolder = vscode.workspace.getWorkspaceFolder(document.uri);
const rootPath =
workspaceFolder!.uri.fsPath || vscode.workspace.rootPath || "./";
(workspaceFolder && workspaceFolder.uri.fsPath) ||
vscode.workspace.rootPath ||
"./";
const searchPaths = Current.config
.formatConfigSearchPaths()
.map(current => join(rootPath, current));
Expand Down

0 comments on commit 9d6dadd

Please sign in to comment.