2

作为一名 JS 开发人员,我想在 JS 文件中的一行上按下一个键,并在浏览器的调试器中设置一个调试断点。对于加分,找到这一行的方法应该是“模糊的”,因为我的构建系统可能会在当前文件前面添加其他 JS。

我知道 slime-js,它与页内 JS 对话,但我正在寻找与 Firebug 或 Chrome“开发者工具”的连接。

4

1 回答 1

1

这就是我的 .emacs 中的内容

(defun line-matches-p (regexp)
  (string-match-p
   regexp
   (buffer-substring
    (line-beginning-position)
    (line-end-position))))

(defun js-toggle-debugger ()
  (interactive)
  (if (line-matches-p "debugger")
      (delete-region (line-beginning-position)
                     (1+ (line-end-position)))
      (progn (beginning-of-line)
             (insert "\n")
             (backward-char)
             (insert "debugger;")
             (indent-according-to-mode)
             (end-of-line))))

它插入或删除“调试器”关键字。我已经将它与 firebug 和 moz-repl 一起使用。

缺点是它需要您重新评估该功能。

于 2012-07-04T00:45:12.507 回答