fix: respect language-specific dance.defaultMode overrides#422
Open
fix: respect language-specific dance.defaultMode overrides#422
Conversation
dance.defaultMode is declared as language-overridable in package.json,
but observePreference reads it via getConfiguration("dance") without a
document scope, so language-specific overrides (e.g. [magit] or
[git-commit]) are never resolved. The global value is stored as a
single _defaultMode and applied to every new editor.
Move the configuration lookup into _getDefaultModeForEditor, which
passes the editor's document as the scope so that VS Code resolves
language-specific values correctly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
I tested and confirmed this works locally. |
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.
Summary
dance.defaultModeis declared aslanguage-overridableinpackage.json, butobservePreferencereads it viagetConfiguration("dance")without a document scope, so language-specific overrides like[magit]or[git-commit]are silently ignored_defaultModeand applied to every new editor regardless of language_getDefaultModeForEditor(), passing the editor's document as the configuration scope so VS Code returns the correct language-specific valueMotivation
Users of edamagit (and similar extensions that register custom language IDs) cannot set a different default mode for those buffers. For example, this setting has no effect today:
After this fix, the above works as expected — magit views open in insert mode while other editors continue to use the global default.
Test plan
"[magit]": { "dance.defaultMode": "insert" }insettings.json🤖 Generated with Claude Code