Reconcile multiple language match by suffix length #8408
Labels
editor
Feedback for code editing, formatting, editor iterations, etc
enhancement
[core label]
open source
Open source community projects, contributions, etc
Check for existing issues
Describe the feature
Inspired by #7096 (comment).
The problem
Today, when multiple
LanguageMatcher
's path_suffix match a file, one random language will be chosen (see language_registry.rs get_or_load_language function). While this simple setting works well for most of the cases, it's not robust enough. E.g. there's no way to distinguish.php
or.blade.php
.Proposed fix
To make it simple, I propose changing the callback function so that it returns a tuple of boolean + max matched suffix length among all the suffixes. When there're multiple matches, the language with the longest suffix wins.
If applicable, add mockups / screenshots to help present your vision of the feature
No response
The text was updated successfully, but these errors were encountered: