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

Detect qualified types and functions #58

Merged
merged 2 commits into from
Dec 15, 2018
Merged

Conversation

sheaf
Copy link
Collaborator

@sheaf sheaf commented Jun 14, 2018

I don't know how robust these changes are, but they're producing the result I want in my current projects.
With this change, setting "meta.import" tokens to have a certain color makes the qualifiers match the import statements, which seems logical to me.

It should support qualified names in infix expressions, e.g. `Module.foo`, `Module.Submodule.bar`.

Sorry if I forgot some cases.

I don't know how robust these changes are, but they're producing the result I want in my current projects.
With this change, setting "meta.import" tokens to have a certain color makes the qualifiers match the import statements, which seems logical to me.

It should support qualified names in infix expressions, e.g. `Module.foo`, `Module.Submodule.bar`.

Sorry if I forgot some cases.
@JustusAdam
Copy link
Owner

I think thats an interesting idea.

When I try this it does work for ordinary bindings, but not for infix bindings. For instance Infix.Operator.func in test/syntax-examples/test.hs is still rendered in all-red.

@sheaf
Copy link
Collaborator Author

sheaf commented Jun 14, 2018

I believe that happens because the Infix.Operator part of Infix.Operator.func has both meta.import.qualifier and keyword.operator.function.infix tags (which I think is correct). So I think it depends on how the theme handles it? It works with my theme

infix style

I'm not entirely clear on how precedence rules work with TextMate, let me know if you have a suggestion.

@JustusAdam
Copy link
Owner

Perhaps my theme just doesn't treat imports in any special way then.

@JustusAdam
Copy link
Owner

I used this opportunity to fix the scope name for the qualifier, please ensure it still highlights correctly for you (it did with a theme I tested)

@sheaf
Copy link
Collaborator Author

sheaf commented Jun 14, 2018

Yes, it works as expected with this change.

@sheaf
Copy link
Collaborator Author

sheaf commented Nov 5, 2018

The parentheses aren't rendered properly with a qualified symbolic operator:
qualified_infix_operator

BTW, I apologise for all the new issues I opened in a row... I don't have time to try to fix them right now, but I'll try to look into it once the air clears a bit. Thanks.

@JustusAdam JustusAdam merged commit ad29ebf into JustusAdam:master Dec 15, 2018
@sheaf sheaf deleted the patch-1 branch April 28, 2020 18:37
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.

2 participants