Repository navigation
feat: support shell expansion in dprint.path - #159
Merged
Merged
Conversation
|
fyi this broke the workaround i was using to achieve the same result when using the pypi version of dprint. i won't bother opening a separate issue because i have another workaround (dprint/dprint#859 (comment)), and i don't think it's really dprint's responsibility to fix this. see astral-sh/uv#15800 (comment) |
Member
Author
|
Fixing: #189 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supports a
dprint.pathsetting that uses shell expansion, such as"dprint.path": "$(yarn bin dprint)". As before, adprint.pathfrom the workspace settings must be approved before it's run.dprint.pathsetting is interpreted by the shell (ex.$(yarn bin dprint)or$HOME/bin/dprint). Previously this happened to work because everything was double quoted when launched with a shell, which applied to the arguments too. Now the arguments (ex. config file paths) are single quoted so they're passed as-is, and an executable found in node_modules or on the path is launched without a shell.$(...)in thedprint.pathsetting itself (in the folder's directory) and uses its trimmed output. A shell is still used to launch dprint so that an npmdprint.cmdresolves, but the command and its quoted arguments are now provided as a single command line, which also avoids Node's DEP0190 warning about passing arguments with the shell option.The launch logic is in a new
getCommandLaunchInfofunction that's used for the editor service,editor-info/-v, and the language server.This also allows using dprint installed with Yarn Plug'n'Play (no node_modules folder) via
"dprint.path": "$(yarn bin dprint)"on macOS and Linux. On Windows,yarn bin dprintresolves to the package'sbin.cjsscript in that case, which can't be launched directly.SECURITY: Note that this ask for approval before executing so the extension doesn't run commands in config files without asking.
Closes #38
Closes #45