formulahendry / formulahendry/vscode-code-runner
[Bug] Code Runner-created terminal is not reused after a terminal in VSCode is closed
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 351
- PR merge metrics
- No merged PRs in 30d
Description
- VS Code Version: 1.88.0
- OS Version: macOS 14.4.1 (23E224)
- Code Runner Version: 0.12.2
**Describe the bug**
Normally, when I trigger a code run (using the "Run Code" button or the Ctrl+Alt+N shortcut), if the `code-runner.runInTerminal` setting is set to `true`, then Code Runner will create a new terminal window inside the Terminal panel only if there isn't one created by Code Runner yet, and it will reuse the same terminal for future code runs. Reusing existing terminal is a great feature because, without it, I would end up with tons of terminals I don't want.
However, if there is already a Code Runner-created terminal and I close an existing one that's not Code Runner-created, then the next time I run code, Code Runner will fail to reuse the existing one and create a new one.
**To Reproduce**
Steps to reproduce the behavior:
1. Open VSCode and open some runnable file (e.g. Python file)
2. Run code (by either clicking the "Run Code" button on editor's top-right corner or pressing Ctrl+Alt+N)
- Observe that Code Runner creates a new terminal window in the Terminal panel to run the opened code, which is expected
3. Create a new terminal window manually (by clicking the plus button on Terminal panel's top-right corner)
4. Run code again
- Observe that Code Runner reuses the old terminal window that it created in step 2, which is also expected
5. Close the newest terminal created in step 3 (by selecting the new terminal in the tab/selector view, which defaults on the right side of the Terminal panel, and clicking the bin icon next to the tab item)
6. Run code again
- Observe that Code Runner fails to recognize the existing terminal that it created in step 2 and creates a new terminal, which is unexpected
**Actual behavior**
After any terminal is closed, Code Runner creates a new terminal the next time I run code
**Expected behavior**
Code Runner should always reuse the terminal it created, if there is one, regardless what other windows I created or closed
**Video demo**
Observe that the last time I run code, Code Runner creates a new terminal when the one it created before still exists.
https://github.com/formulahendry/vscode-code-runner/assets/44916353/6311d6b3-025c-44dd-9d55-5dd1920f8b55
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.