本文整理匯總了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;
}
}