Function: web-mode-comment-context

web-mode-comment-context is a natively compiled function defined in web-mode.el.

Signature

(web-mode-comment-context &optional POS)

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
(defun web-mode-comment-context (&optional pos)
  (cond
    (pos
     )
    ((and (eolp) (not (bobp)))
     (setq pos (1- (point))))
    (t
     (setq pos (point)))
    ) ;cond
  (let (beg col prefix type format)
    (cond
      ((eq (get-text-property pos 'block-token) 'comment)
       (setq type "block"))
      ((eq (get-text-property pos 'tag-type) 'comment)
       (setq type "tag"))
      ((eq (get-text-property pos 'part-token) 'comment)
       (setq type "part"))
      )
    (if (null type) nil
        (save-excursion
          (goto-char pos)
          (web-mode-comment-beginning)
          (setq beg (point)
                col (current-column))
          (cond
            ((looking-at-p "/\\*")
             (setq format "/*"
                   prefix " * "))
            ((looking-at-p "//")
             (setq format "//"
                   prefix "//"))
            ((looking-at-p "#")
             (setq format "#"
                   prefix "#"))
            ((looking-at-p ";")
             (setq format ";"
                   prefix ";"))
            ((looking-at-p "''")
             (setq format "''"
                   prefix "''"))
            ) ;cond
          (list :beg beg :col col :prefix prefix :type type :format format)))))