-
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.
Merge pull request #148 from viperproject/separates-vscode-dependencies
Separate VSCode Dependencies
- Loading branch information
Showing
16 changed files
with
56 additions
and
43 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
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
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
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
// exports all modules of this package | ||
|
||
export * from './dependencies'; | ||
export * from './util'; | ||
export * from './vscode-util'; |
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 was deleted.
Oops, something went wrong.
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,6 @@ | ||
/** | ||
* Reports overall progress made within the current task. | ||
* `fraction` is the amount of progress (out of 1). | ||
* `step` is a user-facing short description of what is currently happening. | ||
*/ | ||
export type ProgressListener = (fraction: number, step: string) => void; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// exports all modules in the current directory | ||
|
||
export * from './Location'; | ||
export * from './Platform'; | ||
export * from './Progress'; | ||
export * from './ProgressListener'; |
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,24 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
import { ProgressListener } from '../util'; | ||
|
||
/** | ||
* Runs an asynchronous task, forwarding the progress it reports to the VS Code window as a notification with the given title. | ||
* It returns the task's result, as well as whether any progress was reported at all, for your convenience. | ||
*/ | ||
export const withProgressInWindow = async<R> ( | ||
title: string, task: (progressListener: ProgressListener) => Promise<R> | ||
): Promise<{ result: R; didReportProgress: boolean }> => { | ||
let lastProgress = 0; | ||
let didReportProgress = false; | ||
const result = await vscode.window.withProgress({ | ||
location: vscode.ProgressLocation.Notification, | ||
title | ||
}, (progress) => task((fraction, step) => { | ||
didReportProgress = true; | ||
if (fraction - lastProgress < 0.01) { return; } | ||
progress.report({ message: step, increment: (fraction - lastProgress) * 100 }); | ||
lastProgress = fraction; | ||
})); | ||
return { result, didReportProgress }; | ||
}; |
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,3 @@ | ||
// exports all modules in the current directory | ||
|
||
export * from './Progress'; |