+
Skip to content

Send multiline string #31

@linktohack

Description

@linktohack

Node has special key for multiline string. .editor. The patch bellow will allow you to evaluate all or partial of this code for example

[1, 2, 3]
  .map((it) => it + 1)
  .filter((it) => it > 0)
  .reduce((prev, curr) => prev + curr, 0);
  (el-patch-feature js-comint)

  (with-eval-after-load 'js-comint
    (el-patch-defun js-comint-send-string (str)
      "Send STR to repl."
      (el-patch-swap
	(comint-send-string (js-comint-get-process)
			    (concat str "\n"))
	(let ((lines (string-lines str)))
	  (if (length= lines 1)
	      (comint-send-string (js-comint-get-process)
				  (concat str "\n"))
	    (comint-send-string (js-comint-get-process)
				(concat ".editor" "\n" str "\n"))
	    (process-send-eof (js-comint-get-process)))))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载