Skip to content
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

Update tsserver when deps are updated. Dont crash on missing tsserver #135

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

benjreinhart
Copy link
Contributor

@benjreinhart benjreinhart commented Jul 15, 2024

This PR:

  1. Updates tsserver diagnostics when dependencies are installed. This fixes a bug where you import from a third party dep that isn't yet installed, get diagnostic errors, install deps, and still see errors about the module not found.
  2. This fixes a bug where the server crashes if you create a new typescript srcbook (or import from one) and then navigate away from the srcbook page. (this is a bad bug)
  3. To fix above bug and generally be more lenient, we do not error if we try to shutdown a tsserver that does not exist.

@benjreinhart benjreinhart requested a review from nichochar July 15, 2024 04:21
@benjreinhart benjreinhart merged commit c71b23c into main Jul 15, 2024
1 check passed
@benjreinhart benjreinhart deleted the pkgjson-tsserver branch July 15, 2024 04:27
// Make sure to handle the following case here:
//
// 1. User creates a new typescript Srcbook
// 3. There is no tsserver running because it relies on the typescript package in the Srcbook's node modules, which are not yet installed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we handling 3 ?

Btw the list goes 1, 3, 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we handling 3 ?

Yes, that's what this code is doing. Line 258 creates a new tsserver process if there is not one running. At this point, it should work fine because this code runs after deps are installed.

@@ -39,6 +39,11 @@ export class TsServers {
}

// This is using the TypeScript dependency in the user's Srcbook.
//
// Note: If a user creates a typescript Srcbook, when it is first
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet another reason to auto-install the deps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants