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.08k stars 4.04k forks source link

IntelliSense not suggesting namespaces after `using` for top-level statements #58470

Open Youssef1313 opened 2 years ago

Youssef1313 commented 2 years ago

Version Used:

17.1.0 P1.1

Steps to Reproduce:

  1. Trigger completion here, it works as expected.

    using System;
    using Sys$$

    image

  2. Trigger completion here, it doesn't work.

    using System;
    using Sys$$
    
    Console.WriteLine();

    image

Note that using $$ triggers IntelliSense properly. But using Sys$$ fails.

It's most likely caused by using Sys gets parsed as LocalDeclarationStatement, while using alone is parsed as an incomplete UsingDirective

Youssef1313 commented 2 years ago

Reporting per https://stackoverflow.com/questions/70437767/top-level-statements-live-code-suggestion-not-working

dfkeenan commented 2 years ago

I was experiencing this yesterday. Seemed like if I typed anywhere other then the end of the file code completion broke down.

I was using 17.2.X.