applied patch
This commit is contained in:
parent
07a4202223
commit
342dfdb3e8
7 changed files with 18 additions and 17 deletions
|
|
@ -16,6 +16,7 @@ class CodeContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Code",
|
||||
description: "Type to search",
|
||||
type: "submenu",
|
||||
dependsOnIndexing: true,
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class FileContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Files",
|
||||
description: "Type to search",
|
||||
type: "submenu",
|
||||
dependsOnIndexing: true,
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class FileTreeContextProvider extends BaseContextProvider {
|
|||
description: "Attach a representation of the file tree",
|
||||
type: "normal",
|
||||
renderInlineAs: "",
|
||||
dependsOnIndexing: true,
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@ import {
|
|||
ContextSubmenuItem,
|
||||
LoadSubmenuItemsArgs,
|
||||
} from "../../index.js";
|
||||
import { getBasename, groupByLastNPathParts, getUniqueFilePath } from "../../util/index.js";
|
||||
import {
|
||||
getBasename,
|
||||
groupByLastNPathParts,
|
||||
getUniqueFilePath,
|
||||
} from "../../util/index.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
|
||||
class FolderContextProvider extends BaseContextProvider {
|
||||
|
|
@ -14,6 +18,7 @@ class FolderContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Folder",
|
||||
description: "Type to search",
|
||||
type: "submenu",
|
||||
dependsOnIndexing: true,
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
@ -35,7 +40,7 @@ class FolderContextProvider extends BaseContextProvider {
|
|||
return {
|
||||
id: folder,
|
||||
title: getBasename(folder),
|
||||
description: getUniqueFilePath(folder, folderGroups)
|
||||
description: getUniqueFilePath(folder, folderGroups),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class RepoMapContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Repository Map",
|
||||
description: "List of files and signatures",
|
||||
type: "normal",
|
||||
dependsOnIndexing: true,
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -126,6 +126,7 @@ export interface ContextProviderDescription {
|
|||
description: string;
|
||||
renderInlineAs?: string;
|
||||
type: ContextProviderType;
|
||||
dependsOnIndexing?: boolean;
|
||||
}
|
||||
|
||||
export type FetchFunction = (url: string | URL, init?: any) => Promise<any>;
|
||||
|
|
|
|||
|
|
@ -14,15 +14,6 @@ import { useWebviewListener } from "./useWebviewListener";
|
|||
import { WebviewMessengerResult } from "core/protocol/util";
|
||||
import { getLocalStorage } from "../util/localStorage";
|
||||
|
||||
// Add this enum definition
|
||||
enum IndexedProvider {
|
||||
File = "file",
|
||||
Folder = "folder",
|
||||
Tree = "tree",
|
||||
RepoMap = "repo-map",
|
||||
Code = "code",
|
||||
}
|
||||
|
||||
const MINISEARCH_OPTIONS = {
|
||||
prefix: true,
|
||||
fuzzy: 2,
|
||||
|
|
@ -260,18 +251,18 @@ function useSubmenuContextProviders() {
|
|||
|
||||
await Promise.all(
|
||||
contextProviderDescriptions.map(async (description) => {
|
||||
if (
|
||||
Object.values(IndexedProvider).includes(
|
||||
description.title as IndexedProvider,
|
||||
) &&
|
||||
disableIndexing
|
||||
) {
|
||||
const shouldSkipProvider =
|
||||
description.dependsOnIndexing && disableIndexing;
|
||||
|
||||
if (shouldSkipProvider) {
|
||||
console.debug(
|
||||
`Skipping ${description.title} provider due to disabled indexing`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
console.debug(`Processing provider: ${description.title}`);
|
||||
|
||||
try {
|
||||
const minisearch = new MiniSearch<ContextSubmenuItem>({
|
||||
fields: ["title", "description"],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue