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

when searching for a syntax, search in reverse order #217

Merged
merged 3 commits into from
Oct 16, 2018

Conversation

keith-hall
Copy link
Collaborator

this will prioritize syntaxes loaded last over those loaded first when searching for a suitable syntax by any means. As syntaxes are loaded deterministically in lexicographical order, this matches Sublime Text's behavior in case of conflicts, and should allow custom syntaxes to be used in favor of "built-in" syntaxes, which is useful for #205.

this will prioritize those loaded last over those loaded first, in case of conflicts. As syntaxes are loaded deterministically in lexicographical order, this matches Sublime Text's behavior
Copy link
Collaborator

@robinst robinst left a comment

Choose a reason for hiding this comment

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

Can you add at least one test as well?

syntax = syntax_set.find_syntax_by_scope(Scope::new(&"source.a").unwrap()).unwrap();
assert_eq!(syntax.name, "A improved");
syntax = syntax_set.find_syntax_by_first_line(&"syntax a").unwrap();
assert_eq!(syntax.name, "C");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice tests :)

@trishume trishume merged commit b9e08bd into trishume:master Oct 16, 2018
@keith-hall keith-hall deleted the syntax_search_priority branch October 16, 2018 05:59
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.

3 participants