diff --git a/prettier-tests.el b/prettier-tests.el index 587fdd8..83a2848 100644 --- a/prettier-tests.el +++ b/prettier-tests.el @@ -2,7 +2,7 @@ ;; Copyright (c) 2018-present Julian Scheid -;; Package-Requires: ((web-mode "20200501") (elm-mode "20200406") (pug-mode "20180513") (svelte-mode "20200327") (toml-mode "20161107") (solidity-mode "20200418") (vue-mode "20190415") (lsp-mode "20201111") (noflet "20141102") (f "20191110") (json-mode "20190123") (ert-async "0.1")) +;; Package-Requires: ((web-mode "20200501") (elm-mode "20200406") (pug-mode "20180513") (svelte-mode "20210222") (toml-mode "20161107") (solidity-mode "20200418") (vue-mode "20190415") (lsp-mode "20201111") (noflet "20141102") (f "20191110") (json-mode "20190123") (typescript-mode "20201002") (ert-async "0.1")) ;;; Commentary: @@ -16,6 +16,8 @@ (require 'noflet) (require 'thingatpt) (require 'prettier) +(require 'svelte-mode) +(require 'typescript-mode) (eval-when-compile (require 'ert-async)) @@ -47,7 +49,8 @@ (prettier--eval-file-if-exists "setup.elisp") (prettier-prettify) (prettier--eval-file-if-exists "test.elisp") - (buffer-string))) + (buffer-substring-no-properties (point-min) + (point-max)))) (expected (with-temp-buffer (insert-file-contents diff --git a/prettier.el b/prettier.el index 69d9a3f..c3f9934 100644 --- a/prettier.el +++ b/prettier.el @@ -826,9 +826,10 @@ Additional considerations were: (lambda (proc event) (unless (and (eq (process-status proc) 'signal) (eq (process-exit-status proc) 3)) - (message "prettier-process (%s) quit unexpectedly: %s" + (message "prettier-process (%s) quit unexpectedly: %s (%s)" (process-get proc :server-id) - (string-trim event))) + (string-trim event) + (buffer-string))) (unless prettier-keep-server-buffer-flag (kill-buffer (process-buffer proc))) (remhash node-command prettier-processes))) @@ -1382,6 +1383,9 @@ for derived modes.)" (or (and (fboundp 'mhtml-mode) (get-text-property (point) 'mhtml-submode) 'mhtml-mode) + (and (fboundp 'svelte-mode) + (get-text-property (point) 'svelte-submode) + 'svelte-mode) (and (boundp 'mmm-primary-mode) mmm-primary-mode) major-mode))))) diff --git a/test-cases/svelte-mode/a.original.svelte b/test-cases/svelte-mode/a.original.svelte index c5b72ba..0d42496 100644 --- a/test-cases/svelte-mode/a.original.svelte +++ b/test-cases/svelte-mode/a.original.svelte @@ -1,4 +1,4 @@ - diff --git a/test-cases/svelte-mode/a.prettier.svelte b/test-cases/svelte-mode/a.prettier.svelte index 05dac42..d57d2ec 100644 --- a/test-cases/svelte-mode/a.prettier.svelte +++ b/test-cases/svelte-mode/a.prettier.svelte @@ -1,4 +1,4 @@ - diff --git a/test-cases/svelte-mode/setup.elisp b/test-cases/svelte-mode/setup.elisp new file mode 100644 index 0000000..1bc2fba --- /dev/null +++ b/test-cases/svelte-mode/setup.elisp @@ -0,0 +1,7 @@ +(progn + ;; needed for enabling svelte sub-modes + (font-lock-fontify-buffer) + ;; go to typescript section + (goto-char 23) + ;; activate sveltse sub-mode at point + (run-hooks 'post-command-hook))