create a function to include files listed inside workspace .continueignore
This commit is contained in:
parent
8c99fcae7a
commit
207cf9766d
1 changed files with 18 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import fs from "fs";
|
|||
|
||||
import ignore from "ignore";
|
||||
|
||||
import { IDE } from "..";
|
||||
import { getGlobalContinueIgnorePath } from "../util/paths";
|
||||
|
||||
export const DEFAULT_IGNORE_FILETYPES = [
|
||||
|
|
@ -129,3 +130,20 @@ export const getGlobalContinueIgArray = () => {
|
|||
const contents = fs.readFileSync(getGlobalContinueIgnorePath(), "utf8");
|
||||
return gitIgArrayFromFile(contents);
|
||||
};
|
||||
|
||||
export const getWorkspaceContinueIgArray = async (ide: IDE) => {
|
||||
const dirs = await ide.getWorkspaceDirs();
|
||||
return await dirs.reduce(
|
||||
async (accPromise, dir) => {
|
||||
const acc = await accPromise;
|
||||
try {
|
||||
const contents = await ide.readFile(`${dir}/.continueignore`);
|
||||
return [...acc, ...gitIgArrayFromFile(contents)];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return acc;
|
||||
}
|
||||
},
|
||||
Promise.resolve([] as string[]),
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue