{{ message }}
Repository navigation
feat(lsp): support not using the global config by default - #1264
Merged
Merged
Conversation
…the global config The language server always fell back to the global config file for files without a config file in an ancestor directory. Setting this environment variable to 0 or false disables that so an editor extension can make using the global config file opt-in.
…hen formatting on save Setting DPRINT_EDITOR_USE_GLOBAL_CONFIG to explicit uses the global config file except when a document is being formatted because it is being saved. The server knows that by having the client tell it when it will save and did save a document.
dsherret
marked this pull request as draft
October 1, 2026 17:12
Member
Author
…config when formatting on save" This reverts commit 8d5edf6.
… the global config A client may provide this option in a format request to use the global config file for a document without a config file in an ancestor directory when the server does not use the global config file by default.
dsherret
marked this pull request as ready for review
October 1, 2026 17:22
…onfig-env # Conflicts: # crates/dprint/src/commands/lsp/mod.rs
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.

dprint lspalways falls back to the global config file for files that don't have a config file in an ancestor directory. This allows an editor to make that opt-in and to still explicitly format with the global config file.DPRINT_EDITOR_USE_GLOBAL_CONFIGenvironment variable - Setting it to0orfalsedisables the fallback. It's read once when the server starts and the behaviour is unchanged when it's not set.useGlobalConfigformatting option - A client may provideuseGlobalConfig: truein the options of atextDocument/formattingortextDocument/rangeFormattingrequest to use the global config file for that request when there's no config file in an ancestor directory.This is so dprint-vscode can pass its
dprint.useGlobalConfigsetting, which currently has no effect in its LSP mode, when launching the server and can have a command that formats the current document using the global config file when that setting is off.An earlier commit here tried to not use the global config file only when formatting on save, but that was reverted because a server can't reliably tell that a format request is for a save in vscode.
Replaces #1263.