OmniSharp / omnisharp-roslyn

OmniSharp server (HTTP, STDIO) based on Roslyn workspaces
MIT License
1.78k stars 419 forks source link

Available quick fix actions are inconsistent #2129

Open HymanZHAN opened 3 years ago

HymanZHAN commented 3 years ago

Issue Description

Available quick fix actions are inconsistent for different constructor parameters and for different formats.

Steps to Reproduce

  1. Prepare a constructor function that takes multiple parameters.
  2. Format the parameter list with different options.
  3. Place the cursor on a parameter.
  4. Press Ctrl+. and inspect the available quick fixes.

Expected Behavior

Available quick fix actions should be consistent for all constructor parameters.

Actual Behavior

Quick fix actions are inconsistent based on how you format the parameter list and which parameter you are trying to act upon.

Screenshot from 2021-04-01 21-10-20

Screenshot from 2021-04-01 21-24-58

Screenshot from 2021-04-01 21-10-02

Logs

OmniSharp log

```shell Starting OmniSharp server at 4/1/2021, 9:09:37 PM Target: /home/xzhan/Development/MOOC/fullstack/skinet/skinet.sln OmniSharp server started. Path: /home/xzhan/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.8/run PID: 112674 [info]: OmniSharp.Stdio.Host Starting OmniSharp on fedora 33.0 (x64) [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 1 MSBuild instance(s) 1: StandAlone 16.9.0 - "/home/xzhan/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator MSBUILD_EXE_PATH environment variable set to '/home/xzhan/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin/MSBuild.exe' [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 16.9.0 - "/home/xzhan/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin" CscToolExe = csc.exe MSBuildToolsPath = /home/xzhan/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin CscToolPath = /home/xzhan/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin/Roslyn BypassFrameworkInstallChecks = true MSBuildExtensionsPath = /home/xzhan/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.8/omnisharp/.msbuild [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0 [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.ImplementTypeWorkspaceOptionsProvider, Order: 110 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140 [info]: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in '/home/xzhan/Development/MOOC/fullstack/skinet'. [info]: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem Detecting projects in '/home/xzhan/Development/MOOC/fullstack/skinet/skinet.sln'. [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/home/xzhan/Development/MOOC/fullstack/skinet/API/API.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/home/xzhan/Development/MOOC/fullstack/skinet/Core/Core.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/home/xzhan/Development/MOOC/fullstack/skinet/Infrastructure/Infrastructure.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in '/home/xzhan/Development/MOOC/fullstack/skinet'. [info]: OmniSharp.Script.ScriptProjectSystem Could not find any CSX files [info]: OmniSharp.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location '/home/xzhan/Development/MOOC/fullstack/skinet' on host 112261. [info]: OmniSharp.MSBuild.ProjectManager Loading project: /home/xzhan/Development/MOOC/fullstack/skinet/API/API.csproj Can't find custom attr constructor image: /home/xzhan/Development/MOOC/fullstack/skinet/Infrastructure/bin/Debug/net5.0/Infrastructure.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. Can't find custom attr constructor image: /home/xzhan/Development/MOOC/fullstack/skinet/Core/bin/Debug/net5.0/Core.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/home/xzhan/Development/MOOC/fullstack/skinet/API/API.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/home/xzhan/Development/MOOC/fullstack/skinet/API/API.csproj' [info]: OmniSharp.MSBuild.ProjectManager Loading project: /home/xzhan/Development/MOOC/fullstack/skinet/Core/Core.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/home/xzhan/Development/MOOC/fullstack/skinet/Core/Core.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/home/xzhan/Development/MOOC/fullstack/skinet/Core/Core.csproj' [info]: OmniSharp.MSBuild.ProjectManager Loading project: /home/xzhan/Development/MOOC/fullstack/skinet/Infrastructure/Infrastructure.csproj Can't find custom attr constructor image: /home/xzhan/Development/MOOC/fullstack/skinet/Core/bin/Debug/net5.0/Core.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/home/xzhan/Development/MOOC/fullstack/skinet/Infrastructure/Infrastructure.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/home/xzhan/Development/MOOC/fullstack/skinet/Infrastructure/Infrastructure.csproj' [info]: OmniSharp.MSBuild.ProjectManager Update project: API Can't find custom attr constructor image: /home/xzhan/Development/MOOC/fullstack/skinet/Infrastructure/bin/Debug/net5.0/Infrastructure.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. Can't find custom attr constructor image: /home/xzhan/Development/MOOC/fullstack/skinet/Core/bin/Debug/net5.0/Core.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. [info]: OmniSharp.MSBuild.ProjectManager Update project: Core [info]: OmniSharp.MSBuild.ProjectManager Update project: Infrastructure Received response for /v2/getcodeactions but could not find request. Received response for /findusages but could not find request. [info]: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: Wrap every parameter -> Align wrapped parameters [info]: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: Wrap long parameter list -> Align wrapped parameters [warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService No symbol found. File: /home/xzhan/Development/MOOC/fullstack/skinet/API/Controllers/ProductsController.cs, Line: 24, Column: 78. ```

C# log

```shell Getting latest OmniSharp version information Downloading package 'Latest OmniSharp Version Information' (1 KB).................... Done! ```

Environment information

