File tree Expand file tree Collapse file tree 2 files changed +7
-14
lines changed
extensions/ql-vscode/src/databases Expand file tree Collapse file tree 2 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Progress, CancellationToken } from "vscode";
44import { Credentials } from "../common/authentication" ;
55import { BaseLogger } from "../common/logging" ;
66import { AppOctokit } from "../common/octokit" ;
7+ import { UserCancellationException } from "../common/vscode/progress" ;
78
89export async function getCodeSearchRepositories (
910 query : string ,
@@ -15,7 +16,7 @@ export async function getCodeSearchRepositories(
1516 credentials : Credentials ,
1617 logger : BaseLogger ,
1718) : Promise < string [ ] > {
18- let nwos : string [ ] = [ ] ;
19+ const nwos : string [ ] = [ ] ;
1920 const octokit = await provideOctokitWithThrottling ( credentials , logger ) ;
2021
2122 for await ( const response of octokit . paginate . iterator (
@@ -34,8 +35,7 @@ export async function getCodeSearchRepositories(
3435 progress . report ( { increment } ) ;
3536
3637 if ( token . isCancellationRequested ) {
37- nwos = [ ] ;
38- break ;
38+ throw new UserCancellationException ( "Code search cancelled." , true ) ;
3939 }
4040 }
4141
Original file line number Diff line number Diff line change @@ -34,10 +34,7 @@ import { DatabasePanelCommands } from "../../common/commands";
3434import { App } from "../../common/app" ;
3535import { QueryLanguage } from "../../common/query-language" ;
3636import { getCodeSearchRepositories } from "../code-search-api" ;
37- import {
38- showAndLogErrorMessage ,
39- showAndLogInformationMessage ,
40- } from "../../common/logging" ;
37+ import { showAndLogErrorMessage } from "../../common/logging" ;
4138
4239export interface RemoteDatabaseQuickPickItem extends QuickPickItem {
4340 remoteDatabaseKind : string ;
@@ -426,13 +423,9 @@ export class DbPanel extends DisposableObject {
426423 this . app . logger ,
427424 ) ;
428425
429- token . onCancellationRequested ( ( ) => {
430- void showAndLogInformationMessage (
431- this . app . logger ,
432- "Code search cancelled" ,
433- ) ;
434- return ;
435- } ) ;
426+ if ( token . isCancellationRequested ) {
427+ throw new UserCancellationException ( "Code search cancelled." , true ) ;
428+ }
436429
437430 progress . report ( { increment : 10 , message : "Processing results..." } ) ;
438431
You can’t perform that action at this time.
0 commit comments