dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 667 forks source link

"Add using" quick fix does not appear in error squiggle toolsip #3246

Open klausenbusk opened 5 years ago

klausenbusk commented 5 years ago

Issue Description

According to: https://github.com/OmniSharp/omnisharp-vscode/issues/1117 there should be a "Add using" quick fix.

Steps to Reproduce

dotnet new console -n test
cd test
code .

Choose the Program.cs file and write Socket socket; in the Main method.

Expected Behavior

A quick fix should be available to add the missing using System.Net.Sockets directive.

Actual Behavior

image

Logs

OmniSharp log

Starting OmniSharp server at 25.8.2019 21.41.34 Target: /tmp/test OmniSharp server started. Path: /home/kristian/.vscode-oss/extensions/ms-vscode.csharp-1.21.1/.omnisharp/1.34.2/run PID: 14417 [info]: OmniSharp.Stdio.Host Starting OmniSharp on arch 0.0 (x64) [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 1 MSBuild instance(s) 1: StandAlone 16.0 - "/home/kristian/.vscode-oss/extensions/ms-vscode.csharp-1.21.1/.omnisharp/1.34.2/omnisharp/.msbuild/Current/Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator MSBUILD_EXE_PATH environment variable set to '/home/kristian/.vscode-oss/extensions/ms-vscode.csharp-1.21.1/.omnisharp/1.34.2/omnisharp/.msbuild/Current/Bin/MSBuild.dll' [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 16.0 - "/home/kristian/.vscode-oss/extensions/ms-vscode.csharp-1.21.1/.omnisharp/1.34.2/omnisharp/.msbuild/Current/Bin" MSBuildExtensionsPath = /home/kristian/.vscode-oss/extensions/ms-vscode.csharp-1.21.1/.omnisharp/1.34.2/omnisharp/.msbuild BypassFrameworkInstallChecks = true CscToolPath = /home/kristian/.vscode-oss/extensions/ms-vscode.csharp-1.21.1/.omnisharp/1.34.2/omnisharp/.msbuild/Current/Bin/Roslyn CscToolExe = csc.exe MSBuildToolsPath = /home/kristian/.vscode-oss/extensions/ms-vscode.csharp-1.21.1/.omnisharp/1.34.2/omnisharp/.msbuild/Current/Bin [info]: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in '/tmp/test'. [info]: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem No solution files found in '/tmp/test' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/tmp/test/test.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in '/tmp/test'. [info]: OmniSharp.Script.ScriptProjectSystem Could not find any CSX files [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.MSBuild.ProjectManager Loading project: /tmp/test/test.csproj [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200 [info]: OmniSharp.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location '/tmp/test' on host 14301. [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/tmp/test/test.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/tmp/test/test.csproj' [info]: OmniSharp.MSBuild.ProjectManager Update project: test [info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers Solution initialized -> queue all documents for code analysis. Initial document count: 3.

C# log

Not relevant

Environment information

VSCode version: 1.37.1 C# Extension: 1.21.1

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.108 Commit: 33ed5b90ce Runtime Environment: OS Name: arch OS Version: OS Platform: Linux RID: arch-x64 Base Path: /opt/dotnet/sdk/2.2.108/ Host (useful for support): Version: 2.2.6 Commit: 7dac9b1b51 .NET Core SDKs installed: 2.2.108 [/opt/dotnet/sdk] .NET Core runtimes installed: Microsoft.NETCore.App 2.2.6 [/opt/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |csharp|ms-vscode|1.21.1|;
rchande commented 5 years ago

@klausenbusk Can you try putting the caret on the line with the error and pressing "ctrl-."? I think this is a presentation issue (we show up in the lightbulb but not the error tooltip)

klausenbusk commented 5 years ago

@klausenbusk Can you try putting the caret on the line with the error and pressing "ctrl-."? I think this is a presentation issue (we show up in the lightbulb but not the error tooltip)

It works, thanks! It isn't very intuitive though.

cartermp commented 4 years ago

Adding some screenshots for clarity. The tooltip shows no quick fix:

image

But there is one with the lightbulb:

image