Skip to content

Stage 4: Direct imports and wrapper elimination#740

Merged
edvilme merged 4 commits into
mainfrom
int-pilot-s4
May 11, 2026
Merged

Stage 4: Direct imports and wrapper elimination#740
edvilme merged 4 commits into
mainfrom
int-pilot-s4

Conversation

@edvilme
Copy link
Copy Markdown
Contributor

@edvilme edvilme commented May 6, 2026

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

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>
@edvilme edvilme added the debt Technical debt or repo cleanup label May 6, 2026
edvilme and others added 2 commits May 6, 2026 13:45
- 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>
@edvilme edvilme requested a review from bschnurr May 7, 2026 17:01
Comment thread src/extension.ts
Comment thread package.json Outdated
Comment thread src/test/ts_tests/tests/common/envFile.unit.test.ts
Comment thread src/common/constants.ts
Comment thread src/common/constants.ts
…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>
@edvilme edvilme merged commit b69f362 into main May 11, 2026
21 checks passed
@edvilme edvilme deleted the int-pilot-s4 branch May 11, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Technical debt or repo cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants