-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Cancel Processing Command (#33)
This command allows users to stop the extension's active processing. This is helpful if it stalls for some reason, so that VS Code doesn't need to be restarted.
- Loading branch information
1 parent
7fe7eab
commit 467372b
Showing
6 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { WorkerService } from '../services/worker-service'; | ||
|
||
/** | ||
* A class for handling the command that cancels all active document processing. | ||
*/ | ||
export class CancelProcessingCommand { | ||
/** | ||
* The identifier for the command. | ||
*/ | ||
public static readonly COMMAND = 'phpCodeSniffer.cancelProcessing'; | ||
|
||
/** | ||
* All of the worker services that we should cancel execution for. | ||
*/ | ||
private readonly cancellableServices: WorkerService[]; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param {workspace} workspace The VS Code workspace. | ||
*/ | ||
public constructor(cancellableServices: WorkerService[]) { | ||
this.cancellableServices = cancellableServices; | ||
} | ||
|
||
/** | ||
* Handles the command. | ||
*/ | ||
public handle(): void { | ||
for (const service of this.cancellableServices) { | ||
service.cancelAll(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters