dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.05k stars 4.04k forks source link

Don't get offered usings/spell checker etc inside the method body of an abstract method #19140

Open davkean opened 7 years ago

davkean commented 7 years ago

Was doing refactoring where I wanted to convert an abstract method -> virtual method, I added a body to the abstract method and while I got normal intellisense, I did not offered usings or spelling check code actions, etc until I removed the "abstract".

This feels strange to be me, because other invalid constructs such as unrecognized modifiers don't stop me from getting offered these.

    class Program
    {
        internal abstract void Method()
        {
            String foo; 
        }
    }
  1. CTRL+. on String

Expected: To get offered to add "using System;" Actual: Nothing.

davkean commented 7 years ago

Also don't get colorized keywords.

tag @CyrusNajmabadi

Pilchie commented 7 years ago

Nevermind - pulling back to IDE given that everything else works.

Also don't get colorized keywords.

can you give an example? I can't repro this part.

davkean commented 7 years ago

@Pilchie My mistake, I didn't have "System" in scope - and so String wasn't being picked up as a type.

CyrusNajmabadi commented 4 years ago

Moving to compiler. The issue here is that binding isn't going into these bodies. This is an error case, but should still work IMO.