aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2023-12-15 04:47:50 +0200
committerGitHub <noreply@github.com>2023-12-14 18:47:50 -0800
commit022cf174649a273133ca5aa868661abf8b517ef6 (patch)
tree771791cd0431857c7cde1b69708932858f977d11
parent4a87523f80e2ca56c1e33203f6ca568e45387912 (diff)
Determine indent level from more modes (#258)
Pass CSS, GraphQL, HTML, Ruby, Svelte, and YAML mode indent setting to formatters that make use of it through `apheleia-formatters-js-indent`. `prettier-markdown` and `prettier-scss` attempt to make use of this too, but `markdown-mode` and `scss-mode` don't have such a setting that I can tell. Left the uses in place for `indent-tabs-mode` support anyway. BTW the `apheleia-formatters-js-indent` name and its description does not seem quite spot on, as it was already being (partially unsuccessfully) (ab?)used by some modes for which "JavaScript like"ness is a bit of a stretch :) Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
-rw-r--r--CHANGELOG.md3
-rw-r--r--apheleia-utils.el8
2 files changed, 10 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 89ea959..59d589b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog].
* Use `perltidy` as default formatter for `cperl-mode` ([#260]).
* The `perltidy` formatter now supports Emacs indentation and line length
settings ([#261]).
+* Indent level is now determined for `graphql-mode`, `html-mode`, `ruby-mode`,
+ `ruby-ts-mode`, `svelte-mode`, and `yaml-mode` ([#258]).
### Formatters
* [`dprint`](https://dprint.dev) for various (depending on
@@ -31,6 +33,7 @@ The format is based on [Keep a Changelog].
[#209]: https://github.com/radian-software/apheleia/pull/209
[#229]: https://github.com/radian-software/apheleia/pull/229
[#257]: https://github.com/radian-software/apheleia/pull/257
+[#258]: https://github.com/radian-software/apheleia/pull/258
[#260]: https://github.com/radian-software/apheleia/pull/260
[#261]: https://github.com/radian-software/apheleia/pull/261
[#263]: https://github.com/radian-software/apheleia/pull/263
diff --git a/apheleia-utils.el b/apheleia-utils.el
index 07a358b..7e3820f 100644
--- a/apheleia-utils.el
+++ b/apheleia-utils.el
@@ -38,6 +38,8 @@ always returns nil to defer to the formatter."
(cperl-mode 'cperl-indent-level)
(css-mode 'css-indent-offset)
(css-ts-mode 'css-indent-offset)
+ (graphql-mode 'graphql-indent-level)
+ (html-mode 'sgml-basic-offset)
(js-jsx-mode 'js-indent-level)
(js-ts-mode 'js-indent-level)
(js-mode 'js-indent-level)
@@ -50,11 +52,15 @@ always returns nil to defer to the formatter."
(robot-mode 'robot-mode-basic-offset)
(perl-mode 'perl-indent-level)
(python-mode 'python-indent-offset)
+ (ruby-mode 'ruby-indent-level)
+ (ruby-ts-mode 'ruby-indent-level)
(scss-mode 'css-indent-offset)
+ (svelte-mode 'svelte-basic-offset)
(web-mode 'web-mode-indent-style)
(tsx-ts-mode 'typescript-ts-mode-indent-offset)
(typescript-mode 'typescript-indent-level)
- (typescript-ts-mode 'typescript-ts-mode-indent-offset))))
+ (typescript-ts-mode 'typescript-ts-mode-indent-offset)
+ (yaml-mode 'yaml-indent-offset))))
(when-let ((indent (and indent-var
(boundp indent-var)