Stage 4: Direct imports and wrapper elimination#740
Merged
Conversation
Replace hand-rolled server lifecycle and subscription wiring with createToolContext + registerCommonSubscriptions from @vscode/common-python-lsp. Changes: - Rewrite extension.ts to use shared activation APIs (~50 lines vs ~125) - Simplify constants.ts with resolveExtensionRoot, remove boilerplate - Reduce settings.ts to ISettings + transport + legacy helpers - Update nullFormatter.ts imports to shared package - Delete 9 wrapper files: server, setup, python, configWatcher, vscodeapi, utilities, logging, status, envFile - Delete 4 wrapper test files, update envFile test to stub VS Code workspace APIs directly - Bump @vscode/common-python-lsp to 0.5.1 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace resolveExtensionRoot import with inline path computation in constants.ts to avoid transitive vscode dependency in runTest.ts - Fix Prettier formatting in nullFormatter.ts - Bump Python shared package from 0.4.0 to 0.5.0 in noxfile.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bschnurr
reviewed
May 8, 2026
bschnurr
reviewed
May 8, 2026
bschnurr
reviewed
May 8, 2026
bschnurr
reviewed
May 8, 2026
bschnurr
reviewed
May 8, 2026
…port, fix newline - Extract resolvedServerInfo const to avoid spread drift (bschnurr) - Remove unused export from BLACK_CONFIG_FILES (bschnurr) - Add trailing newline to package.json (bschnurr) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bschnurr
approved these changes
May 8, 2026
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 Replace hand-rolled server lifecycle and subscription wiring in ^[xtension.ts\ with \createToolContext\ + \ egisterCommonSubscriptions\ from @vscode/common-python-lsp. This eliminates 9 wrapper files and ~1200 lines of boilerplate while preserving all extension-specific behavior (null formatter registration, default formatter logging). ## Changes - **^[xtension.ts*: Rewrite using shared activation APIs (~50 lines vs ~125). Uses \serverInfo: { ...serverInfo, name: serverName }\ to append 'Formatter' to server name - **\constants.ts*: Simplified with \ esolveExtensionRoot(__dirname), removed \BUNDLED_PYTHON_SCRIPTS_DIR, \SERVER_SCRIPT_PATH, \DEBUG_SERVER_SCRIPT_PATH, \PYTHON_VERSION, \LS_SERVER_RESTART_DELAY\ - **\settings.ts*: Reduced to \ISettings\ + \getServerTransport()\ + \logDefaultFormatter()\ + \logLegacySettings(). Imports shared utilities directly - **\ ullFormatter.ts*: Updated imports from local wrappers to @vscode/common-python-lsp\ - Deleted 9 wrapper files: server.ts, setup.ts, python.ts, configWatcher.ts, vscodeapi.ts, utilities.ts, logging.ts, status.ts, envFile.ts - Deleted 4 wrapper test files: configWatcher, python, settings, utilities tests - Updated envFile test: imports from shared package, stubs \workspace.getConfiguration\ directly - Bumped @vscode/common-python-lsp\ to 0.5.1 ## Net reduction - -1,199 lines deleted, +61 lines added - \src/common/\ reduced from 12 files to 3 (constants, settings, nullFormatter) ## Related PRs - Shared package: microsoft/vscode-common-python-lsp - Flake8 Stage 4: microsoft/vscode-flake8#506 - Mypy Stage 4: microsoft/vscode-mypy#535 - Pylint Stage 4: microsoft/vscode-pylint#811 - Isort Stage 4: microsoft/vscode-isort#657