Skip to content

fix: case-insensitive extension validation and robust language detection (fixes #685)#687

Merged
agrawal-d merged 1 commit into
agrawal-d:mainfrom
ronits2407:fix-685
Jul 19, 2026
Merged

fix: case-insensitive extension validation and robust language detection (fixes #685)#687
agrawal-d merged 1 commit into
agrawal-d:mainfrom
ronits2407:fix-685

Conversation

@ronits2407

Copy link
Copy Markdown
Contributor

This PR addresses issues with file extension validation and language detection, particularly on case-insensitive file systems like Windows.

Fixes #685

Changes:

  • Case-Insensitive Validation: Updated isValidLanguage and getLanguage to normalize extensions to lowercase before checking. This fixes issues where files like f.CPP were incorrectly flagged as unsupported.
  • Improved Language Detection: Refactored getLanguage to correctly handle extensions like .cc and .cxx by checking both language keys and supported extension values in the config.
  • Enhanced Error Feedback: Improved checkUnsupported to provide a specific "No active editor found" message when no file is active, instead of the misleading "Unsupported file extension" error.
  • Localization: Added translations for the new error message in English and Simplified Chinese.
  • Code Style: Fixed formatting issues to comply with the project's Prettier and ESLint rules.

These changes improve the user experience and prevent confusing errors during file renaming or creation.

@agrawal-d
agrawal-d merged commit 7f7d83d into agrawal-d:main Jul 19, 2026
5 checks passed
@agrawal-d

Copy link
Copy Markdown
Owner

Thanks!

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.

File unusable with CPH after changing file extension case

2 participants