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

EditorConfig Support #96

Open
skylerto opened this issue Dec 23, 2016 · 8 comments
Open

EditorConfig Support #96

skylerto opened this issue Dec 23, 2016 · 8 comments

Comments

@skylerto
Copy link

Specifically for the code formatting, integration with editorconfig-emacs would be amazing.

@bklaase
Copy link

bklaase commented Aug 29, 2017

I would greatly appreciate this as well!

@Eeemil
Copy link

Eeemil commented Feb 8, 2019

@ananthakumaran what would be needed for implementing this?

@ananthakumaran
Copy link
Owner

For each buffer tide will make a configure rpc request to tsserver. This contains formatOptions, which will be used by tsserver for other rpc requests like format etc. Tide already supports tsfmt.json file. https://github.com/ananthakumaran/tide/blob/master/tide.el#L712. Adding editor config support would be similar, the file needs to be parsed and each option needs to be mapped to the corresponding options in the protocol.

@Eeemil
Copy link

Eeemil commented Feb 11, 2019

I might try to implement support for this the coming weeks, but I'm not very experienced in elisp or typescript.

Would it be sane to require https://github.com/editorconfig/editorconfig-emacs as a prerequisite? So that tide won't have to deal with parsing and finding the editorconfig file

@ananthakumaran
Copy link
Owner

Yes, using a standard implementation is better.

@josteink
Copy link
Collaborator

PRs welcome.

Repository owner deleted a comment from atomdmac Feb 28, 2020
@winny-
Copy link

winny- commented Jul 20, 2022

I think we're 99% of the way there. tide respects typescript-indent-level. Editorconfig will set this accordingly. I think what's happening is tide is usually set up before editorconfig hooks are ran. This means editorconfig does change the typescript settings, but tide is unaware they have been changed out from under itself. Here's a quick and dirty workaround that appears to do the trick -- ensures tide's server knows about the latest changes applied by editorconfig:

(add-hook 'editorconfig-after-apply-functions (defun winny/fix-tide-indentation (props)
                                                (when (and (boundp 'tide-mode) tide-mode)
                                                  (tide-command:configure))))

winny- added a commit to winny-/emacs.d that referenced this issue Jul 20, 2022
@winny-
Copy link

winny- commented Jul 20, 2022

This bug also manifests if user manually sets typescript-indent-level. I think it's the same surprising behavior because in both cases this var is being overridden in a way tide is unaware of. But this is normal and expected emacs behavior - it's probably not a safe bet to assume a var never changes over the lifecycle of a buffer.

Maybe tide could monitor this var (and reconfigure itself) so it behaves in a unsurprising way in all cases?

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

6 participants