當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vscode.StatusBarItem類代碼示例

本文整理匯總了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();
        }
    }
開發者ID:Osuka-Andala,項目名稱:vscode-wordcount,代碼行數:27,代碼來源:extension.ts

示例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();
        }
    }
開發者ID:chrisdias,項目名稱:vsts-vscode,代碼行數:27,代碼來源:team-extension.ts

示例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();
    }
  }
開發者ID:mulesoft-labs,項目名稱:http-bat-vscode,代碼行數:33,代碼來源:extension.ts

示例4: removeStatusBarItem

function removeStatusBarItem() {
    if (statusBarItem) {
        statusBarItem.hide();
        statusBarItem.dispose();
        statusBarItem = null;
    }
    isStatusBarVisible = false;
}
開發者ID:rid9,項目名稱:DateTime,代碼行數:8,代碼來源:extension.ts

示例5: dispose

    dispose() {
        this.clearBlame();

        this._blameStatusBarItem && this._blameStatusBarItem.dispose();
        this._modeStatusBarItem && this._modeStatusBarItem.dispose();

        Container.lineTracker.stop(this);
        this._disposable && this._disposable.dispose();
    }
開發者ID:chrisleaman,項目名稱:vscode-gitlens,代碼行數:9,代碼來源:statusBarController.ts

示例6: dispose

 dispose() {
     if (this._pullRequestStatusBarItem !== undefined) {
         this._pullRequestStatusBarItem.dispose();
     }
     if (this._teamServicesStatusBarItem !== undefined) {
         this._teamServicesStatusBarItem.dispose();
     }
     if (this._buildStatusBarItem !== undefined) {
         this._buildStatusBarItem.dispose();
     }
 }
開發者ID:buckh,項目名稱:vsts-vscode,代碼行數:11,代碼來源:team-extension.ts

示例7: hide

    public hide(): void {
        if (this.interval !== undefined) {
            clearInterval(this.interval);

            this.interval = undefined;
        }

        this.stopStatusBarItem.hide();

        this.spinnerStatusBarItem.hide();
    }
開發者ID:KalitaAlexey,項目名稱:RustyCode,代碼行數:11,代碼來源:output_channel_task_status_bar_item.ts

示例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();
    }
}
開發者ID:voodoos,項目名稱:vscode-extension-samples,代碼行數:12,代碼來源:extension.ts

示例9: updateStatus

function updateStatus(status: StatusBarItem): void {
	let text = getSelectedLines();
	if (text) {
		status.text = '$(megaphone) ' + text;
	}

	if (text) {
		status.show();
	} else {
		status.hide();
	}
}
開發者ID:rlugojr,項目名稱:vscode-extension-samples,代碼行數:12,代碼來源:extension.ts

示例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);
    }
開發者ID:KalitaAlexey,項目名稱:RustyCode,代碼行數:13,代碼來源:output_channel_task_status_bar_item.ts


注:本文中的vscode.StatusBarItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。