Skip to content

fix(sdks): improve typescript-language-server PnP auto import support #6870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amyanger
Copy link

@amyanger amyanger commented Aug 7, 2025

Summary

This PR fixes inconsistent auto import behavior when using typescript-language-server with PnP environments (Fixes #6845).

Problem

The issue reported that auto imports work inconsistently in PnP environments when using typescript-language-server with Neovim. Some imports like PutObjectCommand work correctly, while others like AaaaRecord fail to auto-import despite being suggested.

Root Cause

  1. Missing VSCode SDK Integration: typescript-language-server had null configuration in the VSCode SDK, unlike the regular typescript package
  2. Lack of PnP Path Resolution: typescript-language-server wasn't receiving the same TypeScript server monkey patches that handle PnP virtual path resolution and auto imports

Solution

  • Added VSCode integration wrapper for typescript-language-server with proper TypeScript SDK configuration
  • Applied TypeScript server monkey patches to typescript-language-server base wrapper, including:
    • PnP virtual path resolution
    • Editor path normalization (VSCode, Neovim, etc.)
    • Plugin loading fixes
    • Auto import path handling

Changes

  • packages/yarnpkg-sdks/sources/sdks/vscode.ts: Added generateTypescriptLanguageServerWrapper and updated SDK configuration
  • packages/yarnpkg-sdks/sources/sdks/base.ts: Enhanced base wrapper with comprehensive TypeScript server monkey patches

Testing

  • ✅ All unit tests pass (yarn test:unit)
  • ✅ Code passes linting (yarn test:lint)
  • ✅ Constraints check passes (yarn constraints)
  • ✅ Package builds successfully

Package Version

The @yarnpkg/sdks package has been modified and will need a version bump as detected by yarn version check.

Fixes #6845

- Add VSCode integration wrapper for typescript-language-server
- Apply TypeScript server monkey patches to improve PnP path resolution
- Fix inconsistent auto import behavior in PnP environments
- Ensure typescript-language-server gets same path normalization as typescript SDK

Fixes yarnpkg#6845
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug?]: auto import doesn't always work with pnp?
1 participant