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

Get currently loaded configuration #129

Open
egel opened this issue Nov 19, 2019 · 3 comments
Open

Get currently loaded configuration #129

egel opened this issue Nov 19, 2019 · 3 comments

Comments

@egel
Copy link

egel commented Nov 19, 2019

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

@egel egel changed the title Get current loaded configuration Get currently loaded configuration Nov 19, 2019
@cxw42
Copy link
Member

cxw42 commented Nov 20, 2019

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?

@mcepl
Copy link

mcepl commented Nov 14, 2021

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.

@cxw42
Copy link
Member

cxw42 commented Nov 19, 2021

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.

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

No branches or pull requests

3 participants