Repository navigation
feat: support requiring approval to run process plugins in editors - #1401
Merged
dsherret merged 9 commits intoOct 29, 2026
Merged
Conversation
dsherret
force-pushed
the
feat/lsp-process-plugin-approval
branch
from
October 27, 2026 17:41
ead48be to
ba43a2a
Compare
dsherret
force-pushed
the
feat/lsp-process-plugin-approval
branch
6 times, most recently
from
October 28, 2026 17:01
204053c to
e6399ab
Compare
This is the work of this branch so far restacked onto schema version 6 of the editor service. The capabilities and approve process plugins messages that were added to schema version 5 are left out because schema version 6 replaces them, so schema version 5 only says in the log when process plugins weren't allowed to run.
…r service The editor service asks with a show message request that has the same actions as the language server, which every editor that uses schema version 6 handles, so this doesn't need new messages or a capability.
…gins are allowed - Editors don't use any plugins of a config file whose process plugins weren't allowed, so a Wasm plugin doesn't format files differently than the CLI. Schema version 6 of the editor service and the language server say why with a new `processPluginsNotAllowed` reason. - Rename `dprint config allow-process-plugins` to `dprint config editor-approve`. - Ask again when the plugin.json of an npm plugin without a version changes in node_modules, which the config file doesn't pin. - Use the decision for the session when storing it fails, and use the most recent decision so that approving after denying for the session works. - Warn once about unknown properties and problems reading settings.json.
… process plugins are allowed
…rsion 6 of the editor service The configuration info says why a configuration file doesn't format anything when its process plugins aren't allowed, and the editor is told when they're allowed outside of it (ex. with `dprint config editor-approve`).
…hema version 6 of the editor service Not choosing an action leaves running the process plugins undecided instead of denying them for the session.
A process plugin is now allowed with its own configuration in the configuration file, so changing the configuration of another plugin or the global configuration doesn't ask again. A plugin that isn't set up yet is allowed to be set up first because its configuration isn't known until then, and it's allowed with its configuration once it is. Running `dprint fmt` or `dprint config install` with a configuration file allows its process plugins in editors because that's the same as choosing to run them, which replaces `dprint config editor-approve`. With schema version 6 of the editor service, the install plugins message asks the user to allow the process plugins it installs, which replaces the message to ask again, and a format only asks when the plugins are installed.
…en running dprint check
Denying a process plugin that isn't set up denies it with any configuration because its configuration isn't known until then, so neither formatting nor installing asks about it again, and `Always Deny` stores that.
dsherret
force-pushed
the
feat/lsp-process-plugin-approval
branch
from
October 28, 2026 19:51
f121642 to
25b6339
Compare
Member
Author
|
These commits are now part of #1408, which also replaces the editor service's schema version 6 with |
An error occurred while trying to automatically change base from
feat/workspace-editor-service
to
main
November 16, 2026 22:02
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.
Part of #1400. Stacked on #1408.
Process plugins aren't sandboxed, and an editor opening a project or a file (ex. a repository that was just cloned or a file in
node_modules) isn't the same as the user choosing to run dprint there. This adds a way to require approving process plugins in editors, which is opt-in to start:dprint editor-infothen don't set up or start the process plugins of a config file until the user allows them. This is checked before resolving the plugins because setting up a process plugin runs it to get its information.editor-state.jsonfile in the cache directory (the language server'slsp-state.jsonrenamed), which keeps the most recent 5000. Losing it only has the user asked again.settings.jsonis a new file for dprint's settings that aren't formatting configuration. It's only read from the global config directory. It's deliberately not a language server setting because an editor's workspace settings can come from the project (ex..vscode/settings.json).dprint fmtis choosing to run dprint there.Language server: asks with a
window/showMessageRequestthat hasAllow(for the session),Always Allow,Deny(for the session) andAlways Denyactions once per session for each configuration. A client that can't show the actions gets a message saying they weren't allowed and that runningdprint config allow-process-pluginsallows them.Editor service: schema version 6 (#1408) asks with a show message request that has the same actions, which every editor using schema version 6 already handles, so this doesn't add any messages. Schema version 5 isn't changed and doesn't start the process plugins that weren't allowed, with a warning on stderr that says how to allow them. The current dprint-vscode and dprint-intellij use schema version 5, so they keep working the same way.
dprint config allow-process-pluginsallows the process plugins of the config file (--configor the one found from the current directory), the same as "Always Allow". It's for editors that can't ask.The preferences of
dprint initmove tosettings.jsontoo (in aninitproperty). They're still read from theinit.jsonfile dprint 0.64 saved them to, which is removed the next time they're saved. Only the property being changed is written, so the rest of the file (ex. its comments) is kept as it is.