belav / csharpier

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

Improve docs on how to enable vscode extension #1280

Open JSBmanD opened 5 months ago

JSBmanD commented 5 months ago

Environments

Log Output No

Steps to reproduce

  1. Install extension
  2. Set csharpier as default formatter image
  3. Press hotkey to format document

Expected behavior File formatted

Actual behavior No logs, no format

dotnet csharpier . works when I call it in folder with files

belav commented 5 months ago

By no logs, do you mean that the output window for CSharpier is empty? Even without turning on debug logging it should contain ["INFO" - 8:54:38 AM] Initializing csharpier-vscode when it start up, which is when you first open a c# file I believe.

JSBmanD commented 5 months ago

@belav i made it work by adding this to settings.json in project. But without it - it won't format my project for some reason. Can you add this to docs please? I needed to search in issues to find this solution

    "csharpier.enableDebugLogs": true,
    "[csharp]": {
        "editor.defaultFormatter": "csharpier.csharpier-vscode",
        "editor.formatOnSave": true,
    }
belav commented 5 months ago

My instance of vscode has an empty settings file, and I can right click, format with csharpier, and it works. It also initializes csharpier as expected. The doc already mentions setting it as the default formatter and neither debug logs or formatOnSave are required. I'm guessing there was something else going on with your IDE.

JSBmanD commented 5 months ago

@belav maybe you need any logs or configs to see the problem? I can provide anything