editorconfig-vim icon indicating copy to clipboard operation
editorconfig-vim copied to clipboard

Get currently loaded configuration

Open egel opened this issue 4 years ago • 3 comments

How could I display the path to currently used/loaded .editorconfig file?

egel avatar Nov 19 '19 09:11 egel

Unfortunately, there is not a way at present. Also, the settings may come from multiple files, in each directory up to the project root. Could you tell us more about your use case?

cxw42 avatar Nov 20 '19 22:11 cxw42

It is very simple: debugging. I am the author of https://gitlab.com/mcepl/editorconfig-vim-spell and it stopped to work recently. I am really not sure, what’s going on (testing with neovim and switched to the neovim-compatible configuration), but I don’t know how to debug it properly. Ability to dump content of config parameter of the plugin would be excessively helpful. In the current state the plugin messages nothing.

mcepl avatar Nov 14 '21 21:11 mcepl

For debugging, I can tell you what I did while working on the Vim core.

1. Check whether it's the plugin or the core

  1. :let g:EditorConfig_verbose=1
  2. Open the file of interest
  3. See if the settings are what you expect.

Example:

:let g:EditorConfig_verbose=1
:e foo.txt
Applying EditorConfig vim_core on file "/home/cxw/foo.txt"
Options: {'tab_width': '5', 'indent_size': '5'}
  • If the settings are what you expect but the behaviour doesn't match the settings, the problem is in the plugin.
  • If the settings are not what you expect, the problem is in the core or the .editorconfig files.

2. Debugging the core --- where to start

  1. let g:editorconfig_core_vimscript_debug = 1
  2. Open a file and see what you get! Say :messages to see the output if it goes by too quickly.

3. Digging a bit deeper

  1. Edit editorconfig-vim/autoload/editorconfig_core/handler.vim
  2. Go to function! editorconfig_core#handler#get_configurations(job).
  3. Scroll down to for l:conf_fn in l:conf_files
  4. Uncomment the echom lines
  5. Open a file and look at the messages

Other than that, it's just regular Vimscript debugging. I used :debug quite a lot. I also remember it was a real pain to debug the core on Windows on Appveyor.

cxw42 avatar Nov 19 '21 02:11 cxw42