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

Add :CodefmtInfo command to report diagnostics to help users check config / diagnose problems #234

Open
dbarnett opened this issue Jan 5, 2024 · 2 comments

Comments

@dbarnett
Copy link
Contributor

dbarnett commented Jan 5, 2024

We should have a command called something like :CodefmtInfo that can dump a report on how it's configured wrt the current context and maybe the last known invocation.

For example:

:CodefmtInfo
Current buffer: foo.py
Autoformat [enabled|disabled] [using formatter yapf]
Selected formatter: [yapf]
All available formatters: yapf, black, isort, autopep8

Last invocation at [TIMESTAMP]:
Executed command: yapf -blah ...
Exit code: [0|...]
[Stderr: ...]
@dbarnett
Copy link
Contributor Author

dbarnett commented Jan 8, 2024

As a workaround in the meantime, here's a dump of some commands to manually look up some of this info:

  • :let b:codefmt_<TAB> to check for any buffer-local settings
  • Autoformat (if any): check :autocmd codefmt
  • Selected formatter (if any): :let b:codefmt_formatter
  • Available formatters: :echo codefmt#GetSupportedFormatters(0, 0, 0)
  • Shell invocations: start vim with -V9vim.log before running formatter, then after triggering the formatter search vim.log for "Executing command".

Note: Signature of codefmt#GetSupportedFormatters is weird and will probably change eventually, try :echo codefmt#GetSupportedFormatters() or variations on that if you get "Too many arguments".

@dbarnett
Copy link
Contributor Author

dbarnett commented Jan 8, 2024

Also for general troubleshooting, check :messages for any errors you might've missed, especially things like Not an editor command that might've tripped up autocmds etc.

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

No branches or pull requests

1 participant