belav / csharpier

CSharpier is an opinionated code formatter for c#.
https://csharpier.com
MIT License
1.43k stars 99 forks source link

VS Code looses installed formatter every reload #1064

Open lomeat opened 11 months ago

lomeat commented 11 months ago

Type: Bug

Issue Description

Ask for installing the csharpier again locally or globally, but I have already installed dotnet-csharpier via dotnet tool install csharpier -g.

Steps to Reproduce

  1. Fresh start.
  2. Install dotnet-sdk via homebrew.
  3. Save new PATH provided by console assistant
  4. Install the extension.
  5. At the settings (json) set csharpier as a default formatter for all csharp files.
  6. All will work for now.
  7. If you relaunch your editor you will see an error "it needs to be installed locally or globally" and the formatter doesn`t work.

Expected Behavior

Formatter works every window reload

Actual Behavior

Formatter does not work after relaunch.

Environment information

VSCode version: 1.84.0 C# Extension: 2.13.10 Using OmniSharp: false

Dotnet Information Host: Version: 7.0.14 Architecture: arm64 Commit: 808851b07a .NET SDKs installed: No SDKs were found. .NET runtimes installed: Microsoft.NETCore.App 7.0.14 [/Users/meat/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.14~arm64/shared/Microsoft.NETCore.App] Other architectures found: None Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download
Visual Studio Code Extensions |Extension|Author|Version|Folder Name| |---|---|---|---| |alabaster-variant-theme|NicolaiVerbaarschot|0.0.6|nicolaiverbaarschot.alabaster-variant-theme-0.0.6| |auto-close-tag|formulahendry|0.5.14|formulahendry.auto-close-tag-0.5.14| |auto-rename-tag|formulahendry|0.1.10|formulahendry.auto-rename-tag-0.1.10| |better-comments|aaron-bond|3.0.2|aaron-bond.better-comments-3.0.2| |bun-vscode|oven|0.0.12|oven.bun-vscode-0.0.12| |chatgpt-vscode|genieai|0.0.10|genieai.chatgpt-vscode-0.0.10| |csdevkit|ms-dotnettools|1.1.16|ms-dotnettools.csdevkit-1.1.16-darwin-arm64| |csharp|ms-dotnettools|2.13.10|ms-dotnettools.csharp-2.13.10-darwin-arm64| |csharpier-vscode|csharpier|1.5.1|csharpier.csharpier-vscode-1.5.1| |cute-theme|webfreak|0.0.4|webfreak.cute-theme-0.0.4| |Egoist-One|Zyst|1.18.0|zyst.egoist-one-1.18.0| |gitlens|eamodio|14.5.2|eamodio.gitlens-14.5.2| |go|golang|0.40.0|golang.go-0.40.0| |godot-files|alfish|0.0.6|alfish.godot-files-0.0.6| |godot-tools|geequlim|1.3.1|geequlim.godot-tools-1.3.1| |hide-node-modules|chrisbibby|1.1.7|chrisbibby.hide-node-modules-1.1.7| |horla-light-theme|Horla|0.0.3|horla.horla-light-theme-0.0.3| |minimal|calebdoxsey|0.1.0|calebdoxsey.minimal-0.1.0| |my-light-theme|JonaDuran|1.1.9|jonaduran.my-light-theme-1.1.9| |prettier-vscode|esbenp|10.1.0|esbenp.prettier-vscode-10.1.0| |rescript-vscode|chenglou92|1.28.0|chenglou92.rescript-vscode-1.28.0| |rescriptllighttheme|anthonypennadev|0.0.2|anthonypennadev.rescriptllighttheme-0.0.2| |shale|mullakhmetov|0.1.1|mullakhmetov.shale-0.1.1| |theme-codeschool2-minimal|bernik|0.1.0|bernik.theme-codeschool2-minimal-0.1.0| |theme-light-vs-mac|jamiewest|0.4.5|jamiewest.theme-light-vs-mac-0.4.5| |theme-solarized-minimal|jibsen|1.2.1|jibsen.theme-solarized-minimal-1.2.1| |vs-code-prettier-eslint|rvest|5.1.0|rvest.vs-code-prettier-eslint-5.1.0| |vscode-dotnet-runtime|ms-dotnettools|2.0.0|ms-dotnettools.vscode-dotnet-runtime-2.0.0| |vscode-eslint|dbaeumer|2.4.2|dbaeumer.vscode-eslint-2.4.2| |vscode-icons|vscode-icons-team|12.6.0|vscode-icons-team.vscode-icons-12.6.0| |vscode-styled-components|styled-components|1.7.8|styled-components.vscode-styled-components-1.7.8| |vscode-theme-darcula|rokoroku|1.2.3|rokoroku.vscode-theme-darcula-1.2.3| |vscode-theme-onedark|akamud|2.3.0|akamud.vscode-theme-onedark-2.3.0| |vscode-theme-onelight|akamud|2.3.0|akamud.vscode-theme-onelight-2.3.0| |vscode-wakatime|WakaTime|24.4.0|wakatime.vscode-wakatime-24.4.0| |vscodeintellicode-csharp|ms-dotnettools|0.1.26|ms-dotnettools.vscodeintellicode-csharp-0.1.26-darwin-arm64| |vstuc|visualstudiotoolsforunity|0.9.3|visualstudiotoolsforunity.vstuc-0.9.3| |vue-theme|mariorodeghiero|2.0.2|mariorodeghiero.vue-theme-2.0.2|;

Extension version: 1.5.1 VS Code version: Code 1.84.0 (d037ac076cee195194f93ce6fe2bdfe2969cc82d, 2023-11-01T11:29:51.160Z) OS version: Darwin arm64 23.1.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 Pro (10 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|22, 13, 9| |Memory (System)|16.00GB (0.14GB free)| |Process Argv|/Users/meat/gamedev/microgame-platformer -g /Users/meat/gamedev/microgame-platformer/Assets/Scripts/Core/Simulation.Event.cs:1:0 --crash-reporter-id 9df2f0b9-575e-4a71-aa8d-4e098ca7aba7| |Screen Reader|no| |VM|0%|
belav commented 11 months ago

My guess is that the extension is failing to run dotnet csharpier --version when it starts up, leading it to think CSharpier is not installed. If so, then I think #893 would resolve the issue.

The log output from the extension may validate that, This shows how to get to the logs.