vscode-lua-format icon indicating copy to clipboard operation
vscode-lua-format copied to clipboard

Format doesn't find .lua-format files unless config setting points to one

Open Nexela opened this issue 4 years ago • 4 comments

The program will attempt to automatically use the current directory's .lua-format file if no config file is passed in the command line. If none is found, it will try to locate a .lua-format file in a parent directory recursively.

Using the format extension this does not seem to be the case. I believe the fault lies in either not passing the file path or cwd in spawn options

Correctly passing the cwd should allow it to pick the correct .lua-format file without having to add the setting.

Nexela avatar Oct 11 '20 20:10 Nexela

I have same question, any solution?

fafaraway avatar Oct 28 '20 14:10 fafaraway

I ran into this issue as well, and submitted a PR that should fix it: https://github.com/Koihik/vscode-lua-format/pull/31

aMoniker avatar Nov 01 '20 04:11 aMoniker

Unfortunately, it only works if .lua-format is in the same directory as lua files. It doesn't work when .lua-format is put in the root of a project, and lua files are spitted into multiple directories.

Maybe it is because that bin\...\lua-format is just too old.

kghost avatar Dec 31 '20 08:12 kghost

For me it looks like there was a problem with the config file I supplied. I took it from the README file in github: https://github.com/Koihik/LuaFormatter

But if I use the binary which was installed with the vscode extension and run it using: lua-formater.exe --dump--config, there was a small different between the two:

column_table_limit: column_limit (the one in doc) column_table_limit: 80 (the one I dumped)

basically replacing that column_limit with your favorite number made it work for me.

Cheers.

ayoubfaouzi avatar Oct 25 '21 08:10 ayoubfaouzi