VSCode version: 1.55.0 C# Extension: 1.23.9

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 5.0.201 Commit: a09bd5c86c Runtime Environment: OS Name: fedora OS Version: 33 OS Platform: Linux RID: fedora.33-x64 Base Path: /usr/share/dotnet/sdk/5.0.201/ Host (useful for support): Version: 5.0.4 Commit: f27d337295 .NET SDKs installed: 3.1.407 [/usr/share/dotnet/sdk] 5.0.201 [/usr/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |angular-console|nrwl|17.1.0| |angular2-switcher|infinity1207|0.3.4| |beautify|HookyQR|1.5.0| |better-toml|bungcip|0.3.2| |cmake|twxs|0.0.17| |cmake-tools|ms-vscode|1.6.0| |code-spell-checker|streetsidesoftware|1.10.2| |cpptools|ms-vscode|1.2.2| |crates|serayuzgur|0.5.7| |crystal-lang|crystal-lang-tools|0.8.1| |csharp|ms-dotnettools|1.23.9| |csharpextensions|kreativ-software|1.3.6| |dart-code|Dart-Code|3.21.1| |debugger-for-chrome|msjsdiag|4.12.12| |dotenv|mikestead|1.0.1| |dotnet-test-explorer|formulahendry|0.7.5| |elixir-ls|JakeBecker|0.6.5| |elm-ls-vscode|elmTooling|2.1.0| |ember-related-files|josa|1.5.0| |EmberES6Snippets|phanitejakomaravolu|2.3.3| |emberjs|emberjs|1.0.1| |fluent-icons|miguelsolorio|0.0.7| |flutter|Dart-Code|3.21.0| |githistory|donjayamanne|0.6.16| |gitlens|eamodio|11.3.0| |go|golang|0.23.3| |graphviz-interactive-preview|tintinweb|0.0.10| |highlight-matching-tag|vincaslt|0.10.0| |JavaScriptSnippets|xabikos|1.8.0| |jinjahtml|samuelcolvin|0.16.0| |jupyter|ms-toolsai|2021.5.702919634| |latex-workshop|James-Yu|8.16.1| |lit-plugin|runem|1.2.1| |LiveServer|ritwickdey|5.6.1| |mako|tommorris|0.2.0| |markdown-all-in-one|yzhang|3.4.0| |markdown-preview-enhanced|shd101wyy|0.5.17| |material-icon-theme|PKief|4.6.0| |material-product-icons|PKief|1.0.4| |material-theme|zhuangtongfa|3.9.15| |nativescript|NativeScript|0.12.3| |nimvscode|nimsaem|0.1.19| |nunjucks-template|eseom|0.3.4| |one-monokai|azemoh|0.5.0| |path-intellisense|christian-kohler|2.3.0| |postcss-language|mhmadhamster|2.1.0| |powershell|ms-vscode|2021.2.2| |prettier-vscode|esbenp|6.3.1| |prisma|Prisma|2.20.1| |pug|amandeepmittal|1.0.1| |python|ms-python|2021.3.680753044| |remote-containers|ms-vscode-remote|0.166.0| |remote-wsl|ms-vscode-remote|0.54.6| |rest-client|humao|0.24.4| |rtf|alefragnani|2.2.0| |rust-analyzer|matklad|0.2.538| |sass-indented|syler|1.8.16| |svelte-vscode|svelte|104.8.0| |TabOut|albert|0.2.0| |toml|be5invis|0.5.1| |vetur|octref|0.33.1| |vim|vscodevim|1.19.3| |vsc-ember-cli|felixrieseberg|0.3.3| |vscode-data-preview|RandomFractalsInc|2.3.0| |vscode-dbml|matt-meyers|0.3.5| |vscode-docker|ms-azuretools|1.11.0| |vscode-ember|emberjs|0.2.1| |vscode-eslint|dbaeumer|2.1.19| |vscode-firefox-debug|firefox-devtools|2.9.3| |vscode-graphql|GraphQL|0.3.15| |vscode-graphviz|joaompinto|0.0.6| |vscode-html-css|ecmel|1.10.2| |vscode-import-cost|wix|2.15.0| |vscode-java-debug|vscjava|0.32.1| |vscode-java-dependency|vscjava|0.18.2| |vscode-java-pack|vscjava|0.13.0| |vscode-jest-runner|firsttris|0.4.31| |vscode-maven|vscjava|0.28.0| |vscode-mjml|mjmlio|1.0.4| |vscode-npm-script|eg2|0.3.18| |vscode-nuget-gallery|patcx|0.0.24| |vscode-pugbeautify|mrmlnc|1.0.2| |vscode-pylance|ms-python|2021.3.4| |vscode-solution-explorer|fernandoescolar|0.4.2| |vscode-sqlite|alexcvzz|0.11.1| |vscode-stylelint|stylelint|0.86.0| |vscode-svg-previewer|vitaliymaz|0.7.0| |vscode-tailwindcss|bradlc|0.5.9| |vscode-todo-highlight|wayou|1.0.4| |vscode-wakatime|WakaTime|5.0.1| |vscode-yaml|redhat|0.17.0| |vue-vscode-snippets|sdras|2.2.0| |xml-format|mikeburgh|1.1.2|;
filipw commented 3 years ago

I will move this to the OmniSharp server repo, thanks for reporting.