Replies: 2 comments 3 replies
-
There is no real harmony between Elisp The best you can hope for is baking an |
Beta Was this translation helpful? Give feedback.
-
It still may be useful to expose those variables to bridge the gap a little. Even if it isn't perfect, a separate plist (listing major-modes and formatting parameters) could be made to keep things sanitary if it ever gets changed in the future. For now, I've written a small advice hack for init.el for myself and anyone else interested:
You can add more major modes by adding another clause to the |
Beta Was this translation helpful? Give feedback.
-
If you have a major-mode which sets its own formatting parameters (i.e. uses its own version of
tab-width
), then there is no way to communicate that to eglot so that requests to format the file, etc. use the proper formatting parameters.Reproduction Recipe
languageserver
package are installed along with the latest version of ess.M-x ess-set-style
orC-c C-e s
to set the style to something with aness-indent-offset
of something other thantab-width
(by default, this is 'RRR', with a 4-wide indent and call-aligned function arguments--very different fromtab-width
's default 8).indent-region
orindent-paragraph
*.M-x eglot-format-buffer
and watch it change all of the indentation again*.*There is a bug in
languageserver
right now in which the indentation linter is hardcoded to a 2-space indent, so it may be marked as incorrect indentation, even after the same language server (which the linter is a part of) just formatted it. But that is alangageserver
problem.Solution Pointers
Looking over the source, it looks like maybe changing these lines to refer to new package options which could be specified per-major-mode (e.g. in
eglot-server-programs
) would allow for users to specify which variables are the correct formatting parameters for each major mode. But, since I do not understand the codebase well, I am hesitant to write the patch myself for now.Beta Was this translation helpful? Give feedback.
All reactions