vscode APIs
- workspace
- window
- ExtensionContext
- Uri
- commands
- Range
- Position
- TextDocument
- Disposable
- CancellationToken
- languages
- TextEditor
- EventEmitter
- ViewColumn
- QuickPickItem
- Event
- OutputChannel
- MarkdownString
- extensions
- ProviderResult
- env
- StatusBarItem
- StatusBarAlignment
- WorkspaceConfiguration
- Location
- TreeItemCollapsibleState
- TreeItem
- Selection
- CompletionItem
- WorkspaceFolder
- TreeDataProvider
- TextEdit
- CompletionItemKind
- Command
- Hover
- WorkspaceEdit
- WebviewPanel
- Diagnostic
- DiagnosticSeverity
- ConfigurationTarget
- ProgressLocation
- ThemeColor
- TextEditorDecorationType
- TextDocumentChangeEvent
- CodeActionProvider
- HoverProvider
- ThemeIcon
- SnippetString
- CompletionList
- DecorationOptions
- RelativePattern
- DiagnosticCollection
- CompletionContext
- CompletionItemProvider
- CodeAction
- CodeActionKind
- InputBoxOptions
- ColorThemeKind
- ConfigurationChangeEvent
- FileSystemWatcher
- TextEditorEdit
- TextDocumentContentChangeEvent
- Extension
- CodeActionContext
- FileStat
- QuickPickOptions
- DocumentSymbol
- SymbolKind
- QuickInputButton
- Webview
- IndentAction
- debug
- FileSystemError
- TreeView
- TextEditorRevealType
- FileSystemProvider
- FileChangeEvent
- Memento
- Definition
- FormattingOptions
- DocumentFilter
- DecorationRenderOptions
- QuickPick
- WebviewView
- WebviewViewProvider
- DocumentHighlight
- DebugConfiguration
- Terminal
- FileType
- TextDocumentWillSaveEvent
- FileChangeType
- OpenDialogOptions
- DocumentSelector
- DefinitionProvider
- LocationLink
- TextDocumentShowOptions
- DecorationRangeBehavior
- OverviewRulerLane
- SignatureHelp
- SemanticTokens
- Progress
- DocumentFormattingEditProvider
- SemanticTokensBuilder
- WebviewViewResolveContext
- CustomDocument
- DebugSession
- CodeLens
- CodeLensProvider
- WebviewOptions
- WebviewPanelOptions
- FileRenameEvent
- TextDocumentSaveReason
- CancellationTokenSource
- CustomTextEditorProvider
- QuickPickItemKind
- DocumentLink
- DocumentHighlightKind
- FileDecoration
- FileDecorationProvider
- TextDocumentContentProvider
- GlobPattern
- FileDeleteEvent
- SaveDialogOptions
- SignatureInformation
- CompletionItemTag
- FileCreateEvent
- ReferenceContext
- SemanticTokensLegend
- TreeViewVisibilityChangeEvent
- QuickInput
- QuickInputButtons
- CustomReadonlyEditorProvider
- DiagnosticRelatedInformation
- DebugConfigurationProvider
- DebugAdapterExecutable
- DebugAdapterDescriptor
- DebugAdapterDescriptorFactory
- DebugAdapterServer
- FileSearchOptions
- FileSearchProvider
- FileSearchQuery
- TextSearchComplete
- TextSearchOptions
- TextSearchProvider
- TextSearchQuery
- TextSearchResult
- EndOfLine
- FileWillRenameEvent
- FoldingRangeKind
- MessageItem
- TextEditorVisibleRangesChangeEvent
- ColorTheme
- CustomEditorProvider
- CustomDocumentBackupContext
- CustomDocumentBackup
- CustomDocumentOpenContext
- CustomDocumentContentChangeEvent
- SymbolInformation
- DecorationInstanceRenderOptions
- DefinitionLink
- DocumentLinkProvider
- TerminalOptions
- CodeActionProviderMetadata
- MarkedString
- tasks
- Task
- TaskDefinition
- ShellExecution
- TaskGroup
- DocumentRangeFormattingEditProvider
- TaskScope
- TextEditorSelectionChangeKind
- RenameProvider
- TextLine
- WorkspaceFoldersChangeEvent
- TreeItemLabel
Other Related APIs
- path#join
- fs#existsSync
- fs#mkdirSync
- os#homedir
- os#platform
- vscode#window
- vscode#ProgressLocation
- vscode#Position
- vscode#Disposable
- vscode#CancellationToken
- vscode#FileSystemProvider
- vscode#Event
- vscode#FileStat
- vscode#FileChangeEvent
- vscode#EventEmitter
- vscode#FileType
- vscode#FileSystemError
- vscode#FileChangeType
- vscode#FileSearchOptions
- vscode#FileSearchProvider
- vscode#FileSearchQuery
vscode#Progress TypeScript Examples
The following examples show how to use
vscode#Progress.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: installSM.ts From sourcepawn-vscode with MIT License | 5 votes |
async function downloadSM(
progress: Progress<{ message?: string; increment?: number }>,
token: CancellationToken
): Promise<void> {
return new Promise<void>((resolve, reject) => {
let oldStatus: number = 0;
var src: string;
if (Platform === "win32") {
src = "http://sourcemod.net/latest.php?os=windows&version=1.10";
} else if (Platform === "darwin") {
src = "http://sourcemod.net/latest.php?os=mac&version=1.10";
} else {
src = "http://sourcemod.net/latest.php?os=linux&version=1.10";
}
const output = join(outputDir, "sm.gz");
const options = {
gunzip: false,
};
if (token.isCancellationRequested) {
return;
}
let download = wget.download(src, output, options);
download.on("error", function (err) {
console.log(err);
reject(err);
});
download.on("start", function (fileSize: number) {
console.log("filesize: ", Math.ceil(fileSize / Math.pow(10, 6)), "Mo");
});
download.on("end", async function (endStatus) {
console.log(endStatus);
progress.report({ message: "Unzipping..." });
await decompress(output, outputDir);
resolve(endStatus);
});
download.on("progress", function (status) {
if (typeof status === "number") {
status = Math.floor(status * 100);
let inc = status - oldStatus;
oldStatus = status;
progress.report({
message: "Downloading Sourcemod",
increment: inc,
});
}
});
token.onCancellationRequested(() => {
console.log("Sourcemod download was cancelled by the user.");
//TODO: Actually stop the download here. Might need a better NPM package...
});
});
}
Example #2
Source File: utopia-fs.ts From utopia with MIT License | 5 votes |
// TextSearchProvider
async provideTextSearchResults(
query: TextSearchQuery,
options: TextSearchOptions,
progress: Progress<TextSearchResult>,
token: CancellationToken,
): Promise<TextSearchComplete> {
// This appears to only be callable from the side bar that isn't available in Utopia
// TODO Support all search options
const { result: filePaths, limitHit } = await this.filterFilePaths(options.includes[0])
if (filePaths.length > 0) {
for (const filePath of filePaths) {
if (token.isCancellationRequested) {
break
}
const content = await readFileSavedContentAsUTF8(filePath)
const lines = splitIntoLines(content)
for (let i = 0; i < lines.length; i++) {
const line = lines[i]
const index = line.indexOf(query.pattern)
if (index !== -1) {
progress.report({
uri: toUtopiaURI(this.projectID, filePath),
ranges: new Range(
new Position(i, index),
new Position(i, index + query.pattern.length),
),
preview: {
text: line,
matches: new Range(
new Position(0, index),
new Position(0, index + query.pattern.length),
),
},
})
}
}
}
}
return { limitHit: limitHit }
}