Skip to content

fix: respect language-specific dance.defaultMode overrides#422

Open
jariji wants to merge 1 commit into71:masterfrom
jariji:fix/language-specific-default-mode
Open

fix: respect language-specific dance.defaultMode overrides#422
jariji wants to merge 1 commit into71:masterfrom
jariji:fix/language-specific-default-mode

Conversation

@jariji
Copy link

@jariji jariji commented Mar 8, 2026

Summary

  • 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 like [magit] or [git-commit] are silently ignored
  • The global value is stored as a single _defaultMode and applied to every new editor regardless of language
  • Fix: resolve the default mode per-editor in _getDefaultModeForEditor(), passing the editor's document as the configuration scope so VS Code returns the correct language-specific value

Motivation

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:

"[magit]": {
  "dance.defaultMode": "insert"
}

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

  • Set "[magit]": { "dance.defaultMode": "insert" } in settings.json
  • Open a magit status view via edamagit
  • Verify the view opens in insert mode (not normal mode)
  • Verify other editors still open in the globally configured default mode
  • Verify that switching away from and back to a magit tab preserves whatever mode the user is in (fallback state is not affected)

🤖 Generated with Claude Code

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>
@jariji
Copy link
Author

jariji commented Mar 8, 2026

I tested and confirmed this works locally.

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.

1 participant