Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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;
// Only check dependencies and peerDependencies for @typespec/compiler and exclude devDependencies
// to further limit the libraries to load and avoid potential issues cause by loading random libraries.
// TODO: add more filter condition when needed
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