[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/clojure-ts-mode 64d8fde253 04/14: Semantic indentation doc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/clojure-ts-mode 64d8fde253 04/14: Semantic indentation docs |
Date: |
Fri, 8 Sep 2023 18:59:17 -0400 (EDT) |
branch: elpa/clojure-ts-mode
commit 64d8fde253fd08cb510bd74557983bc1fd423ce3
Author: dannyfreeman <danny@dfreeman.email>
Commit: Danny Freeman <danny@dfreeman.email>
Semantic indentation docs
This style tries to emualte cljfmt's default settings. There are
different styles of semantic formatting so this will be one option,
maybe more in the future.
---
clojure-ts-mode.el | 16 ++++++++++------
test/indentation.clj | 19 +++++++++++++++++--
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el
index 4b47f45af6..817e4721bb 100644
--- a/clojure-ts-mode.el
+++ b/clojure-ts-mode.el
@@ -499,11 +499,14 @@ By default `treesit-defun-name-function' is used to
extract definition names.
See `clojure-ts--standard-definition-node-name' for the implementation used.")
(defcustom clojure-ts-indent-style 'semantic
- "Automatic indentation style to use when mode clojure-ts-mode is run
+ "Automatic indentation style to use when mode `clojure-ts-mode' is run.
The possible values for this variable are
- `semantic' - Tries to follow the same rules as the clojure style guide.
- See: https://guide.clojure.style/
+ `semantic' - Semantic indentation.
+ Tries to follow the same rules as cljfmt with default settings.
+ See:
+ - https://github.com/weavejester/cljfmt
+ - https://guide.clojure.style/
`fixed' - A simpler set of indentation rules that can be summarized as
1. Multi-line lists that start with a symbol are always indented with
two spaces.
@@ -512,8 +515,8 @@ The possible values for this variable are
See: https://tonsky.me/blog/clojurefmt/"
:safe #'symbolp
:type
- '(choice (const :tag "Semantic indent rules, matching clojure style guide."
semantic)
- (const :tag "Simple fixed indent rules." fixed))
+ '(choice (const :tag "Semantic indentation rules." semantic)
+ (const :tag "Simple fixed indentation rules." fixed))
:package-version '(clojure-ts-mode . "0.2.0"))
(defvar clojure-ts--fixed-indent-rules
@@ -655,7 +658,8 @@ See `treesit-simple-indent-rules'."
((eq clojure-ts-indent-style 'fixed) clojure-ts--fixed-indent-rules)
(t (error
(format
- "Invalid value for clojure-ts-indent-style. Valid values are 'semantic
or 'fixed. Found %S"
+ "Invalid value for clojure-ts-indent-style. Expected one of '%S, but
found '%S instead."
+ '(semantic fixed)
clojure-ts-indent-style)))))
(defvar clojure-ts-mode-map
diff --git a/test/indentation.clj b/test/indentation.clj
index 24399f6d96..4a1b7e5d37 100644
--- a/test/indentation.clj
+++ b/test/indentation.clj
@@ -1,10 +1,25 @@
+(ns indentation
+ (:require
+ [clojure.string :as str])
+ (:import
+ (java.util Date
+ UUID)))
+
; https://tonsky.me/blog/clojurefmt/#ok-what-do-we-do-then
(when something
body)
+(defmethod dispatch :on-me
+ [x]
+ (bar x))
+
(defn f [x]
body)
+(defn f
+ ([x] (f x nil))
+ ([x y] ))
+
(defn f
[x]
body)
@@ -34,12 +49,12 @@
; second cond is not aligned
(or (condition-a)
- (condition-b))
+ (condition-b))
; or/and are the only forms where this looks not ideal
; other forms don’t win/lose much because of this change
(filter even?
- (range 1 10))
+ (range 1 10))
; my way is actually better if fn name is looooooooooong
(clojure.core/filter even?
- [nongnu] elpa/clojure-ts-mode updated (2225190ee5 -> 881756c8f5), ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode ae2e248601 01/14: First pass at semantic indentation, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode ca3914aa7a 02/14: Name inline indent helper functions instead of using lambdas, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode ff5d7e13dc 05/14: Semantic indentation of method implementations, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode b6f6d37959 10/14: Update changelog to include information about semantic indentation, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode a8a321500e 13/14: More documentation updates, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode 85871fdbc8 03/14: Match threading alignment of cljfmt, clojure-mode, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode 64d8fde253 04/14: Semantic indentation docs,
ELPA Syncer <=
- [nongnu] elpa/clojure-ts-mode a87821629f 07/14: Fix docstring font-locking, try to clarify various regex names, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode 0c4bd2bfce 06/14: Indent example file, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode d4e0f1ae44 09/14: Move thing-settings out of the middle of indent-related functions, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode 177ac05434 08/14: Indent within docstrings - not working 100%, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode 1675f12e26 12/14: Unused argument causing linter to fail, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode 881756c8f5 14/14: Remove unused function, ELPA Syncer, 2023/09/08
- [nongnu] elpa/clojure-ts-mode 211dc1452b 11/14: Update README docs to include new configuration options, ELPA Syncer, 2023/09/08