editorconfig icon indicating copy to clipboard operation
editorconfig copied to clipboard

Language server for editing `.editorconfig` file?

Open jcs090218 opened this issue 2 years ago • 11 comments

It's great if we have a language server for .editorconfig file. 🤔

Similar projects:

  • https://github.com/madskristensen/EditorConfigLanguage
  • https://github.com/Lilja/ecls

jcs090218 avatar Aug 29 '23 02:08 jcs090218

Are you talking about some kind of web-editor to create and edit the .editorconfig files ?

I think it would be great to have this. Mostly I would hope to have a feature that you can provide an example directory structure and you see which .edidorconfig ruls match to the certain files.

e.g. you hover a file and see

  1. The editorconfigs and lines of all rules that effect this file
  2. see in result what rulesset is used on this file

Currently I often struggle with situation where an rule SHOULD be applid to any file, but for some reason it does not take effect, anything is incorrect with your patterns and file masks

Radon8472 avatar Mar 30 '24 10:03 Radon8472

I mean the Language Server Protocol, so we edit the file on any editors that support LSP, e.g., Emacs, Vim, VSCode, Sublime, etc.

jcs090218 avatar Mar 30 '24 21:03 jcs090218

While there is no language server for editorconfig, in Vim and Neovim (with treesitter disabled), you can press Ctrl-x Ctrl-o to get completion for properties

brianhuster avatar May 20 '25 10:05 brianhuster

This doesn't seem hard to implement. The question is in what language it should be written

SunsetTechuila avatar Jun 09 '25 08:06 SunsetTechuila

I've written two language servers in C# and Emacs Lisp in the past.

  • https://github.com/shader-ls/shader-language-server (in C# for ShaderLab)
  • https://github.com/elisp-lsp/ellsp (in Emacs Lisp for Emacs Lisp)

Other popular options are TypeScript (Node), C (the core), or Rust, etc. 🤔

jcs090218 avatar Jun 09 '25 10:06 jcs090218

The question is in what language it should be written

I would vote for a compiled language that can be cross-compiled, like Go, Rust. Or even Zig if you are ok with chasing its development :))

brianhuster avatar Jun 09 '25 11:06 brianhuster

compiled language that can be cross-compiled

that's something I agree with.

@xuhdev @cxw42 could you share your thoughts? The VSCode plugin already provides autocompletion, and perhaps some others do too, but it would be nice to have one LSP that every plugin could use. This is also quite low-hanging fruit.

SunsetTechuila avatar Jun 09 '25 12:06 SunsetTechuila

@SunsetTechuila Absolutely! Having one LSP server is better than lingering on considering which language to use :)

xuhdev avatar Jun 11 '25 09:06 xuhdev

No strong preferences.

Looking at the top post, I see the two given are C# and TS, respectively. The C# one appears to be more active, but also fairly tightly bound to VSCode.

I think Python or TS are worth considering. From some quick searching, I see:

  • Python: a framework at https://github.com/openlawlibrary/pygls
  • TS: an example at https://github.com/semanticart/minimum-viable-vscode-language-server-extension

Maybe ask @Lilja whether we could adopt the existing TS https://github.com/Lilja/ecls ?

(That said, if somebody on this issue wants to write a new language server right now, I won't stop you 😁 )

cxw42 avatar Sep 01 '25 00:09 cxw42

Hey all, thanks for tagging me. I'm the author of "ecls" which I wrote a couple of years ago as a project to learn about the Language Server Protocol.

Feel absolutely free to fork or copy code from that repository. I don't remember how well the code quality is, your mileage may vary.

My learnings from writing a LS:

  • The library that microsoft has written, vscode-languageserver was quite nice to use from a developer experience point of view. As you don't need to write your typings. I think most LS written in typescripts use this framework.
  • I wrote a bunch of features, like validating the yaml, providing some intellisense/suggestions, a basic hover. But after a while I sort of gave up as I didn't really see the usefulness in it. I tried to upstream my LS implementation to the neovim lsp-config repositry and got yelled at by the maintainers. So I didn't feel like continuing working on it 😅
  • My implementation only uses the editorconfig you have opened. But I suppose that you also want to supported nested ones, which in theory could be several. There is likely complexity in trying to perform validation on nested structure.

Lilja avatar Sep 08 '25 05:09 Lilja

Thanks for the response and for the extra context @Lilja !

cxw42 avatar Sep 27 '25 00:09 cxw42