Skip to content

Commit

Permalink
reduce redundancies in new provider API
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamah committed Jul 26, 2024
1 parent 00374b8 commit a3db460
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 103 deletions.
86 changes: 1 addition & 85 deletions src/vscode-dts/vscode.proposed.aiTextSearchProviderNew.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,90 +4,6 @@
*--------------------------------------------------------------------------------------------*/

declare module 'vscode' {
/**
* Options that apply to AI text search.
*/
export interface AITextSearchOptionsNew {

folderOptions: {
/**
* The root folder to search within.
*/
folder: Uri;

/**
* Files that match an `includes` glob pattern should be included in the search.
*/
includes: string[];

/**
* Files that match an `excludes` glob pattern should be excluded from the search.
*/
excludes: GlobPattern[];

/**
* Whether symlinks should be followed while searching.
* For more info, see the setting description for `search.followSymlinks`.
*/
followSymlinks: boolean;

/**
* Which file locations we should look for ignore (.gitignore or .ignore) files to respect.
*/
useIgnoreFiles: {
/**
* Use ignore files at the current workspace root.
*/
local: boolean;
/**
* Use ignore files at the parent directory. If set, {@link TextSearchProviderOptionsNew.useIgnoreFiles.local} should also be `true`.
*/
parent: boolean;
/**
* Use global ignore files. If set, {@link TextSearchProviderOptionsNew.useIgnoreFiles.local} should also be `true`.
*/
global: boolean;
};
}[];

/**
* The maximum number of results to be returned.
*/
maxResults: number;

/**
* Options to specify the size of the result text preview.
*/
previewOptions: {
/**
* The maximum number of lines in the preview.
* Only search providers that support multiline search will ever return more than one line in the match.
*/
matchLines: number;

/**
* The maximum number of characters included per line.
*/
charsPerLine: number;
};

/**
* Exclude files larger than `maxFileSize` in bytes.
*/
maxFileSize: number;

/**
* Interpret files using this encoding.
* See the vscode setting `"files.encoding"`
*/
encoding: string;

/**
* Number of lines of context to include before and after each match.
*/
surroundingContext: number;
}

/**
* An AITextSearchProvider provides additional AI text search results in the workspace.
*/
Expand All @@ -101,7 +17,7 @@ declare module 'vscode' {
* @param progress A progress callback that must be invoked for all results.
* @param token A cancellation token.
*/
provideAITextSearchResults(query: string, options: AITextSearchOptionsNew, progress: Progress<TextSearchResultNew>, token: CancellationToken): ProviderResult<TextSearchCompleteNew>;
provideAITextSearchResults(query: string, options: TextSearchProviderOptions, progress: Progress<TextSearchResultNew>, token: CancellationToken): ProviderResult<TextSearchCompleteNew>;
}

export namespace workspace {
Expand Down
8 changes: 4 additions & 4 deletions src/vscode-dts/vscode.proposed.fileSearchProviderNew.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare module 'vscode' {
/**
* Options that apply to file search.
*/
export interface FileSearchProviderOptionsNew {
export interface FileSearchProviderOptions {
folderOptions: {
/**
* The root folder to search within.
Expand Down Expand Up @@ -42,11 +42,11 @@ declare module 'vscode' {
*/
local: boolean;
/**
* Use ignore files at the parent directory. If set, {@link FileSearchProviderOptionsNew.useIgnoreFiles.local} should also be `true`.
* Use ignore files at the parent directory. If set, {@link FileSearchProviderOptions.useIgnoreFiles.local} should also be `true`.
*/
parent: boolean;
/**
* Use global ignore files. If set, {@link FileSearchProviderOptionsNew.useIgnoreFiles.local} should also be `true`.
* Use global ignore files. If set, {@link FileSearchProviderOptions.useIgnoreFiles.local} should also be `true`.
*/
global: boolean;
};
Expand Down Expand Up @@ -81,7 +81,7 @@ declare module 'vscode' {
* @param options A set of options to consider while searching files.
* @param token A cancellation token.
*/
provideFileSearchResults(pattern: string, options: FileSearchProviderOptionsNew, token: CancellationToken): ProviderResult<Uri[]>;
provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult<Uri[]>;
}

export namespace workspace {
Expand Down
10 changes: 1 addition & 9 deletions src/vscode-dts/vscode.proposed.textSearchCompleteNew.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ declare module 'vscode' {
/**
* The message type, this affects how the message will be rendered.
*/
type: TextSearchCompleteMessageTypeNew;
}

/**
* Represents the severity of a TextSearchComplete message.
*/
export enum TextSearchCompleteMessageTypeNew {
Information = 1,
Warning = 2,
type: TextSearchCompleteMessageType;
}
}
10 changes: 5 additions & 5 deletions src/vscode-dts/vscode.proposed.textSearchProviderNew.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ declare module 'vscode' {
/**
* Options that apply to text search.
*/
export interface TextSearchProviderOptionsNew {
export interface TextSearchProviderOptions {

folderOptions: {
/**
Expand Down Expand Up @@ -73,11 +73,11 @@ declare module 'vscode' {
*/
local: boolean;
/**
* Use ignore files at the parent directory. If set, {@link TextSearchProviderOptionsNew.useIgnoreFiles.local} should also be `true`.
* Use ignore files at the parent directory. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`.
*/
parent: boolean;
/**
* Use global ignore files. If set, {@link TextSearchProviderOptionsNew.useIgnoreFiles.local} should also be `true`.
* Use global ignore files. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`.
*/
global: boolean;
};
Expand Down Expand Up @@ -129,7 +129,7 @@ declare module 'vscode' {
export interface TextSearchCompleteNew {
/**
* Whether the search hit the limit on the maximum number of search results.
* `maxResults` on {@linkcode TextSearchProviderOptionsNew} specifies the max number of results.
* `maxResults` on {@linkcode TextSearchProviderOptions} specifies the max number of results.
* - If exactly that number of matches exist, this should be false.
* - If `maxResults` matches are returned and more exist, this should be true.
* - If search hits an internal limit which is less than `maxResults`, this should be true.
Expand Down Expand Up @@ -216,7 +216,7 @@ declare module 'vscode' {
* @param progress A progress callback that must be invoked for all results.
* @param token A cancellation token.
*/
provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptionsNew, progress: Progress<TextSearchResultNew>, token: CancellationToken): ProviderResult<TextSearchCompleteNew>;
provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress<TextSearchResultNew>, token: CancellationToken): ProviderResult<TextSearchCompleteNew>;
}

export namespace workspace {
Expand Down

0 comments on commit a3db460

Please sign in to comment.