-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output stderr when starting tsserver #473
Comments
Ok, this outputs good error messages to (defun tide-start-server ()
(when (tide-current-server)
(error "Server already exist"))
(message "(%s) Starting tsserver..." (tide-project-name))
(let* ((default-directory (tide-project-root))
(process-environment (append tide-tsserver-process-environment process-environment))
(buf (generate-new-buffer tide-server-buffer-name))
(tsserverjs (tide-locate-tsserver-executable))
(node-process-arguments (append tide-node-flags (list tsserverjs) tide-tsserver-flags))
(process-name "tsserver"))
(make-process
:name process-name
:buffer buf
:command (append (list tide-node-executable) node-process-arguments)
;; Use a pipe to communicate with the subprocess. This fixes a hang
;; when a >1k message is sent on macOS.
:connection-type nil
:stderr "*Messages*"
:coding 'utf-8-unix
:noquery t
:filter #'tide-net-filter
:sentinel #'tide-net-sentinel)
(let ((process (get-process process-name)))
(with-current-buffer (process-buffer process)
(buffer-disable-undo))
(process-put process 'project-name (tide-project-name))
(process-put process 'project-root default-directory)
(puthash (tide-project-name) process tide-servers)
(message "(%s) tsserver server started successfully." (tide-project-name))
(tide-each-buffer (tide-project-name) #'tide-configure-buffer)))) It should probably be refined but I wanted to check if this approach has drawbacks before PR-ing it. Thoughts? |
@ananthakumaran apologies for the ping but would you open to a PR with the above? |
Let me know what you think arichiardi@cf9bad1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
M-x tide-restart-server
in the buffer where I had the problem.M-x tide-verify-setup
are correct.tsc
(andtslint
, if applicable) without the error or warning I'm seeing in tide.tsc
(ortslint
, if applicable) reports the error or warning I was expecting to see.typescript-mode
ortsserver
.Relevant Version Numbers
v5.1.3
tsc --version Version 5.5.4
29.4
Steps to Reproduce the Bug
Not a bug but I have done some debugging for errors very similar to #438 and #87.
Expected Behavior
When the
tsserver
process cannot start, it would be good to see why in the message buffer.Actual Behavior
In many occasions this does happen.
I was able to get good output by setting this:
(set-process-sentinel process #'tide-net-sentinel)
In my case the error was:
Couldn’t locate project root folder with a tsconfig.json or jsconfig.json file. Using ’/home/user/.config/emacs/lib/tide/’ as project root.
At the point I kind of asked myself why that's the case and stumble across Emacs Async Processes page. It might be the case that
start-process
, being a wrapper, does not do much with regards to:stderr
(seemake-process
).I am not sure cause haven't tried (yet) but probably using
make-process
would give more control over the output and will end up showing the right message.The text was updated successfully, but these errors were encountered: