Open Rezakarimi66 opened 4 years ago
press ALT+SHIFT+F
I know how to format my file and its shortcut. The problem is that it is not working and nothing happens!
@Rezakarimi66
Is vscode-lua-foramt
your default formatter of lua files in VSCode?
Did you see any errors?
Your os platform is?
VSCode: Version: 1.52.0 (system setup) Commit: 940b5f4bb5fa47866a54529ed759d95d09ee80be Date: 2020-12-10T22:45:11.850Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 10.0.19042
Lua: Lua 5.3.6 Copyright (C) 1994-2020 Lua.org, PUC-Rio
I have the same issue. Windows 10 WSL2 - Ubuntu 18.04. Format Document, no errors, no change in document when there are definite problems like incorrect indentation. VSCode was restarted after extension installation. There is no style file, so the extension should use defaults.
I have discovered that this plugin works under regular Win10, but if a remote connection is used to a WSL Ubuntu subsystem, it does not. vscode-lua does format with the remote connection, but vscode-lua-formatter does not. Maybe you can see how that plugin handles a remote connection.
Maybe this needs to be a separate issue instead of a comment here.
Had the same question. Documentation in the README for this would be helpful. I added:
"[lua]": {
"editor.defaultFormatter": "Koihik.vscode-lua-format"
},
and then use the standard vscode formatter settings to get it to work (e.g. enable format on save or run the formatting manually, up to you).
Also, an example of how to use a style config file would be good. I've added a lua-formatter.yml
file (not sure if that's the correct file type) with some changed options and it doesn't take effect when I put it in the top level of my project with the config path option set to lua-formatter.yml
I see this error in the Log (Extension Host)
terminal:
[2022-09-17 09:42:48.060] [exthost] [error] [Koihik.vscode-lua-format] provider FAILED
[2022-09-17 09:42:48.060] [exthost] [error] undefined
So it seems to work now when I add only a few style options:
indent_width: 2
I also renamed yml
to yaml
(not sure if that matters). When I paste in all the defaults it fails (see all the options below). I don't know which one/s are causing the issue but I'll comment if I ever find out why. The error message I posted above certainly needs improving though as it's not helpful at all.
column_limit: 80
indent_width: 4
use_tab: false
tab_width: 4
continuation_indent_width: 4
spaces_before_call: 1
keep_simple_control_block_one_line: true
keep_simple_function_one_line: true
align_args: true
break_after_functioncall_lp: false
break_before_functioncall_rp: false
spaces_inside_functioncall_parens: false
spaces_inside_functiondef_parens: false
align_parameter: true
chop_down_parameter: false
break_after_functiondef_lp: false
break_before_functiondef_rp: false
align_table_field: true
break_after_table_lb: true
break_before_table_rb: true
chop_down_table: false
chop_down_kv_table: true
table_sep: ","
column_table_limit: 0
extra_sep_at_table_end: false
spaces_inside_table_braces: false
break_after_operator: true
double_quote_to_single_quote: false
single_quote_to_double_quote: false
spaces_around_equals_in_field: true
line_breaks_after_function_body: 1
line_separator: input
Hi, could you explain how your extension works? For me after clicking "format document" nothing happens!
VSCode Version 1.45.0 Lua version 5.3