当前位置: 首页>>代码示例>>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;未经允许,请勿转载。