lite-plugins icon indicating copy to clipboard operation
lite-plugins copied to clipboard

[Plugin Request] .editorconfig support

Open Tmpod opened this issue 4 years ago • 6 comments

Porting the issue from rxi/lite#142

.editorconfig is a nice "standardised" way of specifying some configurations across all editors that support it. This is a neat tool to use in big projects with lots of contributorsa and it would be cool to have in lite too, if not on the core, at least as a plugin.

You can read more about .editorconfig at https://editorconfig.org

I do not know Lua nor this project so at the moment I'm not able to write such plugin. I'd be really thankful if someone with more experience would do it, but if that doens't happen I'll eventually write it :)

Tmpod avatar Jun 09 '20 12:06 Tmpod

Maybe the editorconfig plugin for Micro could be of help ? Micro also uses Lua for the plugin system. (The editor itself is written in Go)

https://github.com/10sr/editorconfig-micro

MarcusE1W avatar Dec 13 '20 22:12 MarcusE1W

I'm currently working on an editorconfig support plugin for lite. There is a bit of hackery involved with supporting config options like indent_size, tab_type, etc. per document, and I thought about splitting that into a plugin of its own, but I'm not sure what the guidelines on "library plugins" are (whether they should exist, or should each plugin include all of its functionality in a single file).

Since editorconfig doesn't support adding vertical rulers/setting maximum column numbers yet, I wanted to add an extra non-standard setting to support that:

[*.rs]
lite_line_limit = 120

As far as I gathered from reading editorconfig#89, one commenter pointed out that the Atom plugin uses a more generic name max_line_length, so I'm not sure what to pick yet.

liquidev avatar Feb 13 '21 23:02 liquidev

Well since this plugin will be made for lite itself, I do not think it is necessary to use in the variable names.

benstigsen avatar Feb 13 '21 23:02 benstigsen

I totally forgot about this... I could try to write this now, or contribute to someone else's work.

It does indeed seem to require some work for per-file configs, but it shouldn't be too hard. Any repository I can contribute to?

Tmpod avatar Feb 14 '21 00:02 Tmpod

@Tmpod not yet, I want to get the plugin working first and then I'll send a PR to this repo.

liquidev avatar Feb 14 '21 11:02 liquidev

You can find a preview version of the plugin in this gist. Let me know if you run into any crashes, and what things I could improve. One notable thing is that right now .editorconfig is not hot-reloaded once you modify it, so you'll have to close and reopen the document (or just restart the editor) for any changes to be applied.

liquidev avatar Feb 17 '21 14:02 liquidev