fix(cm): preserve CodeMirror mode aliases and improve mode picker#1974
Merged
bajrangCoder merged 1 commit intoAcode-Foundation:mainfrom Mar 23, 2026
Merged
Conversation
Contributor
Greptile SummaryThis PR overhauls the CodeMirror mode registry to preserve language aliases (e.g. Key changes:
Issues found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant P as changeMode palette
participant EF as editorFile.setMode()
participant ML as modelist
participant SM as supportedModes (init)
Note over SM,ML: App startup
SM->>ML: addMode(modeId, pattern, caption, loader, {aliases, filenameMatchers})
ML->>ML: modesByName[modeId] = mode
ML->>ML: modesByName[alias] = mode (for each alias)
ML->>ML: modes.push(mode)
Note over P,EF: User picks a mode
P->>P: generateHints() — sort, pin active, add alias search terms
P->>EF: onselect(modeId) → activeFile.setMode(modeId)
EF->>ML: getMode(modeId)
ML-->>EF: Mode (found by primary key or alias)
EF->>EF: currentMode = mode.name
EF->>EF: currentLanguageExtension = mode.getExtension()
Note over EF,ML: File open with stored association
EF->>EF: mode = localStorage.modeassoc[ext]
EF->>ML: getMode(storedMode)
alt alias resolved
ML-->>EF: Mode
else not found
ML-->>EF: null
EF->>ML: getModeForPath(filename)
ML-->>EF: Mode (by extension/filename regex)
end
Reviews (1): Last reviewed commit: "fix(cm): preserve CodeMirror mode aliase..." | Re-trigger Greptile |
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.
No description provided.