Skip to content

Conversation

@jeffreyhunter77
Copy link
Collaborator

This fixes a few problems with the @vscode/chat-lib package after the addition of inline completions:

  • script/postinstall.ts was omitted from the package
  • The install script didn't handle the different ways npm might install the @vscode/tree-sitter-wasm package
  • applicationinsights must be listed as a standard dependency, not a dev dependency

Copilot AI review requested due to automatic review settings November 21, 2025 18:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issues with the @vscode/chat-lib package's installation process after inline completions were added. The changes ensure the package can be properly installed and configured in different npm environments.

Key Changes:

  • Modified postinstall script to dynamically resolve the @vscode/tree-sitter-wasm package location instead of assuming a fixed path
  • Moved applicationinsights from devDependencies to dependencies to ensure it's available at runtime
  • Added the script directory to the package files list so the postinstall script is included in published packages

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
chat-lib/script/postinstall.ts Added treeSitterWasmDir() function to dynamically resolve tree-sitter-wasm location and updated asset copying to use resolved paths
chat-lib/package.json Moved applicationinsights to dependencies, added script directory to package files
Files not reviewed (1)
  • chat-lib/package-lock.json: Language not supported


function treeSitterWasmDir(): string {
const modulePath = path.dirname(require.resolve('@vscode/tree-sitter-wasm'));
return path.relative(REPO_ROOT, modulePath);
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function assumes WASM files are in the same directory as the resolved module entry point, but require.resolve() resolves to the package's main entry file (typically index.js). The WASM files are in a wasm/ subdirectory. The path should be path.join(modulePath, 'wasm') to correctly locate the WASM files.

Suggested change
return path.relative(REPO_ROOT, modulePath);
return path.relative(REPO_ROOT, path.join(modulePath, 'wasm'));

Copilot uses AI. Check for mistakes.
@chrmarti chrmarti added this pull request to the merge queue Nov 21, 2025
@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 21, 2025
Merged via the queue into main with commit f18da2f Nov 21, 2025
16 checks passed
@chrmarti chrmarti deleted the jeffreyhunter77/fix-chat-lib-files branch November 21, 2025 21:51
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.

5 participants