Closed
Conversation
Now at least type param lists don't break the font locking of later param lists in the signature.
Fontify type names in generic instantiation param lists. We look for
index expressions and fontify the elements as types if one of the
following is true:
- There is more than one element in the list (e.g. "foo[int, string]").
- The list is followed by "{" (a composite literal)
(e.g. "foo[int]{}").
- The list is preceded by space and then an identifer
(e.g. "var foo bar[int]").
When in doubt, we don't fontify, so expressions like "foo[int]()" will
not have "int" fontified as a type.
Now we fontify func names in generic invocations when there are more than one type params (so we can be sure it is a func instantiation). I also tweaked things to avoid fontifying "bar" in (foo)(bar)(baz) (fixes dominikh#385). We also support fontifying method names with type params even though that isn't allowed yet.
Fix "foo.Bar" to be fontified as a type in "foo.Bar[int, string]{}".
e515e45 to
fef154a
Compare
dominikh
approved these changes
Jul 31, 2022
Owner
|
@muirdm is this ready for merging as is? |
Collaborator
Author
No, I'm not really happy with this. We can peel off just the first commit for now for some relief. I have a different branch with a somewhat better approach - let me try to get that ready for eyes. |
Collaborator
Author
|
I opened #410 that has a better approach where we can "piggyback" on top of the existing type fontification in most cases. |
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.
Attempt to fix some fortification issues with type params
#393