We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae9c97c commit 533b93dCopy full SHA for 533b93d
core/autocomplete/context/ImportDefinitionsService.ts
@@ -5,6 +5,7 @@ import {
5
getParserForFile,
6
getQueryForFile,
7
} from "../../util/treeSitter";
8
+import { findUriInDirs } from "../../util/uri";
9
10
interface FileInfo {
11
imports: { [key: string]: RangeInFileWithContents[] };
@@ -44,7 +45,15 @@ export class ImportDefinitionsService {
44
45
46
let fileContents: string | undefined = undefined;
47
try {
- fileContents = await this.ide.readFile(filepath);
48
+ const { foundInDir } = findUriInDirs(
49
+ filepath,
50
+ await this.ide.getWorkspaceDirs(),
51
+ );
52
+ if (!foundInDir) {
53
+ return null;
54
+ } else {
55
+ fileContents = await this.ide.readFile(filepath);
56
+ }
57
} catch (err) {
58
// File removed
59
return null;
0 commit comments