Skip to content

Commit

Permalink
FileTreeContextProvider uses splitPath from util instead of local copy
Browse files Browse the repository at this point in the history
  • Loading branch information
tijszwinkels committed Jun 1, 2024
1 parent 89d92af commit 7217ab7
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions core/context/providers/FileTreeContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@ import {
ContextProviderExtras,
} from "../../index.js";
import { BaseContextProvider } from "../index.js";
import { splitPath } from "../../util/index.js";

interface Directory {
name: string;
files: string[];
directories: Directory[];
}

function splitPath(path: string, withRoot?: string): string[] {
let parts = path.includes("/") ? path.split("/") : path.split("\\");
if (withRoot !== undefined) {
const rootParts = splitPath(withRoot);
parts = parts.slice(rootParts.length - 1);
}
return parts;
}

function formatFileTree(tree: Directory, indentation = ""): string {
let result = "";
for (const file of tree.files) {
Expand Down

0 comments on commit 7217ab7

Please sign in to comment.