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 buildifier Json File Configuration #357

Conversation

CauhxMilloy
Copy link
Contributor

@CauhxMilloy CauhxMilloy commented Mar 17, 2024

This PR adds the buildifierConfigJsonPath setting, which allows a custom path to be set to pull the json configuration file for buildifier (this is often .buildifier.json). If the buildifierConfigJsonPath path is set, when buildifier is run within this extension, the --config <path> CLI arguments will be passed to buildifier.

While it could be said that this PR is now adding support for the .buildifier.json file -- it's only adding support for the customization of that file path. #350 actually pulled out yet another drive-by fix (of #208) by adding the working directory. In that PR, cwd: vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath is setting the working directory for the buildifier execution to be the local workspace. This means any local .buildifier.json file will automatically get pulled in and used. This PR is allowing further customization on top of that.

The logic of this PR was tested by manually editing the js of my local extension installation with the equivalent changes (that's how I found that cwd: ... ended up working with a local .buildifier.json).

BEGIN_COMMIT_OVERRIDE
feat: Add buildifier Json File Configuration (#357)
END_COMMIT_OVERRIDE

This PR adds the `buildifierConfigJsonPath` setting, which allows a custom path to be set to pull the json configuration file for `buildifier` (this is often `.buildifier.json`). If the `buildifierConfigJsonPath` path is set, when `buildifier` is run within this extension, the `--config <path>` CLI arguments will be passed to `buildifier`.

While it could be said that this PR is now adding support for the `.buildifier.json` file -- it's only adding support for the customization of that file path. bazel-contrib#350 actually pulled out yet another drive-by fix (of bazel-contrib#208) by adding the working directory. In that PR, `cwd: vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath` is setting the working directory for the `buildifier` execution to be the local workspace. This means any local `.buildifier.json` file will automatically get pulled in and used. This PR is allowing further customization on top of that.

The logic of this PR was tested by manually editing the js of my local extension installation with the equivalent changes (that's how I found that `cwd: ...` ended up working with a local `.buildifier.json`).
@cameron-martin cameron-martin merged commit afc3aed into bazel-contrib:master Mar 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants