Recommend keyword static for static local functions#32187
Recommend keyword static for static local functions#32187jcouv merged 2 commits intodotnet:dev16.0-preview2from
Conversation
|
Thanks! @jinujoseph Any chance to get this in for preview2? Without this completion gets in the way of typing static local functions. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@jcouv oops , yes thatz what i wanted to say , but coped the wrong branch name, thanks for correcting. |
| public async Task TestNotBetweenUsings() | ||
| { | ||
| await VerifyAbsenceAsync(AddInsideMethod( | ||
| await VerifyKeywordAsync(AddInsideMethod( |
There was a problem hiding this comment.
We should expect the static keyword to show here since it's inside a method. That said, test name needs to be changed too.
There was a problem hiding this comment.
I'm fairly certain the test was not originally intended to test behavior inside of methods (this is not a valid location for using directives, and there is no equivalent test for cases outside of methods where the directives are allowed). I would prefer to fix the test so it's testing the behavior of using directives in the correct location rather than what we have here.
| else | ||
| { | ||
| var result = (await RecommendKeywordsAsync(position, context)).Single(); | ||
| var result = (await RecommendKeywordsAsync(position, context)).SingleOrDefault(); |
There was a problem hiding this comment.
📝 this gives us the benefit of the assertion message on next line.
|
Updated test. It uncovered existing bug with |
|
Thanks @jinujoseph Let me know if there is anything else I need to do to get approval. Otherwise, I assume you'll drive the process. Thanks |
|
yes will do once our current payload is inserted |
|
@jcouv can you pls fill in the ask mode template pls |
|
@jinujoseph Do we have an example of the template to use at this point? |
|
@jcouv Your first post has already been edited to show the template headings |
|
Ah, thanks! |
|
@jcouv good to merge |
Customer scenario
User types a static local function (C# 8.0 beta).
Completion gets in the way of typing
static, by auto-completing toSystem.ContextStaticAttribute.Bugs this fixes
Fixes #32174
Workarounds, if any
You can dismiss the incorrect completion, but more often than not, you'll need to delete
System.ContextStaticAttributeand typestaticand dismiss the incorrect completion.Risk
Performance impact
Low. This is a one-line fix in the recommender for
statickeyword.Is this a regression from a previous update?
No, this is the result of a feature introduced in preview2.
Root cause analysis
New feature requires some adjustments to tooling.
How was the bug found?
Ad-hoc IDE validation as part of compiler test plan for new language features.
Filed https://devdiv.visualstudio.com/DevDiv/_workitems/edit/763373 for shiproom purpose
@dotnet/roslyn-ide for review. Thanks
CC @cston
Relates to #32069