本文整理汇总了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;
}
示例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;
}
}
示例3: onPanelDisposed
private onPanelDisposed() {
if (this.disposablePanel) {
this.disposablePanel.dispose();
}
this.panel = undefined;
}
示例4: dispose
/**
* Disposes the object.
*/
public dispose(): any
{
if (this.disposable !== undefined)
{
this.disposable.dispose();
}
super.dispose();
}
示例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() {
this._disposable && this._disposable.dispose();
if (this._host !== undefined) {
this._host.dispose();
}
if (this._guest !== undefined) {
this._guest.dispose();
}
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
}
}
示例10: deactivate
export function deactivate() {
if (willSaveTextDocument) {
willSaveTextDocument.dispose();
willSaveTextDocument = undefined;
}
}