editorconfig / editorconfig-vim

EditorConfig plugin for Vim
http://editorconfig.org
Other
3.14k stars 138 forks source link

Fix file pattern to work like .gitignore files #2

Closed treyhunner closed 13 years ago

treyhunner commented 13 years ago

The following 3 bullet points from the .gitignore manpage should apply to editorconfig file matching as well.

The vim globpath command should be used instead of glob because it works similarly to fnmatch.

xuhdev commented 13 years ago

Instead of writing file parsing code for each editor as a plugin, I think, it is better to write a separate program for file parsing. Editor plugins would try to call this program to get the file parsed and the plugin is informed of what should be done. This would make us write less code on file parsing, and we would have much more choices for regular expression and other file parsing elements. What do you think?

treyhunner commented 13 years ago

It would be nice to making everything as native to the plugin environment as possible, but I like your idea for the sake of code reuse. If we do choose this route then we should probably make this parser as portable as possible. We could always package the plugins with a binary version of the parser though.

Issue #2 on the main editorconfig project also relates to file parsing.

xuhdev commented 13 years ago

I think, to write this program in a common language, such as C, C++, Java, or something else, is appropriate. After this external program parses the .editorconfig file, it send the parsing result to the editor plugin in a pipe (or something similar). So, I think it's time for us to choose the language of the external program and the structure of the parser. Do you think so?

treyhunner commented 13 years ago

I'd choose C due to the low overhead of a compiled binary file, but I'm not sure whether we'd end up with library inconsistencies between Windows/Linux/Mac (for example regex.h).

As for the structure of the parser, I may hack something together in pseudo-code or Python as an example of how I expect the parser to work and then re-implement in the language of choice from there.

Do you think we should develop the parser in the main editorconfig project (since the code will presumably be shared by all plugins)?

xuhdev commented 13 years ago

For regex, You may consider pcre

The parser, I think, a simple format of ini or xml is enough for early development. Then lua could be considered as a complex format. We could embed lua interpreter into our parser. Lua interpreter is very small and suitable for our case, since we do not need as much features as python interpreter has.

I agree, we should develop the parser In the main editorconfig project.

treyhunner commented 13 years ago

We may not need anything beyond an INI parser (this one maybe) and fnmatch (Darwin version looks simple enough).

What's the benefit of using lua?

treyhunner commented 13 years ago

@xuhdev, let's move the discussion to issue #3 on editorconfig project.