Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search parent dirs config for VSCode extension #568

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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