lukas-reineke / lsp-format.nvim

A wrapper around Neovims native LSP formatting.
564 stars 27 forks source link

Will format.nvim auto change filename? #16

Closed jczhang02 closed 2 years ago

jczhang02 commented 2 years ago

I am using format.nvim and latexindent to beautify my tex code, but it is strange that there are many bak file created.

Latexindent log displayed that maybe format.nvim change filename when saving code like this :

image

lukas-reineke commented 2 years ago

It does not change the file name. It creates new temporary files to do the formatting.

jczhang02 commented 2 years ago

It does not change the file name. It creates new temporary files to do the formatting. how to disable it of tex filetype or repair it?

lukas-reineke commented 2 years ago

You can't disable it. This is how the plugin works. You can try to not create backup files for them.

jczhang02 commented 2 years ago

The problem I need to solve now is how can I get the format to read the original filename in the format plugin configuration. For example, for the main.tex file, what is the best way to represent this original file name?

image

lukas-reineke commented 2 years ago

The problem I need to solve now is how can I get the format to read the original filename in the format plugin configuration.

Why do you want to do that? I think you are misunderstanding something, what are you trying to achieve?

jczhang02 commented 2 years ago

pls try latexindent for a while, i just want to format tex file by latexindent. Since format.nvim will create tmp file when formating , latexindent will format the tmp file rather than origin file. But actually, latexindent will make a backup when it is working.

lukas-reineke commented 2 years ago

The plugin works by creating a temp file, formatting that, then writing the result back into the original file. To not block editing and to not save the actual file.

You cannot pass the actual file. This is by design. If you need this, you'll have to use a different plugin

jczhang02 commented 2 years ago

i have understood what u said, thanks! The only solution is to make latexindent do not create temp file