Merge pull request #4867 from continuedev/dallin/imports-outside-workspace
Autocomplete: don't look for imports outside workspace
This commit is contained in:
commit
994dbaf3de
1 changed files with 10 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import {
|
|||
getParserForFile,
|
||||
getQueryForFile,
|
||||
} from "../../util/treeSitter";
|
||||
import { findUriInDirs } from "../../util/uri";
|
||||
|
||||
interface FileInfo {
|
||||
imports: { [key: string]: RangeInFileWithContents[] };
|
||||
|
|
@ -44,7 +45,15 @@ export class ImportDefinitionsService {
|
|||
|
||||
let fileContents: string | undefined = undefined;
|
||||
try {
|
||||
fileContents = await this.ide.readFile(filepath);
|
||||
const { foundInDir } = findUriInDirs(
|
||||
filepath,
|
||||
await this.ide.getWorkspaceDirs(),
|
||||
);
|
||||
if (!foundInDir) {
|
||||
return null;
|
||||
} else {
|
||||
fileContents = await this.ide.readFile(filepath);
|
||||
}
|
||||
} catch (err) {
|
||||
// File removed
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue