diff --git a/build/lib/electron.ts b/build/lib/electron.ts index 7a2a2a19557..da2387f68f6 100644 --- a/build/lib/electron.ts +++ b/build/lib/electron.ts @@ -93,7 +93,7 @@ function darwinBundleDocumentTypes(types: { [name: string]: string | string[] }, ostypes: ['TEXT', 'utxt', 'TUTX', '****'], extensions: Array.isArray(extensions) ? extensions : [extensions], iconFile: 'resources/darwin/' + icon + '.icns' - } as DarwinDocumentType; + }; }); } diff --git a/build/lib/nls.ts b/build/lib/nls.ts index 4600fe43dc2..cac832903a3 100644 --- a/build/lib/nls.ts +++ b/build/lib/nls.ts @@ -42,7 +42,7 @@ function collect(ts: typeof import('typescript'), node: ts.Node, fn: (node: ts.N } function clone(object: T): T { - const result = {}; + const result = {} as any as T; for (const id in object) { result[id] = object[id]; } diff --git a/extensions/debug-auto-launch/src/extension.ts b/extensions/debug-auto-launch/src/extension.ts index d947d4eb8b0..7d06c56d47f 100644 --- a/extensions/debug-auto-launch/src/extension.ts +++ b/extensions/debug-auto-launch/src/extension.ts @@ -283,7 +283,7 @@ async function destroyAttachServer() { interface CachedIpcState { ipcAddress: string; - jsDebugPath: string; + jsDebugPath: string | undefined; settingsValue: string; } @@ -388,7 +388,7 @@ async function getIpcAddress(context: vscode.ExtensionContext) { ipcAddress, jsDebugPath, settingsValue, - } as CachedIpcState); + } satisfies CachedIpcState); return ipcAddress; } diff --git a/extensions/git/src/operation.ts b/extensions/git/src/operation.ts index d960cedfdbb..5d3fe6f36c4 100644 --- a/extensions/git/src/operation.ts +++ b/extensions/git/src/operation.ts @@ -131,7 +131,7 @@ export type SyncOperation = BaseOperation & { kind: OperationKind.Sync }; export type TagOperation = BaseOperation & { kind: OperationKind.Tag }; export const Operation = { - Add: (showProgress: boolean) => ({ kind: OperationKind.Add, blocking: false, readOnly: false, remote: false, retry: false, showProgress } as AddOperation), + Add: (showProgress: boolean): AddOperation => ({ kind: OperationKind.Add, blocking: false, readOnly: false, remote: false, retry: false, showProgress }), Apply: { kind: OperationKind.Apply, blocking: false, readOnly: false, remote: false, retry: false, showProgress: true } as ApplyOperation, Blame: { kind: OperationKind.Blame, blocking: false, readOnly: true, remote: false, retry: false, showProgress: true } as BlameOperation, Branch: { kind: OperationKind.Branch, blocking: false, readOnly: false, remote: false, retry: false, showProgress: true } as BranchOperation, diff --git a/extensions/html-language-features/server/src/modes/languageModes.ts b/extensions/html-language-features/server/src/modes/languageModes.ts index 4ab4a4a876e..803fa6c1c87 100644 --- a/extensions/html-language-features/server/src/modes/languageModes.ts +++ b/extensions/html-language-features/server/src/modes/languageModes.ts @@ -138,8 +138,8 @@ export function getLanguageModes(supportedLanguages: { [languageId: string]: boo return undefined; }, getModesInRange(document: TextDocument, range: Range): LanguageModeRange[] { - return documentRegions.get(document).getLanguageRanges(range).map(r => { - return { + return documentRegions.get(document).getLanguageRanges(range).map((r): LanguageModeRange => { + return { start: r.start, end: r.end, mode: r.languageId && modes[r.languageId], diff --git a/extensions/ipynb/src/ipynbMain.ts b/extensions/ipynb/src/ipynbMain.ts index 5dc9098a99d..1029268a2ac 100644 --- a/extensions/ipynb/src/ipynbMain.ts +++ b/extensions/ipynb/src/ipynbMain.ts @@ -28,9 +28,12 @@ type NotebookMetadata = { [propName: string]: unknown; }; +type OptionsWithCellContentMetadata = vscode.NotebookDocumentContentOptions & { cellContentMetadata: { attachments: boolean } }; + + export function activate(context: vscode.ExtensionContext, serializer: vscode.NotebookSerializer) { keepNotebookModelStoreInSync(context); - context.subscriptions.push(vscode.workspace.registerNotebookSerializer('jupyter-notebook', serializer, { + const notebookSerializerOptions: OptionsWithCellContentMetadata = { transientOutputs: false, transientCellMetadata: { breakpointMargin: true, @@ -41,9 +44,10 @@ export function activate(context: vscode.ExtensionContext, serializer: vscode.No cellContentMetadata: { attachments: true } - } as vscode.NotebookDocumentContentOptions)); + }; + context.subscriptions.push(vscode.workspace.registerNotebookSerializer('jupyter-notebook', serializer, notebookSerializerOptions)); - context.subscriptions.push(vscode.workspace.registerNotebookSerializer('interactive', serializer, { + const interactiveSerializeOptions: OptionsWithCellContentMetadata = { transientOutputs: false, transientCellMetadata: { breakpointMargin: true, @@ -54,7 +58,8 @@ export function activate(context: vscode.ExtensionContext, serializer: vscode.No cellContentMetadata: { attachments: true } - } as vscode.NotebookDocumentContentOptions)); + }; + context.subscriptions.push(vscode.workspace.registerNotebookSerializer('interactive', serializer, interactiveSerializeOptions)); vscode.languages.registerCodeLensProvider({ pattern: '**/*.ipynb' }, { provideCodeLenses: (document) => { @@ -116,10 +121,10 @@ export function activate(context: vscode.ExtensionContext, serializer: vscode.No const edit = new vscode.WorkspaceEdit(); edit.set(resource, [vscode.NotebookEdit.updateNotebookMetadata({ ...document.metadata, - metadata: { + metadata: { ...(document.metadata.metadata ?? {}), ...metadata - }, + } satisfies NotebookMetadata, })]); return vscode.workspace.applyEdit(edit); }, diff --git a/extensions/ipynb/src/serializers.ts b/extensions/ipynb/src/serializers.ts index e1896ee3be1..33de79f41a6 100644 --- a/extensions/ipynb/src/serializers.ts +++ b/extensions/ipynb/src/serializers.ts @@ -379,10 +379,10 @@ export function createMarkdownCellFromNotebookCell(cell: NotebookCellData): nbfo export function pruneCell(cell: nbformat.ICell): nbformat.ICell { // Source is usually a single string on input. Convert back to an array - const result = { + const result: nbformat.ICell = { ...cell, source: splitMultilineString(cell.source) - } as nbformat.ICell; + }; // Remove outputs and execution_count from non code cells if (result.cell_type !== 'code') { diff --git a/extensions/json-language-features/client/src/languageStatus.ts b/extensions/json-language-features/client/src/languageStatus.ts index 4aead6f99f2..e295d72b117 100644 --- a/extensions/json-language-features/client/src/languageStatus.ts +++ b/extensions/json-language-features/client/src/languageStatus.ts @@ -198,7 +198,7 @@ export function createLanguageStatusItem(documentSelector: DocumentSelector, sta statusItem.command = { command: '_json.showAssociatedSchemaList', title: l10n.t('Show Schemas'), - arguments: [{ schemas, uri: document.uri.toString() } as ShowSchemasInput] + arguments: [{ schemas, uri: document.uri.toString() } satisfies ShowSchemasInput] }; } catch (e) { statusItem.text = l10n.t('Unable to compute used schemas: {0}', e.message); diff --git a/extensions/markdown-language-features/src/util/openDocumentLink.ts b/extensions/markdown-language-features/src/util/openDocumentLink.ts index 4fc423d3675..285dd91029b 100644 --- a/extensions/markdown-language-features/src/util/openDocumentLink.ts +++ b/extensions/markdown-language-features/src/util/openDocumentLink.ts @@ -49,10 +49,10 @@ export class MdLinkOpener { } } - return vscode.commands.executeCommand('vscode.open', uri, { + return vscode.commands.executeCommand('vscode.open', uri, { selection: resolved.position ? new vscode.Range(resolved.position.line, resolved.position.character, resolved.position.line, resolved.position.character) : undefined, viewColumn: viewColumn ?? getViewColumn(fromResource), - }); + } satisfies vscode.TextDocumentShowOptions); } } } diff --git a/extensions/npm/src/npmView.ts b/extensions/npm/src/npmView.ts index 38768b47710..e041b43f091 100644 --- a/extensions/npm/src/npmView.ts +++ b/extensions/npm/src/npmView.ts @@ -91,9 +91,11 @@ class NpmScript extends TreeItem { command: 'vscode.open', arguments: [ this.taskLocation?.uri, - this.taskLocation ? { - selection: new Range(this.taskLocation.range.start, this.taskLocation.range.start) - } : undefined + this.taskLocation ? + { + selection: new Range(this.taskLocation.range.start, this.taskLocation.range.start) + } satisfies TextDocumentShowOptions + : undefined ] }, 'run': { diff --git a/extensions/references-view/src/references/model.ts b/extensions/references-view/src/references/model.ts index 33b5c497f1e..e6c4e23ab93 100644 --- a/extensions/references-view/src/references/model.ts +++ b/extensions/references-view/src/references/model.ts @@ -20,7 +20,7 @@ export class ReferencesTreeInput implements SymbolTreeInput | undefined> { let model: ReferencesModel; if (this._result) { @@ -35,8 +35,7 @@ export class ReferencesTreeInput implements SymbolTreeInput>{ + return { provider, get message() { return model.message; }, navigation: model, @@ -302,7 +301,7 @@ class ReferencesTreeDataProvider implements vscode.TreeDataProvider{ selection: range.with({ end: range.start }) } + { selection: range.with({ end: range.start }) } satisfies vscode.TextDocumentShowOptions ] }; return result; diff --git a/extensions/references-view/src/tree.ts b/extensions/references-view/src/tree.ts index 9432fd2a80f..4a6bf189675 100644 --- a/extensions/references-view/src/tree.ts +++ b/extensions/references-view/src/tree.ts @@ -276,11 +276,11 @@ class TreeInputHistory implements vscode.TreeDataProvider { item: HistoryItem; } const entries = await this.getChildren(); - const picks = entries.map(item => { + const picks = entries.map((item): HistoryPick => ({ label: item.word, description: item.description, item - }); + })); const pick = await vscode.window.showQuickPick(picks, { placeHolder: vscode.l10n.t('Select previous reference search') }); if (pick) { this._reRunHistoryItem(pick.item); diff --git a/extensions/references-view/src/types/model.ts b/extensions/references-view/src/types/model.ts index 89dd001df55..623c41c8d5f 100644 --- a/extensions/references-view/src/types/model.ts +++ b/extensions/references-view/src/types/model.ts @@ -177,7 +177,7 @@ class TypeItemDataProvider implements vscode.TreeDataProvider { title: vscode.l10n.t('Open Type'), arguments: [ element.item.uri, - { selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) } + { selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) } satisfies vscode.TextDocumentShowOptions ] }; item.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed; diff --git a/src/vs/editor/browser/widget/diffEditor/utils.ts b/src/vs/editor/browser/widget/diffEditor/utils.ts index b69c5ff8f8c..d34d60fd457 100644 --- a/src/vs/editor/browser/widget/diffEditor/utils.ts +++ b/src/vs/editor/browser/widget/diffEditor/utils.ts @@ -179,7 +179,7 @@ function easeOutExpo(t: number, b: number, c: number, d: number): number { } export function deepMerge(source1: T, source2: Partial): T { - const result = {} as T; + const result = {} as any as T; for (const key in source1) { result[key] = source1[key]; } diff --git a/src/vs/editor/contrib/inlineCompletions/browser/model/inlineEditsAdapter.ts b/src/vs/editor/contrib/inlineCompletions/browser/model/inlineEditsAdapter.ts index ad131e62b4c..c03fb7bfa61 100644 --- a/src/vs/editor/contrib/inlineCompletions/browser/model/inlineEditsAdapter.ts +++ b/src/vs/editor/contrib/inlineCompletions/browser/model/inlineEditsAdapter.ts @@ -3,13 +3,16 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { CancellationToken } from '../../../../../base/common/cancellation.js'; import { Disposable } from '../../../../../base/common/lifecycle.js'; import { autorunWithStore, observableSignalFromEvent } from '../../../../../base/common/observable.js'; import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js'; import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js'; import { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js'; import { ICodeEditor } from '../../../../browser/editorBrowser.js'; -import { IInlineEdit, InlineCompletions, InlineCompletionsProvider, InlineEditProvider, InlineEditTriggerKind } from '../../../../common/languages.js'; +import { Position } from '../../../../common/core/position.js'; +import { IInlineEdit, InlineCompletionContext, InlineCompletions, InlineCompletionsProvider, InlineEditProvider, InlineEditTriggerKind } from '../../../../common/languages.js'; +import { ITextModel } from '../../../../common/model.js'; import { ILanguageFeaturesService } from '../../../../common/services/languageFeatures.js'; export class InlineEditsAdapterContribution extends Disposable { @@ -45,8 +48,15 @@ export class InlineEditsAdapter extends Disposable { if (!this._inlineCompletionInlineEdits.read(reader)) { return; } didChangeSignal.read(reader); - store.add(this._languageFeaturesService.inlineCompletionsProvider.register('*', { - provideInlineCompletions: async (model, position, context, token) => { + type InlineCompletionsAndEdits = InlineCompletions & { + edits: { + result: IInlineEdit; + provider: InlineEditProvider; + }[]; + }; + + store.add(this._languageFeaturesService.inlineCompletionsProvider.register('*', new class implements InlineCompletionsProvider { + async provideInlineCompletions(model: ITextModel, position: Position, context: InlineCompletionContext, token: CancellationToken): Promise { const allInlineEditProvider = _languageFeaturesService.inlineEditProvider.all(model); const inlineEdits = await Promise.all(allInlineEditProvider.map(async provider => { const result = await provider.provideInlineEdit(model, { @@ -68,13 +78,13 @@ export class InlineEditsAdapter extends Disposable { }; }), }; - }, - freeInlineCompletions: (c) => { + } + freeInlineCompletions(c: InlineCompletionsAndEdits) { for (const e of c.edits) { e.provider.freeInlineEdit(e.result); } - }, - } as InlineCompletionsProvider }[] }>)); + } + })); })); } } diff --git a/src/vs/editor/standalone/browser/standaloneWebWorker.ts b/src/vs/editor/standalone/browser/standaloneWebWorker.ts index 5f1d0947c94..bd557c7bbcb 100644 --- a/src/vs/editor/standalone/browser/standaloneWebWorker.ts +++ b/src/vs/editor/standalone/browser/standaloneWebWorker.ts @@ -113,7 +113,7 @@ class MonacoWebWorkerImpl extends EditorWorkerClient implement }; }; - const foreignProxy = {} as T; + const foreignProxy = {} as any as T; for (const foreignMethod of foreignMethods) { (foreignProxy)[foreignMethod] = createProxyMethod(foreignMethod, proxyMethodRequest); } diff --git a/src/vs/platform/issue/electron-main/issueMainService.ts b/src/vs/platform/issue/electron-main/issueMainService.ts index 7d1c7d5e8ac..5be83d34d22 100644 --- a/src/vs/platform/issue/electron-main/issueMainService.ts +++ b/src/vs/platform/issue/electron-main/issueMainService.ts @@ -203,7 +203,7 @@ export class IssueMainService implements IIssueMainService { } private createBrowserWindow(position: IWindowState, ipcObjectUrl: IIPCObjectUrl, options: IBrowserWindowOptions, windowKind: string): BrowserWindow { - const window = new BrowserWindow({ + const windowOptions: BrowserWindowConstructorOptions & { experimentalDarkMode: boolean } = { fullscreen: false, skipTaskbar: false, resizable: true, @@ -226,7 +226,8 @@ export class IssueMainService implements IIssueMainService { }, alwaysOnTop: options.alwaysOnTop, experimentalDarkMode: true - } as BrowserWindowConstructorOptions & { experimentalDarkMode: boolean }); + }; + const window = new BrowserWindow(windowOptions); window.setMenuBarVisibility(false); diff --git a/src/vs/platform/quickinput/browser/quickPickPin.ts b/src/vs/platform/quickinput/browser/quickPickPin.ts index e7c2cb9adbc..3d5b87e6e65 100644 --- a/src/vs/platform/quickinput/browser/quickPickPin.ts +++ b/src/vs/platform/quickinput/browser/quickPickPin.ts @@ -60,7 +60,7 @@ function _formatPinnedItems(storageKey: string, quickPick: IQuickPick itemsMatch(item, itemToFind)); if (itemToPin) { const pinnedItemId = getItemIdentifier(itemToPin); - const pinnedItem: IQuickPickItem = Object.assign({} as IQuickPickItem, itemToPin); + const pinnedItem: IQuickPickItem = { ...(itemToPin as IQuickPickItem) }; if (!filterDuplicates || !pinnedIds.has(pinnedItemId)) { pinnedIds.add(pinnedItemId); updateButtons(pinnedItem, false); diff --git a/src/vs/platform/quickinput/common/quickAccess.ts b/src/vs/platform/quickinput/common/quickAccess.ts index ad4a674c5df..02801eac797 100644 --- a/src/vs/platform/quickinput/common/quickAccess.ts +++ b/src/vs/platform/quickinput/common/quickAccess.ts @@ -6,7 +6,7 @@ import { coalesce } from '../../../base/common/arrays.js'; import { CancellationToken } from '../../../base/common/cancellation.js'; import { IDisposable, toDisposable } from '../../../base/common/lifecycle.js'; -import { ItemActivation, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, QuickPickItem } from './quickInput.js'; +import { ItemActivation, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, QuickPickItem, IQuickPickSeparator } from './quickInput.js'; import { Registry } from '../../registry/common/platform.js'; /** @@ -29,7 +29,7 @@ export interface IQuickAccessProviderRunOptions { */ export interface AnythingQuickAccessProviderRunOptions extends IQuickAccessProviderRunOptions { readonly includeHelp?: boolean; - readonly filter?: (item: unknown) => boolean; + readonly filter?: (item: IQuickPickItem | IQuickPickSeparator) => boolean; /** * @deprecated - temporary for Dynamic Chat Variables (see usage) until it has built-in UX for file picking * Useful for adding items to the top of the list that might contain actions. diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts b/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts index 76e6ba6e7e1..d0ed55141ca 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts @@ -18,7 +18,7 @@ import { URI } from '../../../../base/common/uri.js'; import { IEditorConstructionOptions } from '../../../../editor/browser/config/editorConfiguration.js'; import { EditorExtensionsRegistry } from '../../../../editor/browser/editorExtensions.js'; import { CodeEditorWidget, ICodeEditorWidgetOptions } from '../../../../editor/browser/widget/codeEditor/codeEditorWidget.js'; -import { Position } from '../../../../editor/common/core/position.js'; +import { IPosition, Position } from '../../../../editor/common/core/position.js'; import { ITextModel } from '../../../../editor/common/model.js'; import { IModelService } from '../../../../editor/common/services/model.js'; import { AccessibilityHelpNLS } from '../../../../editor/common/standaloneStrings.js'; @@ -266,7 +266,7 @@ export class AccessibleView extends Disposable implements ITextModelContentProvi this.show(this._lastProvider); } - show(provider?: AccesibleViewContentProvider, symbol?: IAccessibleViewSymbol, showAccessibleViewHelp?: boolean, position?: Position): void { + show(provider?: AccesibleViewContentProvider, symbol?: IAccessibleViewSymbol, showAccessibleViewHelp?: boolean, position?: IPosition): void { provider = provider ?? this._currentProvider; if (!provider) { return; @@ -495,7 +495,7 @@ export class AccessibleView extends Disposable implements ITextModelContentProvi if (lineNumber === undefined) { return; } - this.show(provider, undefined, undefined, { lineNumber, column: 1 } as Position); + this.show(provider, undefined, undefined, { lineNumber, column: 1 }); this._updateContextKeys(provider, true); } diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts index efa5e7a30e7..04ad32764b3 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts @@ -21,7 +21,7 @@ import { ICommandService } from '../../../../../platform/commands/common/command import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js'; import { KeybindingWeight } from '../../../../../platform/keybinding/common/keybindingsRegistry.js'; import { AnythingQuickAccessProviderRunOptions } from '../../../../../platform/quickinput/common/quickAccess.js'; -import { IQuickInputService, IQuickPickItem, QuickPickItem } from '../../../../../platform/quickinput/common/quickInput.js'; +import { IQuickInputService, IQuickPickItem, IQuickPickSeparator, QuickPickItem } from '../../../../../platform/quickinput/common/quickInput.js'; import { CHAT_CATEGORY } from './chatActions.js'; import { IChatWidget, IChatWidgetService, IQuickChatService, showChatView } from '../chat.js'; import { isQuickChat } from '../chatWidget.js'; @@ -444,7 +444,50 @@ class AttachContextAction extends Action2 { } private _show(quickInputService: IQuickInputService, commandService: ICommandService, widget: IChatWidget, quickChatService: IQuickChatService, quickPickItems: (IChatContextQuickPickItem | QuickPickItem)[], clipboardService: IClipboardService, query: string = '') { + const providerOptions: AnythingQuickAccessProviderRunOptions = { + handleAccept: (item: IChatContextQuickPickItem) => { + if ('prefix' in item) { + this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, item.prefix); + } else { + if (!clipboardService) { + return; + } + this._attachContext(widget, commandService, clipboardService, item); + if (isQuickChat(widget)) { + quickChatService.open(); + } + } + }, + additionPicks: quickPickItems, + filter: (item: IChatContextQuickPickItem | IQuickPickSeparator) => { + // Avoid attaching the same context twice + const attachedContext = widget.getContrib(ChatContextAttachments.ID)?.getContext() ?? new Set(); + if ('kind' in item && item.kind === 'image') { + return !attachedContext.has(item.id); + } + + if ('symbol' in item && item.symbol) { + return !attachedContext.has(this._getFileContextId(item.symbol.location)); + } + + if (item && typeof item === 'object' && 'resource' in item && URI.isUri(item.resource)) { + return [Schemas.file, Schemas.vscodeRemote].includes(item.resource.scheme) + && !attachedContext.has(this._getFileContextId({ resource: item.resource })); // Hack because Typescript doesn't narrow this type correctly + } + + if (item && typeof item === 'object' && 'uri' in item && item.uri && item.range) { + return !attachedContext.has(this._getFileContextId({ uri: item.uri, range: item.range.decoration })); + } + + if (!('command' in item) && item.id) { + return !attachedContext.has(item.id); + } + + // Don't filter out dynamic variables which show secondary data (temporary) + return true; + } + }; quickInputService.quickAccess.show(query, { enabledProviderPrefixes: [ AnythingQuickAccessProvider.PREFIX, @@ -452,51 +495,7 @@ class AttachContextAction extends Action2 { AbstractGotoSymbolQuickAccessProvider.PREFIX ], placeholder: localize('chatContext.attach.placeholder', 'Search attachments'), - providerOptions: { - handleAccept: (item: IChatContextQuickPickItem) => { - if ('prefix' in item) { - this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, item.prefix); - } else { - if (!clipboardService) { - return; - } - this._attachContext(widget, commandService, clipboardService, item); - if (isQuickChat(widget)) { - quickChatService.open(); - } - } - }, - additionPicks: quickPickItems, - filter: (item: IChatContextQuickPickItem) => { - // Avoid attaching the same context twice - const attachedContext = widget.getContrib(ChatContextAttachments.ID)?.getContext() ?? new Set(); - - if ('kind' in item && item.kind === 'image') { - return !attachedContext.has(item.id); - } - - if ('symbol' in item && item.symbol) { - return !attachedContext.has(this._getFileContextId(item.symbol.location)); - } - - if (item && typeof item === 'object' && 'resource' in item && URI.isUri(item.resource)) { - return [Schemas.file, Schemas.vscodeRemote].includes(item.resource.scheme) - && !attachedContext.has(this._getFileContextId({ resource: item.resource })); // Hack because Typescript doesn't narrow this type correctly - } - - if (item && typeof item === 'object' && 'uri' in item && item.uri && item.range) { - return !attachedContext.has(this._getFileContextId({ uri: item.uri, range: item.range.decoration })); - } - - if (!('command' in item) && item.id) { - return !attachedContext.has(item.id); - } - - // Don't filter out dynamic variables which show secondary data (temporary) - return true; - } - } + providerOptions, }); - } } diff --git a/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.ts b/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.ts index 73fc6a2c68d..df7c921e67a 100644 --- a/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.ts +++ b/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.ts @@ -42,12 +42,12 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth readonly onDidChangeAccountPreference = this._onDidAccountPreferenceChange.event; private _inheritAuthAccountPreferenceParentToChildren: Record = this._productService.inheritAuthAccountPreference || {}; - private _inheritAuthAccountPreferenceChildToParent: { [extensionId: string]: string } = Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce((acc, [parent, children]) => { + private _inheritAuthAccountPreferenceChildToParent = Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce<{ [extensionId: string]: string }>((acc, [parent, children]) => { children.forEach((child: string) => { acc[child] = parent; }); return acc; - }, {} as { [extensionId: string]: string }); + }, {}); constructor( @IActivityService private readonly activityService: IActivityService, diff --git a/src/vs/workbench/services/extensions/common/extensionsRegistry.ts b/src/vs/workbench/services/extensions/common/extensionsRegistry.ts index bb8220b8368..03fbc7de836 100644 --- a/src/vs/workbench/services/extensions/common/extensionsRegistry.ts +++ b/src/vs/workbench/services/extensions/common/extensionsRegistry.ts @@ -225,7 +225,7 @@ export const schema: IJSONSchema = { type: 'object', properties: { // extensions will fill in - } as { [key: string]: any }, + } as any as { [key: string]: any }, default: {} }, preview: { diff --git a/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.ts b/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.ts index 49927741461..6f20836a584 100644 --- a/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.ts +++ b/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.ts @@ -85,7 +85,7 @@ export class KeybindingsEditorModel extends EditorModel { } } - return filteredKeybindingItems.map(keybindingItem => ({ id: KeybindingsEditorModel.getId(keybindingItem), keybindingItem, templateId: KEYBINDING_ENTRY_TEMPLATE_ID })); + return filteredKeybindingItems.map((keybindingItem): IKeybindingItemEntry => ({ id: KeybindingsEditorModel.getId(keybindingItem), keybindingItem, templateId: KEYBINDING_ENTRY_TEMPLATE_ID })); } // @source:SOURCE @@ -110,7 +110,7 @@ export class KeybindingsEditorModel extends EditorModel { searchValue = searchValue.trim(); if (!searchValue) { - return keybindingItems.map(keybindingItem => ({ id: KeybindingsEditorModel.getId(keybindingItem), keybindingItem, templateId: KEYBINDING_ENTRY_TEMPLATE_ID })); + return keybindingItems.map((keybindingItem): IKeybindingItemEntry => ({ id: KeybindingsEditorModel.getId(keybindingItem), keybindingItem, templateId: KEYBINDING_ENTRY_TEMPLATE_ID })); } return this.filterByText(keybindingItems, searchValue); diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index aec1e18c4e3..6673f33d1f2 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -80,7 +80,7 @@ (globalThis as any).__VSCODE_WEB_ESM_PROMISE = resolve; }); - define('vs/web-api', [], () => { + define('vs/web-api', [], (): ILoaderPlugin => { return { load: (_name, _req, _load, _config) => { const script: any = document.createElement('script'); @@ -90,7 +90,7 @@ return promise.then(mod => _load(mod)); } - } as ILoaderPlugin; + }; }); define(