本文整理匯總了TypeScript中vscode.StatusBarItem類的典型用法代碼示例。如果您正苦於以下問題:TypeScript StatusBarItem類的具體用法?TypeScript StatusBarItem怎麽用?TypeScript StatusBarItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了StatusBarItem類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: updateWordCount
public updateWordCount() {
// Create as needed
if (!this._statusBarItem) {
this._statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
}
// Get the current text editor
let editor = window.activeTextEditor;
if (!editor) {
this._statusBarItem.hide();
return;
}
let doc = editor.document;
// Only update status if an MD file
if (doc.languageId === "markdown") {
let wordCount = this._getWordCount(doc);
// Update the status bar
this._statusBarItem.text = wordCount !== 1 ? `$(pencil) ${wordCount} Words` : '$(pencil) 1 Word';
this._statusBarItem.show();
} else {
this._statusBarItem.hide();
}
}
示例2: initializeStatusBars
//Set up the initial status bars
private initializeStatusBars() {
if (this.ensureInitialized()) {
this._teamServicesStatusBarItem.command = CommandNames.OpenTeamSite;
this._teamServicesStatusBarItem.text = this._serverContext.RepoInfo.TeamProject;
this._teamServicesStatusBarItem.tooltip = Strings.NavigateToTeamServicesWebSite;
this._teamServicesStatusBarItem.show();
this._pullRequestStatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left, 99);
this._pullRequestStatusBarItem.command = CommandNames.GetPullRequests;
this._pullRequestStatusBarItem.text = GitClient.GetPullRequestStatusText(0);
this._pullRequestStatusBarItem.tooltip = Strings.BrowseYourPullRequests;
this._pullRequestStatusBarItem.show();
this._buildStatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left, 98);
this._buildStatusBarItem.command = CommandNames.OpenBuildSummaryPage;
this._buildStatusBarItem.text = `$(icon octicon-package) ` + `$(icon octicon-dash)`;
this._buildStatusBarItem.tooltip = Strings.NoBuildsFound;
this._buildStatusBarItem.show();
this._pinnedQueryStatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left, 97);
this._pinnedQueryStatusBarItem.command = CommandNames.ViewPinnedQueryWorkItems;
this._pinnedQueryStatusBarItem.text = WitClient.GetPinnedQueryStatusText(0);
this._pinnedQueryStatusBarItem.tooltip = Strings.ViewYourPinnedQuery;
this._pinnedQueryStatusBarItem.show();
}
}
示例3: updateWordCount
public updateWordCount() {
// Create as needed
if (!this._statusBarItem) {
this._statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
}
// Get the current text editor
let editor = window.activeTextEditor;
if (!editor) {
this._statusBarItem.hide();
return;
}
let doc = editor.document;
// Only update status if an MD file
if (doc.languageId === "yaml") {
let wordCount = this._getHints(doc, editor);
if (wordCount == null) {
editor.setDecorations(smallNumberDecorationType, []);
this._statusBarItem.hide();
} else {
editor.setDecorations(smallNumberDecorationType, wordCount);
this._statusBarItem.show();
this._statusBarItem.text = "Run tests";
}
} else {
this._statusBarItem.hide();
}
}
示例4: removeStatusBarItem
function removeStatusBarItem() {
if (statusBarItem) {
statusBarItem.hide();
statusBarItem.dispose();
statusBarItem = null;
}
isStatusBarVisible = false;
}
示例5: dispose
dispose() {
this.clearBlame();
this._blameStatusBarItem && this._blameStatusBarItem.dispose();
this._modeStatusBarItem && this._modeStatusBarItem.dispose();
Container.lineTracker.stop(this);
this._disposable && this._disposable.dispose();
}
示例6: dispose
dispose() {
if (this._pullRequestStatusBarItem !== undefined) {
this._pullRequestStatusBarItem.dispose();
}
if (this._teamServicesStatusBarItem !== undefined) {
this._teamServicesStatusBarItem.dispose();
}
if (this._buildStatusBarItem !== undefined) {
this._buildStatusBarItem.dispose();
}
}
示例7: hide
public hide(): void {
if (this.interval !== undefined) {
clearInterval(this.interval);
this.interval = undefined;
}
this.stopStatusBarItem.hide();
this.spinnerStatusBarItem.hide();
}
示例8: updateStatus
function updateStatus(status: StatusBarItem): void {
const info = getEditorInfo();
status.text = info ? info.text : void 0;
status.tooltip = info ? info.tooltip : void 0;
status.color = info ? info.color : void 0;
if (info) {
status.show();
} else {
status.hide();
}
}
示例9: updateStatus
function updateStatus(status: StatusBarItem): void {
let text = getSelectedLines();
if (text) {
status.text = '$(megaphone) ' + text;
}
if (text) {
status.show();
} else {
status.hide();
}
}
示例10: show
public show(): void {
this.stopStatusBarItem.show();
this.spinnerStatusBarItem.show();
const spinner = elegantSpinner();
const update = () => {
this.spinnerStatusBarItem.text = spinner();
};
this.interval = setInterval(update, 100);
}