Skip to content

Commit

Permalink
fix: regression in nested swift projects #29
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Oct 1, 2023
1 parent 860f358 commit 4565d90
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.6.6

- fix: regression in nested swift projects #29

# 1.6.5

- fix: respect nested swift projects #26
Expand Down
4 changes: 2 additions & 2 deletions 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.6.5",
"version": "1.6.6",
"license": "MIT",
"author": {
"name": "Valentin Knabel",
Expand All @@ -20,7 +20,7 @@
"theme": "light"
},
"engines": {
"vscode": "^1.26.0"
"vscode": "^1.80.0"
},
"categories": [
"Formatters",
Expand Down
21 changes: 11 additions & 10 deletions src/Current.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface Current {
editor: {
openURL(url: string): Thenable<void>;
reportIssueForError(
error: Partial<Error & { code: number }>
error: Partial<Error & { code: number }>,
): Thenable<void>;
showErrorMessage<T extends string>(
message: string,
Expand Down Expand Up @@ -38,15 +38,16 @@ export function prodEnvironment(): Current {
async openURL(url: string) {
await vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(url)
vscode.Uri.parse(url),
);
},
async reportIssueForError(error) {
const title = `Report ${error.code || ""} ${error.message ||
""}`.replace(/\\n/, " ");
const title = `Report ${error.code || ""} ${
error.message || ""
}`.replace(/\\n/, " ");
const body = "`" + (error.stack || JSON.stringify(error)) + "`";
await Current.editor.openURL(
url`https://github.com/vknabel/vscode-swiftformat/issues/new?title=${title}&body=${body}`
url`https://github.com/vknabel/vscode-swiftformat/issues/new?title=${title}&body=${body}`,
);
},
showErrorMessage: <T extends string>(message: string, ...actions: T[]) =>
Expand All @@ -59,7 +60,7 @@ export function prodEnvironment(): Current {
) =>
vscode.window.showWarningMessage(message, ...actions) as Thenable<
T | undefined
>
>,
},
config: {
isEnabled: () =>
Expand All @@ -76,8 +77,8 @@ export function prodEnvironment(): Current {
swiftFormatPath: (document: vscode.TextDocument) => {
// Support running from Swift PM projects
const possibleLocalPaths = glob.sync(
"**/.build/{release,debug}/swiftlint",
{ maxDepth: 5 }
"**/.build/{release,debug}/swiftformat",
{ maxDepth: 5 },
);
for (const path of possibleLocalPaths) {
// Grab the project root from the local workspace
Expand Down Expand Up @@ -113,8 +114,8 @@ export function prodEnvironment(): Current {
vscode.workspace
.getConfiguration()
.get("swiftformat.configSearchPaths", [".swiftformat"])
.map(absolutePath)
}
.map(absolutePath),
},
};
}

Expand Down

0 comments on commit 4565d90

Please sign in to comment.