Skip to content

Commit

Permalink
Add search parent dirs config for VSCode extension (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptibell authored Sep 5, 2022
1 parent 7545780 commit f18a4aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions stylua-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ To view the changelog of the StyLua binary, see [here](https://github.com/Johnny

### Added

- Added `stylua.searchParentDirectories` to configure whether we look for configuration files in parent directories or not.
- Added `stylua.disableVersionCheck` to configure whether we call out to GitHub to check for newer versions. Useful if you do not want network requests
- Added v0.13 to release version setting

Expand Down
4 changes: 2 additions & 2 deletions stylua-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions stylua-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
"type": "boolean",
"default": false,
"description": "Disable checking the version of stylua for newer versions. Useful if you do not want network requests"
},
"stylua.searchParentDirectories": {
"type": "boolean",
"default": false,
"description": "Search parent directories for a stylua configuration file if one is not directly available."
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions stylua-vscode/src/stylua.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export function formatCode(
args.push("--range-end");
args.push(endPos.toString());
}
if (
vscode.workspace.getConfiguration("stylua").get("searchParentDirectories")
) {
args.push("--search-parent-directories");
}
args.push("-");

const child = spawn(`${path}`, args, {
Expand Down

0 comments on commit f18a4aa

Please sign in to comment.