Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconcile multiple language match by suffix length #8408

Open
1 task done
jianghoy opened this issue Feb 25, 2024 · 0 comments · May be fixed by #11697
Open
1 task done

Reconcile multiple language match by suffix length #8408

jianghoy opened this issue Feb 25, 2024 · 0 comments · May be fixed by #11697
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] open source Open source community projects, contributions, etc

Comments

@jianghoy
Copy link

Check for existing issues

  • Completed

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

@jianghoy jianghoy added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Feb 25, 2024
@JosephTLyons JosephTLyons added editor Feedback for code editing, formatting, editor iterations, etc open source Open source community projects, contributions, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] open source Open source community projects, contributions, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants