Add classification API support for VB members, locals and parameters, and tweak C# implementation#25126
Conversation
This change renames the recently added `ClassificationTypeNames.EnumFieldName` to `ClassificationTypeNames.EnumMemberName` to be consistent with other Roslyn APIs (such as EnumMemberDeclarationSyntax). In addition, the newly added `ClassificationTypeNames` constants for member classification were incorrectly added to PublicAPI.Shipped.txt rather than PublicAPI.Unshipped.txt. This commit fixes that (since the APIs haven't shipped yet).
This change ensures that extension methods are only classified specially when declared or when called in a reduced form. If an extension method is called as an ordinary static method invocation, it is classified as an oridinary method.
|
@dotnet-bot retest this please |
| { | ||
| return ClassificationBuilder.Inactive(value); | ||
| } | ||
| protected FormattedClassification Struct(string text) => ClassificationBuilder.Struct(text); |
There was a problem hiding this comment.
Would a using static of ClassificationBuilder avoid the need to have all of these?
There was a problem hiding this comment.
heh-heh. Yes, I think you're right. I'll take a look at that.
|
|
||
| public const string FieldName = "field name"; | ||
| public const string EnumFieldName = "enum field name"; | ||
| public const string EnumMemberName = "enum member name"; |
There was a problem hiding this comment.
Do we have to update EditorColors.xml in the VS repo for theming?
There was a problem hiding this comment.
I'm not sure if the right thing happened there when the C# ones were introduced either.
There was a problem hiding this comment.
We don't need to update EditorColors.xml yet. This is just an API-only change. In VS, these all map back to "identifier" for now. When we introduce this feature for VS we'll update it for theming.
|
@Pilchie for ask mode approval for 15.7.P2 |
|
Approved for 15.7 P2 |
|
Thanks all! |
This is a follow up to #24931 that tweaks C# classification and adds support for Visual Basic. This only affects the classification APIs and does is not (yet) exposed in Visual Studio. This is related to #3976.
The design tweaks I've made to the original C# implementation (#24931) are:
Enumerable.Select(...)), it will be classified as an ordinary method.EnumFieldNamehas been renamed toEnumMemberNameto better match the rest of the Roslyn API (i.e.EnumMemberDeclarationSyntax).Note that extension method declarations in VB are impossible to classify syntactically. So, they VB methods are classified as methods and the semantic classifier adds an additional classification for extension methods.
In addition, this PR unifies the classification unit test infrastructure quite a bit. It might be useful to review one commit at a time if it's too cumbersome.
cc @mkrueger