Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: fix
packages:
- "@typespec/compiler"
---

LSP connection failure after dynamically loading a certain library in the package
5 changes: 4 additions & 1 deletion packages/compiler/src/server/lib-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ export class LibraryProvider {
const data = await pkg.getPackageJsonData();
// don't add to cache when failing to load package.json which is unexpected
if (!data) return false;
// Modification Note:
// - devDependencies are theoretically not counted in the production environment;
// - this leads to LSP connection failure after dynamically loading a certain library in the package.
if (
(data.devDependencies && data.devDependencies["@typespec/compiler"]) ||
(data.peerDependencies && data.peerDependencies["@typespec/compiler"]) ||
(data.dependencies && data.dependencies["@typespec/compiler"])
) {
const exports = await pkg.getModuleExports();
Expand Down
Loading