emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/web-mode 109ec8ee30: part identation


From: ELPA Syncer
Subject: [nongnu] elpa/web-mode 109ec8ee30: part identation
Date: Sun, 25 Dec 2022 13:59:43 -0500 (EST)

branch: elpa/web-mode
commit 109ec8ee3020c824713cbd8131f048d17aadbfc9
Author: fxbois <fxbois@gmail.com>
Commit: fxbois <fxbois@gmail.com>

    part identation
    
    #1230
---
 issues/1230.twig |  9 ++++++++-
 web-mode.el      | 19 ++++++++++++++-----
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/issues/1230.twig b/issues/1230.twig
index 111fe62b46..2f60385450 100644
--- a/issues/1230.twig
+++ b/issues/1230.twig
@@ -1,7 +1,14 @@
 <script>
  {% if condition %}
- console.log('Current indentation');
+   console.log('Current indentation');
+   if (true) {
+     console.log('hello');
+   }
+   console.log('Current indentation');
  {% endif %}
+ if (true) {
+   console.log('hesllo');
+ }
 </script>
 <div>
   {% if condition %}
diff --git a/web-mode.el b/web-mode.el
index 825f398290..3601e6edde 100644
--- a/web-mode.el
+++ b/web-mode.el
@@ -6791,7 +6791,10 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
   (let (sub1 sub2 sub3 continue char keywords token-type face beg end (buffer 
(current-buffer)))
 
     ;; NOTE: required for blocks inside tag attrs
-    (remove-list-of-text-properties reg-beg reg-end '(font-lock-face))
+    ;; NOTE: ajout de face dans la liste pour sucharger la couleur définie par
+    ;;       un prealable web-mode-fontity-part (2022-12-25 #1230)
+    (remove-list-of-text-properties reg-beg reg-end '(font-lock-face face))
+    ;;(message "reg-beg=%S reg-end=%S" reg-beg reg-end)
 
     (goto-char reg-beg)
 
@@ -9661,17 +9664,23 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
   )
 
 (defun web-mode-javascript-indentation (pos initial-column language-offset 
language &optional limit)
-  (let (open-ctx indentation offset sub)
+  (let (open-ctx open-pos indentation offset sub block-pos)
     (setq open-ctx (web-mode-bracket-up pos language limit))
+    ;;(message "%S" open-ctx)
     ;;(message "pos(%S) initial-column(%S) language-offset(%S) language(%S) 
limit(%S)" pos initial-column language-offset language limit)
     ;;(message "javascript-indentation: %S\nchar=%c" open-ctx (plist-get 
open-ctx :char))
     (setq indentation (plist-get open-ctx :indentation))
     (when (and initial-column (> initial-column indentation))
-      (setq indentation initial-column)
-      )
+      (setq indentation initial-column))
     (setq case-fold-search nil) ; #1006
+    (when open-ctx
+      (setq open-pos (plist-get open-ctx :pos)))
+    (setq block-pos (web-mode-inside-block-control pos))
+    ;;(message "bracket-pos=%S block-pos=%S" open-pos block-pos)
     (cond
-      ((or (null open-ctx) (null (plist-get open-ctx :pos)))
+      ((and block-pos (or (null open-pos) (> block-pos open-pos))) ;; #1230
+       (setq offset (+ indentation language-offset)))
+      ((null open-pos)
        (setq offset initial-column))
       ((and (member language '("javascript" "jsx" "ejs"))
             (eq (plist-get open-ctx :char) ?\{)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]