Skip to content

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

Merged
71 merged 1 commit into71:masterfrom
jariji:fix/language-specific-default-mode
Mar 15, 2026
Merged

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

Conversation

@jariji
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor Author

jariji commented Mar 8, 2026

I tested and confirmed this works locally.

Copy link
Copy Markdown
Owner

@71 71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@71 71 merged commit 0051821 into 71:master Mar 15, 2026
2 checks passed
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.

2 participants