Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work in Rider #58

Open
provegard opened this issue Aug 28, 2023 · 1 comment
Open

Does not work in Rider #58

provegard opened this issue Aug 28, 2023 · 1 comment

Comments

@provegard
Copy link

I haven't managed to get the dprint plugin to work in Rider. It works in IDEA without any problems.

In Rider, unlike in IDEA, I have to specify the dprint executable manually. That's fine.

When I change a file by introducing some unwanted whitespace changes and then save, I get:

2023 08 28 08:01:51:  Initialising editor service
2023 08 28 08:01:52:  Received editor info: {"schemaVersion":5,"cliVersion":"0.40.2","configSchemaUrl":"https://dprint.dev/schemas/v0.json","plugins":[]}

2023 08 28 08:01:52:  Received schema version 5
2023 08 28 08:01:52:  Initializing EditorServiceV5
2023 08 28 08:01:52:  Clearing message 16
2023 08 28 08:01:52:  Clearing message 17
2023 08 28 08:01:52:  Clearing message 14
2023 08 28 08:01:52:  Starting editor service with executable C:\kod\Customer\Product\node_modules\dprint\dprint.exe, config C:\kod\Customer\Product\dprint.json and working directory C:\kod\Customer\Product.
2023 08 28 08:01:52:  Priming can format cache for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:52:  Checking if C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs can be formatted.
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugin-cache-manifest.json
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating directory: C:\Users\perro\AppData\Local\dprint\cache\locks
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\kod\Customer\Product\dprint.json
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-typescript\0.86.2-4.0.0-x86_64
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-json\0.17.4-4.0.0-x86_64
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-vue\0.5.0-4.0.0-x86_64
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Checking path exists: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-roslyn\0.16.0\x86_64\dprint-plugin-roslyn.exe
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating instance of dprint-plugin-typescript
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating instance of dprint-plugin-vue
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating instance of dprint-plugin-roslyn
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Created instance of dprint-plugin-json in 6ms
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Created instance of dprint-plugin-typescript in 8ms
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Created instance of dprint-plugin-roslyn in 76ms
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Checking can format: C:\kod\Customer\Product\src\Suite\Model.Product\Model\Item\Item.Nullable.cs
2023 08 28 08:01:52:  C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs can be formatted
2023 08 28 08:01:58:  Running save action on C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs.
2023 08 28 08:01:58:  Running save action on C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs.
2023 08 28 08:01:58:  Creating formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Created formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs with id 19
2023 08 28 08:01:58:  Dprint daemon 49540: [VERBOSE] Host formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs - File length: 1582 - Plugins: [dprint-plugin-roslyn] - Range: None
2023 08 28 08:01:58:  Creating formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Created formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs with id 20
2023 08 28 08:01:58:  Dprint daemon 49540: [VERBOSE] Host formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs - File length: 1582 - Plugins: [dprint-plugin-roslyn] - Range: None
2023 08 28 08:01:58:  Successfully formatted C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs

Note how it says "Successfully formatted C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs". However, the file does not change at all.

If I run npx dprint fmt src/Suite/Model.Product/Model/Item/Item.Nullable.cs, the file gets formatted.

This is my dprint config:

{
  "lineWidth": 120,
  "indentWidth": 4,
  "useTabs": false,
  "newLineKind": "auto",
  "typescript": {
    "semiColons": "asi",
    "quoteProps": "consistent",
    "parameters.trailingCommas": "never",
    "arguments.trailingCommas": "never",
    "exportDeclaration.trailingCommas": "never",
    "typeLiteral.separatorKind.singleLine": "comma"
  },
  "json": {
    "lineWidth": 80
  },
  "vue": {
  },
  "roslyn": {
    "csharp.spaceAfterCast": true,
    "csharp.wrappingKeepStatementsOnSingleLine": false
  },
  "includes": [
    ...other paths...,
    "**/src/Suite/Model.Product/**/*.cs"
  ],
  "excludes": [
    ...other paths...,
    "**/obj/**",
    "**/bin/**"
  ],
  "plugins": [
    "https://plugins.dprint.dev/typescript-0.86.2.wasm",
    "https://plugins.dprint.dev/json-0.17.4.wasm",
    "https://plugins.dprint.dev/malobre/vue-v0.5.0.wasm",
    "https://plugins.dprint.dev/roslyn-0.16.0.json@a508b0823fa356a33b43fc071e1cebe4a9c9ded12ca2f84c46ba67e2a3f13487"
  ]
}

I'm using Rider 2023.1.1, Build #RD-231.8770.54.

@ryan-rushton
Copy link
Collaborator

Weird, it might be an Rider issue rather than an issue with this plugin. OOI have you tried any other formatter and had success?

The reason I ask is that log line should only be appearing if

  1. Content has changed
  2. The file content was passed to dprint, which reformatted it and passed new content back
  3. The virtual file was successfully updated and saved without error.

If it is getting there and you aren't seeing the update in the UI it feels like that file save wasn't actually successful.

I don't have a copy of Rider but I might ask Jetbrains if I can get one to debug this. Also, contributions welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants