Skip to content

Fix crash when bsc plugin in worker loads another version of bsc#1579

Merged
TwitchBronBron merged 6 commits intomasterfrom
fix-lsp-thread-crash
Oct 31, 2025
Merged

Fix crash when bsc plugin in worker loads another version of bsc#1579
TwitchBronBron merged 6 commits intomasterfrom
fix-lsp-thread-crash

Conversation

@TwitchBronBron
Copy link
Member

@TwitchBronBron TwitchBronBron commented Oct 29, 2025

Fixes a crash when the language server. Here's the general problem that was happening:

  • vscode launches the embedded version of the language_ server
  • language server spawns a worker thread and listens on the communication port
  • worker thread loads a bsc plugin
  • the bsc plugin requires a different version of brighterscript from node_modules, which adds another listener on the communication port

This extra listener was the problem, because it was trying to answer questions for a project it had never initialized (and shouldn't have).

So this PR mitigates that by separating the "thread running" into its own file that will no longer be accidentally run anytime brighterscript was imported.

@TwitchBronBron TwitchBronBron added create-vsix PRs with this tag will trigger a vsix build on vscode-brightscript-language for every push create-package create a temporary npm package on every commit labels Oct 29, 2025
@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on 18f0c23. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-0.70.2-fix-lsp-thread-crash.20251029201832.tgz

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on 18f0c23. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-0.70.2-fix-lsp-thread-crash.20251029201831.tgz

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the worker thread initialization architecture by extracting the worker entry point into a dedicated run.ts file and adding debugging support for worker threads.

  • Extracted worker thread initialization code from WorkerThreadProject.ts into a standalone run.ts entry point
  • Removed command-line argument-based worker detection in favor of a dedicated worker script
  • Added automatic debugging support for worker threads when the main process is being debugged

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/lsp/worker/run.ts New dedicated entry point script for worker threads that initializes WorkerThreadProjectRunner
src/lsp/worker/WorkerThreadProject.ts Refactored to use the new run.ts script, removed inline worker initialization code, and added debugging support configuration

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new version of the vscode extension based on 18f0c23. You can download the .vsix here and then follow these installation instructions.

1 similar comment
@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new version of the vscode extension based on 18f0c23. You can download the .vsix here and then follow these installation instructions.

@TwitchBronBron TwitchBronBron removed the create-vsix PRs with this tag will trigger a vsix build on vscode-brightscript-language for every push label Oct 31, 2025
@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on 65c22a5. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-0.70.2-fix-lsp-thread-crash.20251031133439.tgz

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on 81bf0a1. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-0.70.2-fix-lsp-thread-crash.20251031133448.tgz

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on cd4da43. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-0.70.2-fix-lsp-thread-crash.20251031133607.tgz

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new version of the vscode extension based on 65c22a5. You can download the .vsix here and then follow these installation instructions.

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new version of the vscode extension based on 81bf0a1. You can download the .vsix here and then follow these installation instructions.

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new version of the vscode extension based on b36662a. You can download the .vsix here and then follow these installation instructions.

@TwitchBronBron TwitchBronBron enabled auto-merge (squash) October 31, 2025 13:40
@TwitchBronBron TwitchBronBron merged commit 0b08605 into master Oct 31, 2025
7 checks passed
@TwitchBronBron TwitchBronBron deleted the fix-lsp-thread-crash branch October 31, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-package create a temporary npm package on every commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants