@@ -343,14 +343,14 @@ if a third argument (the value) is provided.
343
343
344
344
(defvar clojure-ts--treesit-range-settings
345
345
(treesit-range-rules
346
- :embed 'markdown_inline
346
+ :embed 'markdown-inline
347
347
:host 'clojure
348
348
(clojure-ts--docstring-query '@capture )))
349
349
350
350
(defun clojure-ts--font-lock-settings (markdown-available )
351
351
" Return font lock settings suitable for use in `treesit-font-lock-settings' .
352
352
When MARKDOWN-AVAILABLE is non-nil, includes rules for highlighting docstrings
353
- with the markdown_inline grammar."
353
+ with the markdown-inline grammar."
354
354
(append
355
355
(treesit-font-lock-rules
356
356
:feature 'string
@@ -512,11 +512,9 @@ with the markdown_inline grammar."
512
512
(when markdown-available
513
513
(treesit-font-lock-rules
514
514
:feature 'doc
515
- :language 'markdown_inline
515
+ :language 'markdown-inline
516
516
:override t
517
- `((inline
518
- (code_span (code_span_delimiter) :* @font-lock-delimiter-face)
519
- @font-lock-constant-face))))
517
+ `((code_span) @font-lock-constant-face)))
520
518
521
519
(treesit-font-lock-rules
522
520
:feature 'quote
@@ -985,7 +983,7 @@ and (:defn) is converted to (:inner 1)."
985
983
(t nil ))))
986
984
987
985
(defun clojure-ts--dynamic-indent-for-symbol (sym &optional ns )
988
- " Returns the dynamic indentation specification for SYM, if found.
986
+ " Return the dynamic indentation specification for SYM, if found.
989
987
990
988
If the function `clojure-ts-get-indent-function' is defined, call it and
991
989
produce a valid indentation specification from its return value.
@@ -1019,7 +1017,7 @@ If NS is defined, then the fully qualified symbol is passed to
1019
1017
(equal (car spec1) :block )))))))))
1020
1018
1021
1019
(defun clojure-ts--find-semantic-rule (node parent current-depth )
1022
- " Returns a suitable indentation rule for NODE, considering the CURRENT-DEPTH.
1020
+ " Return a suitable indentation rule for NODE, considering the CURRENT-DEPTH.
1023
1021
1024
1022
Attempts to find an indentation rule by examining the symbol name of the
1025
1023
PARENT's first child. If a rule is not found, it navigates up the
@@ -1167,7 +1165,7 @@ hints."
1167
1165
(treesit-node-start parent))))
1168
1166
1169
1167
(defun clojure-ts--match-collection-item-with-metadata (node-type )
1170
- " Returns a matcher for a collection item with metadata by NODE-TYPE.
1168
+ " Return a matcher for a collection item with metadata by NODE-TYPE.
1171
1169
1172
1170
The returned matcher accepts NODE, PARENT and BOL and returns true only
1173
1171
if NODE has metadata and its parent has type NODE-TYPE."
@@ -1296,9 +1294,9 @@ If JUSTIFY is non-nil, justify as well as fill the paragraph."
1296
1294
1297
1295
(defconst clojure-ts-grammar-recipes
1298
1296
'((clojure " https://github.com/sogaiu/tree-sitter-clojure.git"
1299
- " v0.0.12 " )
1300
- (markdown_inline " https://github.com/MDeiml/tree-sitter-markdown"
1301
- " v0.1.6 "
1297
+ " v0.0.13 " )
1298
+ (markdown-inline " https://github.com/MDeiml/tree-sitter-markdown"
1299
+ " v0.4.1 "
1302
1300
" tree-sitter-markdown-inline/src" ))
1303
1301
" Intended to be used as the value for `treesit-language-source-alist' ." )
1304
1302
@@ -1316,6 +1314,18 @@ If JUSTIFY is non-nil, justify as well as fill the paragraph."
1316
1314
(let ((treesit-language-source-alist clojure-ts-grammar-recipes))
1317
1315
(treesit-install-language-grammar grammar)))))))
1318
1316
1317
+ (defun clojure-ts-reinstall-grammars ()
1318
+ " Install the required versions of language grammars.
1319
+
1320
+ If the grammars are already installed, they will be reinstalled. This
1321
+ function can also be used to upgrade the grammars if they are outdated."
1322
+ (interactive )
1323
+ (dolist (recipe clojure-ts-grammar-recipes)
1324
+ (let ((grammar (car recipe)))
1325
+ (message " Installing %s tree-sitter grammar " grammar)
1326
+ (let ((treesit-language-source-alist clojure-ts-grammar-recipes))
1327
+ (treesit-install-language-grammar grammar)))))
1328
+
1319
1329
(defun clojure-ts-mode-variables (&optional markdown-available )
1320
1330
" Initialize buffer-local variables for `clojure-ts-mode' .
1321
1331
See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
@@ -1361,9 +1371,9 @@ See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
1361
1371
:syntax-table clojure-ts-mode-syntax-table
1362
1372
(clojure-ts--ensure-grammars)
1363
1373
(let ((use-markdown-inline (and clojure-ts-use-markdown-inline
1364
- (treesit-ready-p 'markdown_inline t ))))
1374
+ (treesit-ready-p 'markdown-inline t ))))
1365
1375
(when use-markdown-inline
1366
- (treesit-parser-create 'markdown_inline )
1376
+ (treesit-parser-create 'markdown-inline )
1367
1377
(setq-local treesit-range-settings clojure-ts--treesit-range-settings))
1368
1378
1369
1379
(when (treesit-ready-p 'clojure )
0 commit comments