Change:
We have few usages of . This isn't ideal because the consumer of the token can subscribe to the token and its lifecycle must be managed by the token source, e.g its -function. For never-cancel cases should be used. These are today bogous usages, please fix

Discussion:
*  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ <del> import { CancellationTokenSource } from 'vs/base/common/cancellation'; </del> <ins> import { CancellationToken } from 'vs/base/common/cancellation'; </ins> import { DisposableMap, IDisposable } from 'vs/base/common/lifecycle'; import { URI, UriComponents } from 'vs/base/common/uri'; import { ExtHostContext, ExtHostQuickDiffShape, IDocumentFilterDto, MainContext, MainThreadQuickDiffShape } from 'vs/workbench/api/common/extHost.protocol';

selector, isSCM: false, getOriginalResource: async (uri: URI) => { <del> return URI.revive(await this.proxy.$provideOriginalResource(handle, uri, new CancellationTokenSource().token)); </del> <ins> return URI.revive(await this.proxy.$provideOriginalResource(handle, uri, CancellationToken.None)); </ins> } }; const disposable = this.quickDiffService.addQuickDiffProvider(provider);

*  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ <del> import { CancellationTokenSource } from 'vs/base/common/cancellation'; </del> <ins> import { CancellationToken } from 'vs/base/common/cancellation'; </ins> import { Emitter } from 'vs/base/common/event'; import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import * as nls from 'vs/nls';

throw new Error('A tunnel provider has already been registered. Only the first tunnel provider to be registered will be used.'); } this._forwardPortProvider = async (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions) => { <del> const result = await provider.provideTunnel(tunnelOptions, tunnelCreationOptions, new CancellationTokenSource().token); </del> <ins> const result = await provider.provideTunnel(tunnelOptions, tunnelCreationOptions, CancellationToken.None); </ins> return result ?? undefined; };

let command = element?.command; if (element && !command) { if ((element instanceof ResolvableTreeItem) && element.hasResolve) { <del> await element.resolve(new CancellationTokenSource().token); </del> <ins> await element.resolve(CancellationToken.None); </ins> command = element.command; } }

import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems'; import { copyAddressIcon, forwardedPortWithoutProcessIcon, forwardedPortWithProcessIcon, forwardPortIcon, labelPortIcon, openBrowserIcon, openPreviewIcon, portsViewIcon, privatePortIcon, stopForwardIcon } from 'vs/workbench/contrib/remote/browser/remoteIcons'; import { IExternalUriOpenerService } from 'vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService'; <del> import { CancellationTokenSource } from 'vs/base/common/cancellation'; </del> <ins> import { CancellationToken } from 'vs/base/common/cancellation'; </ins> import { isMacintosh } from 'vs/base/common/platform'; import { ITableColumn, ITableContextMenuEvent, ITableEvent, ITableMouseEvent, ITableRenderer, ITableVirtualDelegate } from 'vs/base/browser/ui/table/table'; import { WorkbenchTable } from 'vs/platform/list/browser/listService';

if (tunnel) { const remoteHost = tunnel.remoteHost.includes(':') ? `[${tunnel.remoteHost}]` : tunnel.remoteHost; const sourceUri = URI.parse(`http://${remoteHost}:${tunnel.remotePort}`); <del> const opener = await externalOpenerService.getOpener(tunnel.localUri, { sourceUri }, new CancellationTokenSource().token); </del> <ins> const opener = await externalOpenerService.getOpener(tunnel.localUri, { sourceUri }, CancellationToken.None); </ins> if (opener) { <del> return opener.openExternalUri(tunnel.localUri, { sourceUri }, new CancellationTokenSource().token); </del> <ins> return opener.openExternalUri(tunnel.localUri, { sourceUri }, CancellationToken.None); </ins> } return openerService.open(tunnel.localUri); }

import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; <del> import { CancellationTokenSource } from 'vs/base/common/cancellation'; </del> <ins> import { CancellationToken } from 'vs/base/common/cancellation'; </ins> import { isNumber, isObject, isString } from 'vs/base/common/types'; import { deepClone } from 'vs/base/common/objects'; import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';

const portGroup = entry[1]; const matchingCandidate = matchingCandidates.get(portGroup[0]); return provider.providePortAttributes(portGroup, <del> matchingCandidate?.pid, matchingCandidate?.detail, new CancellationTokenSource().token); </del> <ins> matchingCandidate?.pid, matchingCandidate?.detail, CancellationToken.None); </ins> }); }))); const providedAttributes: Map<number, ProvidedPortAttributes> = new Map();