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


TypeScript Disposable.dispose方法代碼示例

本文整理匯總了TypeScript中vscode.Disposable.dispose方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Disposable.dispose方法的具體用法?TypeScript Disposable.dispose怎麽用?TypeScript Disposable.dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vscode.Disposable的用法示例。


在下文中一共展示了Disposable.dispose方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: disposeHandlers

/**
 * Dispose formatters
 */
function disposeHandlers() {
    if (formatterHandler) {
        formatterHandler.dispose();
    }
    if (rangeFormatterHandler) {
        rangeFormatterHandler.dispose();
    }
    formatterHandler = undefined;
    rangeFormatterHandler = undefined;
}
開發者ID:JulioC,項目名稱:prettier-vscode,代碼行數:13,代碼來源:extension.ts

示例2: configurationChanged

	function configurationChanged() {
		let config = workspace.getConfiguration('tslint');
		let autoFix = config.get('autoFixOnSave', false);
		if (autoFix && !willSaveTextDocument) {
			willSaveTextDocument = workspace.onWillSaveTextDocument((event) => {
				let document = event.document;
				// only auto fix when the document was not auto saved
				if (!isTypeScriptDocument(document.languageId) || event.reason === TextDocumentSaveReason.AfterDelay) {
					return;
				}
				const version = document.version;
				event.waitUntil(
					client.sendRequest(AllFixesRequest.type, { textDocument: { uri: document.uri.toString() } }).then((result) => {
						if (result && version === result.documentVersion) {
							return Protocol2Code.asTextEdits(result.edits);
						} else {
							return [];
						}
					})
				);
			});
		} else if (!autoFix && willSaveTextDocument) {
			willSaveTextDocument.dispose();
			willSaveTextDocument = undefined;
		}
	}
開發者ID:ericanderson,項目名稱:vscode-tslint,代碼行數:26,代碼來源:extension.ts

示例3: onPanelDisposed

  private onPanelDisposed() {
    if (this.disposablePanel) {
      this.disposablePanel.dispose();
    }

    this.panel = undefined;
  }
開發者ID:Manu-sh,項目名稱:dotfiles,代碼行數:7,代碼來源:Webview.ts

示例4: dispose

    /**
     * Disposes the object.
     */
    public dispose(): any
    {
        if (this.disposable !== undefined)
        {
            this.disposable.dispose();
        }

        super.dispose();
    }
開發者ID:Janne252,項目名稱:vscode-scar,代碼行數:12,代碼來源:commandBase.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() {
        this._disposable && this._disposable.dispose();
        if (this._host !== undefined) {
            this._host.dispose();
        }

        if (this._guest !== undefined) {
            this._guest.dispose();
        }
    }
開發者ID:chrisleaman,項目名稱:vscode-gitlens,代碼行數:10,代碼來源:vsls.ts

示例7: updateConfiguration

	public updateConfiguration(): void {
		const config = workspace.getConfiguration(this.modeId);
		this.formattingProvider.updateConfiguration(config);

		if (!this.formattingProvider.isEnabled() && this.formattingProviderRegistration) {
			this.formattingProviderRegistration.dispose();
			this.formattingProviderRegistration = undefined;
		} else if (this.formattingProvider.isEnabled() && !this.formattingProviderRegistration) {
			this.formattingProviderRegistration = languages.registerDocumentRangeFormattingEditProvider(this.selector, this.formattingProvider);
		}
	}
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:11,代碼來源:formattingProvider.ts

示例8: configurationChanged

	private configurationChanged(): void {
		let config = workspace.getConfiguration(this.id);
		this.updateValidate(config.get(validateSetting, true));
		if (this.completionItemProvider) {
			this.completionItemProvider.updateConfiguration(config);
		}
		if (this.formattingProvider) {
			this.formattingProvider.updateConfiguration(config);
			if (!this.formattingProvider.isEnabled() && this.formattingProviderRegistration) {
				this.formattingProviderRegistration.dispose();
				this.formattingProviderRegistration = null;

			} else if (this.formattingProvider.isEnabled() && !this.formattingProviderRegistration) {
				this.formattingProviderRegistration = languages.registerDocumentRangeFormattingEditProvider(this.description.modeIds, this.formattingProvider);
			}
		}
	}
開發者ID:sandy081,項目名稱:vscode,代碼行數:17,代碼來源:typescriptMain.ts

示例9: initFoldingProvider

	function initFoldingProvider() {
		let enable = workspace.getConfiguration().get(foldingSetting);
		if (enable) {
			if (!foldingProviderRegistration) {
				foldingProviderRegistration = languages.registerFoldingProvider(documentSelector, {
					provideFoldingRanges(document: TextDocument) {
						return client.sendRequest(FoldingRangesRequest.type, { textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) }).then(res => {
							if (res && Array.isArray(res.ranges)) {
								return new FoldingRangeList(res.ranges.map(r => new FoldingRange(r.startLine, r.endLine, r.type)));
							}
							return null;
						});
					}
				});
			}
		} else {
			if (foldingProviderRegistration) {
				foldingProviderRegistration.dispose();
				foldingProviderRegistration = void 0;
			}
		}
	}
開發者ID:sameer-coder,項目名稱:vscode,代碼行數:22,代碼來源:jsonMain.ts

示例10: deactivate

export function deactivate() {
	if (willSaveTextDocument) {
		willSaveTextDocument.dispose();
		willSaveTextDocument = undefined;
	}
}
開發者ID:ericanderson,項目名稱:vscode-tslint,代碼行數:6,代碼來源:extension.ts


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