Alexis12119 / nvim-config

Generalized and Personalized
270 stars 27 forks source link

bug: conflict format between `prettier` and `typescript-tools`? #18

Closed KevinNitroG closed 4 months ago

KevinNitroG commented 4 months ago

If I comment these lines in conform.lua, it will use typescript-tools to format. Otherwise it conflicts?

Huhm is it possible to use prettier to format and disable format capability of typescript-tools 🫠?

I tried to add opts.settings.tsserver_format_options = {} in pmizio/typescript-tools.nvim but it doesn't disable typescript-tools format capability.

Thank you.

Alexis12119 commented 4 months ago

Alright, I'll push a commit to fix this.

Alexis12119 commented 4 months ago

Can you test it now? @KevinNitroG

KevinNitroG commented 4 months ago

Wait a bit I don't know why my prettier doesn't format for me :) But typescript-tools is not in the formatter list of Conform now

Alexis12119 commented 4 months ago

If I comment these lines in conform.lua, it will use typescript-tools to format. Otherwise it conflicts?

Huhm is it possible to use prettier to format and disable format capability of typescript-tools 🫠?

I tried to add opts.settings.tsserver_format_options = {} in pmizio/typescript-tools.nvim but it doesn't disable typescript-tools format capability.

Thank you.

I enabled lsp_fallback which means when the conform formatter isn't available and the LSP has a capability to format the file, conform will use LSP to format.

Alexis12119 commented 4 months ago

Wait a bit I don't know why my prettier doesn't format for me :) But typescript-tools is not in the formatter list of Conform now

That's weird. It also shouldn't be in the formatter list of conform.nvim.

Alexis12119 commented 4 months ago

I need to sleep now because it's almost midnight here.

Alexis12119 commented 4 months ago

I'll close the issue now.

KevinNitroG commented 4 months ago
Log file: C:\Users\kevinnitro\AppData\Local\nvim-data\conform.log
          additional information: trailing character

          23:54:44[ERROR] Formatter 'stylua' error: error: could not format from stdin: failed to format from stdin: error parsing: error occurred while creating ast: unexpected token `}`. (starting from line 81, character 1 and ending on line 81, character 2)
          additional information: trailing character

          15:08:41[WARN] Delayed Neovim exit by 385ms to wait for formatting to complete
          15:50:13[WARN] Delayed Neovim exit by 413ms to wait for formatting to complete
          15:51:45[WARN] Delayed Neovim exit by 402ms to wait for formatting to complete
          16:01:35[WARN] Delayed Neovim exit by 403ms to wait for formatting to complete
          21:53:41[WARN] Formatter 'prettier' was interrupted
          22:49:40[WARN] Formatter 'prettier' was interrupted

Formatters for this buffer:
prettier ready (scss, typescript, typescriptreact, yaml, markdown, html, css, vue, json, flow, graphql, javascriptreact, javascript, less) C:\Users\kevinnitro\AppData\Local\nvim-data\mason\bin\prettier.cmd

Other formatters:
clang_format ready (c, cpp) C:\Users\kevinnitro\scoop\apps\llvm\current\bin\clang-format.EXE
csharpier unavailable: Command not found
gofumpt unavailable: Command not found
ruff_fix ready (python) C:\Users\kevinnitro\AppData\Local\nvim-data\mason\bin\ruff.CMD
ruff_format ready (python) C:\Users\kevinnitro\AppData\Local\nvim-data\mason\bin\ruff.CMD
shfmt ready (sh) C:\Users\kevinnitro\AppData\Local\nvim-data\mason\bin\shfmt.CMD
stylua ready (lua) C:\Users\kevinnitro\AppData\Local\nvim-data\mason\bin\stylua.CMD

Here is my :ConformInfo now But prettier doesn't format the code 🫥 Huhm let me try to switch to Linux (:

KevinNitroG commented 4 months ago

I need to sleep now because it's almost midnight here.

Alright take a good sleep :) and the prettier doesn't format in my Linux either 😆

KevinNitroG commented 4 months ago

No no my bad It works now Just because my broken code that it can't format :))