Refactor: add RunResult exit_code and align lsp_runner sys.path#623
Merged
Refactor: add RunResult exit_code and align lsp_runner sys.path#623
Conversation
rchiodo
reviewed
Apr 9, 2026
rchiodo
reviewed
Apr 9, 2026
rchiodo
reviewed
Apr 9, 2026
rchiodo
reviewed
Apr 9, 2026
1. Add Optional[Union[int, str]] exit_code parameter with None default to RunResult, matching mypy's implementation. Backward-compatible. 2. Add BUNDLE_DIR variable and 'tool' path to lsp_runner.py sys.path setup, matching black/flake8/pylint pattern. Isort was missing the tool directory. Part of #620 Ref: microsoft/vscode-python-tools-extension-template#290 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2d53240 to
2127fed
Compare
Contributor
Author
|
Both comments addressed: (1) exit_code tightened to Optional[int] since isort uses subprocess. Applied same fix to black #700 and flake8 #468. (2) lsp_runner comment updated to clarify why tool path is always bundled. |
rchiodo
approved these changes
Apr 9, 2026
Contributor
rchiodo
left a comment
There was a problem hiding this comment.
Approved via Review Center.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Two small refactors to align isort's bundled tool infrastructure with the upstream extension template and sibling extensions (black, flake8, pylint).
Change 1: RunResult.exit_code (lsp_utils.py)
Add an \�xit_code: Optional[Union[int, str]] = None\ parameter to \RunResult.init, matching mypy's implementation pattern. The default of \None\ keeps this fully backward-compatible — all existing callers continue to work unchanged.
Change 2: lsp_runner.py sys.path setup
Add the missing \ ool\ directory to \sys.path\ via a new \BUNDLE_DIR\ variable, matching the pattern used by black, flake8, and pylint runners. Isort's runner was the only one missing this path entry, which could cause import failures when the runner is invoked under a different interpreter.
Part of #620
Ref: microsoft/vscode-python-tools-extension-template#290