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

Let hooks know which config file every property from #170

Open
thawk opened this issue May 10, 2021 · 2 comments
Open

Let hooks know which config file every property from #170

thawk opened this issue May 10, 2021 · 2 comments

Comments

@thawk
Copy link

thawk commented May 10, 2021

I want to implement c_include_path property from my hook. Since I don't know the exactly directory everybody checkouts the project, so the path in .editorconfig can only be relative paths. And since editorconfig may be nested, the relative path should be relative to the exactily .editorconfig file which defines the property.
By now, we can only get property value of c_include_path, can translates it into absolute path. So I think it's neccesary to let the hooks know which file the property is defined.

@cxw42
Copy link
Member

cxw42 commented May 12, 2021

We can report that information, but it would be a big change. Also, the paths would not take symlinks into account because of Vim limitations.

What are you using the property for? Maybe there is a different way to solve your problem. An EditorConfig plug-in hook is not always the best choice.

@cxw42 cxw42 added the need info Need more information before proceeding label May 12, 2021
@thawk
Copy link
Author

thawk commented May 13, 2021

I want to implement the c_include_path property for C/C++ files.
In a large project, there're tens of modules, and tens of paths to search header files in. I want to:

  1. Add those include paths into buffer local &path, so I can easily use gf to open header files.
  2. Other plugins can also using these paths, e.g. LSP or clang related plugins can add those paths to its compile parameters to do syntax check and more helpful jobs

Because some modules can be reused in difference project, placed into difference directory, it's better to config c_include_path in module specified .editorconfig file. So it's not enough to know the location of root .editorconfig file.
c_include_path is a language specified property, and not a standard property, I don't know whether it's suitable to put in plugin. I think we can have an API to use the property name to lookup .editorconfig file path should be enough to implement it with hook, and it doesn't break the old API. It's better if we have more common way to solve the problem, as I'm wondering maybe similar property is need for other language.

@cxw42 cxw42 added Enhancement and removed need info Need more information before proceeding labels May 13, 2021
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

2 participants