Skip to content

Commit 2709653

Browse files
committed
Better handle broken configuration (#254)
1 parent ded0197 commit 2709653

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

extension/client/src/requests.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export default function buildRequestHandlers(client: LanguageClient) {
4444
const instance = getInstance();
4545
if (instance && instance.getConnection()) {
4646
const config = instance.getConfig();
47-
return config.homeDirectory;
47+
if (config) {
48+
return config.homeDirectory;
49+
}
4850
}
4951
})
5052

@@ -103,13 +105,15 @@ export default function buildRequestHandlers(client: LanguageClient) {
103105
const content = instance?.getContent();
104106
const config = instance?.getConfig()!;
105107

106-
if (includePaths.length === 0) {
107-
includePaths.push(config.homeDirectory);
108-
}
108+
if (instance && content && config) {
109+
if (includePaths.length === 0) {
110+
includePaths.push(config.homeDirectory);
111+
}
109112

110-
const resolvedPath = await content?.streamfileResolve(bases, includePaths);
113+
const resolvedPath = await content?.streamfileResolve(bases, includePaths);
111114

112-
return resolvedPath;
115+
return resolvedPath;
116+
}
113117
});
114118

115119
/**

0 commit comments

Comments
 (0)