fix: ensure that the tsserver subprocess uses same node instance #292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The server has always supported two ways of starting the
tsserver
sub-process - either forking the current process or spawning a new
Node process. The latter was problematic in some cases and this PR
is removing support for that.
Forking the process was used when we had a path to the
tsserver.js
script while spawning was used when we had either just a binary
name like
tsserver
or a full path to the thetsserver
shellscript. Since a shell script can't be started directly by Node, we
had to let the shell handle it and start the Node process that way.
That was an issue since it sometimes resulted in starting a completely
different instance of Node found on the PATH, that was potentially not
compatible or, more likely, sandboxed as is the case with Snap packages.
This PR removes support for spawning a process but also adds logic
that will try to find the path to the corresponding
tsserver.js
script if we've only been passed
tsserver
or path to the shellscript through
--tsserver-path
. This should ensure that the serverstays backward-compatible with the previous approach as much as
possible (even if not 100%).
Fixes #191