diff --git a/.eslintplugin/code-no-dangerous-type-assertions.ts b/.eslintplugin/code-no-dangerous-type-assertions.ts index 5cf12b858f6..eecd4048e43 100644 --- a/.eslintplugin/code-no-dangerous-type-assertions.ts +++ b/.eslintplugin/code-no-dangerous-type-assertions.ts @@ -22,7 +22,7 @@ export = new class NoDangerousTypeAssertions implements eslint.Rule.RuleModule { const parent = objectNode.parent as TSESTree.TSTypeAssertion | TSESTree.TSAsExpression; if ( // Allow `as const` assertions - (parent.typeAnnotation.type === 'TSTypeReference' && parent.typeAnnotation.typeName.type === 'Identifier' && parent.typeAnnotation.typeName.name === 'cost') + (parent.typeAnnotation.type === 'TSTypeReference' && parent.typeAnnotation.typeName.type === 'Identifier' && parent.typeAnnotation.typeName.name === 'const') // For also now still allow `any` casts || (parent.typeAnnotation.type === 'TSAnyKeyword') diff --git a/src/vs/base/test/browser/markdownRenderer.test.ts b/src/vs/base/test/browser/markdownRenderer.test.ts index 010c0d672af..37de47443e7 100644 --- a/src/vs/base/test/browser/markdownRenderer.test.ts +++ b/src/vs/base/test/browser/markdownRenderer.test.ts @@ -626,7 +626,7 @@ const y = 2; const incomplete = `- list item one \`\`\`js - let x = 1;` + let x = 1;`; const tokens = marked.lexer(incomplete); const newTokens = fillInIncompleteTokens(tokens); @@ -639,7 +639,7 @@ const y = 2; - sub item - text newline for some reason -` +`; const tokens = marked.lexer(list); const newTokens = fillInIncompleteTokens(tokens); @@ -656,7 +656,7 @@ const y = 2; test('list with incomplete link text', () => { const incomplete = `- list item one -- item two [link` +- item two [link`; const tokens = marked.lexer(incomplete); const newTokens = fillInIncompleteTokens(tokens); @@ -666,7 +666,7 @@ const y = 2; test('list with incomplete link target', () => { const incomplete = `- list item one -- item two [link](` +- item two [link](`; const tokens = marked.lexer(incomplete); const newTokens = fillInIncompleteTokens(tokens); @@ -676,7 +676,7 @@ const y = 2; test('list with incomplete link with other stuff', () => { const incomplete = `- list item one -- item two [\`link` +- item two [\`link`; const tokens = marked.lexer(incomplete); const newTokens = fillInIncompleteTokens(tokens); diff --git a/src/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.ts b/src/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.ts index e86d7db6453..db99842d621 100644 --- a/src/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.ts +++ b/src/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.ts @@ -56,7 +56,7 @@ export class DiffEditorEditors extends Disposable { this._argCodeEditorWidgetOptions = null as any; this._register(autorunHandleChanges({ - createEmptyChangeSummary: () => ({} as IDiffEditorConstructionOptions), + createEmptyChangeSummary: (): IDiffEditorConstructionOptions => ({}), handleChange: (ctx, changeSummary) => { if (ctx.didChange(_options.editorOptions)) { Object.assign(changeSummary, ctx.change.changedOptions); diff --git a/src/vs/editor/common/cursor/cursorMoveCommands.ts b/src/vs/editor/common/cursor/cursorMoveCommands.ts index 8ae3d67b0fd..78c553732a9 100644 --- a/src/vs/editor/common/cursor/cursorMoveCommands.ts +++ b/src/vs/editor/common/cursor/cursorMoveCommands.ts @@ -596,7 +596,7 @@ export namespace CursorMove { return true; }; - export const metadata = { + export const metadata: ICommandMetadata = { description: 'Move cursor to a logical position in the view', args: [ { diff --git a/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts b/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts index aa6b7865439..76b08cc63c2 100644 --- a/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts +++ b/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts @@ -41,12 +41,12 @@ import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeat import { Iterable } from 'vs/base/common/iterator'; import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys'; -MenuRegistry.appendMenuItem(MenuId.EditorContext, { +MenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextPeek, title: nls.localize('peek.submenu', "Peek"), group: 'navigation', order: 100 -}); +} satisfies ISubmenuItem); export interface SymbolNavigationActionConfig { openToSide: boolean; diff --git a/src/vs/editor/contrib/hover/browser/hoverController.ts b/src/vs/editor/contrib/hover/browser/hoverController.ts index 890aaf673ed..5d71cd64144 100644 --- a/src/vs/editor/contrib/hover/browser/hoverController.ts +++ b/src/vs/editor/contrib/hover/browser/hoverController.ts @@ -194,22 +194,22 @@ export class HoverController extends Disposable implements IEditorContribution { const isMouseOnStickyMarginHoverWidget = (mouseEvent: IEditorMouseEvent, isHoverSticky: boolean) => { const isMouseOnMarginHoverWidget = this._isMouseOnMarginHoverWidget(mouseEvent); return isHoverSticky && isMouseOnMarginHoverWidget; - } + }; const isMouseOnStickyContentHoverWidget = (mouseEvent: IEditorMouseEvent, isHoverSticky: boolean) => { const isMouseOnContentHoverWidget = this._isMouseOnContentHoverWidget(mouseEvent); return isHoverSticky && isMouseOnContentHoverWidget; - } + }; const isMouseOnColorPicker = (mouseEvent: IEditorMouseEvent) => { const isMouseOnContentHoverWidget = this._isMouseOnContentHoverWidget(mouseEvent); const isColorPickerVisible = this._contentWidget?.isColorPickerVisible; return isMouseOnContentHoverWidget && isColorPickerVisible; - } + }; // TODO@aiday-mar verify if the following is necessary code const isTextSelectedWithinContentHoverWidget = (mouseEvent: IEditorMouseEvent, sticky: boolean) => { return sticky && this._contentWidget?.containsNode(mouseEvent.event.browserEvent.view?.document.activeElement) - && !mouseEvent.event.browserEvent.view?.getSelection()?.isCollapsed - } + && !mouseEvent.event.browserEvent.view?.getSelection()?.isCollapsed; + }; if ( isMouseOnStickyMarginHoverWidget(mouseEvent, isHoverSticky) @@ -312,7 +312,7 @@ export class HoverController extends Disposable implements IEditorContribution { otherWidget = contentWidget; break; default: - throw new Error(`HoverWidgetType ${hoverWidgetType} is unrecognized`) + throw new Error(`HoverWidgetType ${hoverWidgetType} is unrecognized`); } const showsOrWillShow = currentWidget.showsOrWillShow(mouseEvent); diff --git a/src/vs/editor/contrib/inlineCompletions/browser/ghostText.ts b/src/vs/editor/contrib/inlineCompletions/browser/ghostText.ts index 21abd0b7093..47ee2e9f972 100644 --- a/src/vs/editor/contrib/inlineCompletions/browser/ghostText.ts +++ b/src/vs/editor/contrib/inlineCompletions/browser/ghostText.ts @@ -72,7 +72,7 @@ export class GhostTextPart { ) { } - readonly lines = splitLines(this.text);; + readonly lines = splitLines(this.text); equals(other: GhostTextPart): boolean { return this.column === other.column && diff --git a/src/vs/platform/opener/test/common/nullOpenerService.ts b/src/vs/platform/opener/test/common/nullOpenerService.ts index 25b807c1dce..e5d5a3a0540 100644 --- a/src/vs/platform/opener/test/common/nullOpenerService.ts +++ b/src/vs/platform/opener/test/common/nullOpenerService.ts @@ -7,7 +7,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; import { IOpenerService } from '../../common/opener'; -export const NullOpenerService = Object.freeze({ +export const NullOpenerService = Object.freeze({ _serviceBrand: undefined, registerOpener() { return Disposable.None; }, registerValidator() { return Disposable.None; }, @@ -16,4 +16,4 @@ export const NullOpenerService = Object.freeze({ registerExternalOpener() { return Disposable.None; }, async open() { return false; }, async resolveExternalUri(uri: URI) { return { resolved: uri, dispose() { } }; }, -} as IOpenerService); +}); diff --git a/src/vs/platform/update/common/update.ts b/src/vs/platform/update/common/update.ts index 73e7d7afffe..18cafc9196d 100644 --- a/src/vs/platform/update/common/update.ts +++ b/src/vs/platform/update/common/update.ts @@ -76,12 +76,12 @@ export const State = { Uninitialized: { type: StateType.Uninitialized } as Uninitialized, Disabled: (reason: DisablementReason) => ({ type: StateType.Disabled, reason }) as Disabled, Idle: (updateType: UpdateType, error?: string) => ({ type: StateType.Idle, updateType, error }) as Idle, - CheckingForUpdates: (explicit: boolean) => ({ type: StateType.CheckingForUpdates, explicit } as CheckingForUpdates), - AvailableForDownload: (update: IUpdate) => ({ type: StateType.AvailableForDownload, update } as AvailableForDownload), + CheckingForUpdates: (explicit: boolean): CheckingForUpdates => ({ type: StateType.CheckingForUpdates, explicit }), + AvailableForDownload: (update: IUpdate): AvailableForDownload => ({ type: StateType.AvailableForDownload, update }), Downloading: { type: StateType.Downloading } as Downloading, - Downloaded: (update: IUpdate) => ({ type: StateType.Downloaded, update } as Downloaded), - Updating: (update: IUpdate) => ({ type: StateType.Updating, update } as Updating), - Ready: (update: IUpdate) => ({ type: StateType.Ready, update } as Ready), + Downloaded: (update: IUpdate): Downloaded => ({ type: StateType.Downloaded, update }), + Updating: (update: IUpdate): Updating => ({ type: StateType.Updating, update }), + Ready: (update: IUpdate): Ready => ({ type: StateType.Ready, update }), }; export interface IAutoUpdater extends Event.NodeEventEmitter { diff --git a/src/vs/workbench/api/browser/mainThreadDecorations.ts b/src/vs/workbench/api/browser/mainThreadDecorations.ts index 76ec7391e01..46ae4275baa 100644 --- a/src/vs/workbench/api/browser/mainThreadDecorations.ts +++ b/src/vs/workbench/api/browser/mainThreadDecorations.ts @@ -87,13 +87,13 @@ export class MainThreadDecorations implements MainThreadDecorationsShape { const registration = this._decorationsService.registerDecorationsProvider({ label, onDidChange: emitter.event, - provideDecorations: async (uri, token) => { + provideDecorations: async (uri, token): Promise => { const data = await queue.enqueue(uri, token); if (!data) { return undefined; } const [bubble, tooltip, letter, themeColor] = data; - return { + return { weight: 10, bubble: bubble ?? false, color: themeColor?.id, diff --git a/src/vs/workbench/api/common/extHostConsoleForwarder.ts b/src/vs/workbench/api/common/extHostConsoleForwarder.ts index 767d73b51c8..663841771e7 100644 --- a/src/vs/workbench/api/common/extHostConsoleForwarder.ts +++ b/src/vs/workbench/api/common/extHostConsoleForwarder.ts @@ -107,7 +107,7 @@ function safeStringifyArgumentsToArray(args: IArguments, includeStack: boolean): if (includeStack) { const stack = new Error().stack; if (stack) { - argsArray.push({ __$stack: stack.split('\n').slice(3).join('\n') } as IStackArgument); + argsArray.push({ __$stack: stack.split('\n').slice(3).join('\n') } satisfies IStackArgument); } } diff --git a/src/vs/workbench/api/common/extHostCustomEditors.ts b/src/vs/workbench/api/common/extHostCustomEditors.ts index 2bf237093b7..99eef8fbc8b 100644 --- a/src/vs/workbench/api/common/extHostCustomEditors.ts +++ b/src/vs/workbench/api/common/extHostCustomEditors.ts @@ -133,22 +133,22 @@ class EditorProviderStore { private readonly _providers = new Map(); public addTextProvider(viewType: string, extension: IExtensionDescription, provider: vscode.CustomTextEditorProvider): vscode.Disposable { - return this.add(CustomEditorType.Text, viewType, extension, provider); + return this.add(viewType, { type: CustomEditorType.Text, extension, provider }); } public addCustomProvider(viewType: string, extension: IExtensionDescription, provider: vscode.CustomReadonlyEditorProvider): vscode.Disposable { - return this.add(CustomEditorType.Custom, viewType, extension, provider); + return this.add(viewType, { type: CustomEditorType.Custom, extension, provider }); } public get(viewType: string): ProviderEntry | undefined { return this._providers.get(viewType); } - private add(type: CustomEditorType, viewType: string, extension: IExtensionDescription, provider: vscode.CustomTextEditorProvider | vscode.CustomReadonlyEditorProvider): vscode.Disposable { + private add(viewType: string, entry: ProviderEntry): vscode.Disposable { if (this._providers.has(viewType)) { throw new Error(`Provider for viewType:${viewType} already registered`); } - this._providers.set(viewType, { type, extension, provider } as ProviderEntry); + this._providers.set(viewType, entry); return new extHostTypes.Disposable(() => this._providers.delete(viewType)); } } diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index 598ee42261e..2cb1dd5226a 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -792,7 +792,7 @@ class RenameAdapter { private readonly _logService: ILogService ) { } - async provideRenameEdits(resource: URI, position: IPosition, newName: string, token: CancellationToken): Promise { + async provideRenameEdits(resource: URI, position: IPosition, newName: string, token: CancellationToken): Promise { const doc = this._documents.getDocument(resource); const pos = typeConvert.Position.to(position); @@ -807,7 +807,7 @@ class RenameAdapter { } catch (err) { const rejectReason = RenameAdapter._asMessage(err); if (rejectReason) { - return { rejectReason, edits: undefined! }; + return { rejectReason, edits: undefined! }; } else { // generic error return Promise.reject(err); @@ -849,7 +849,7 @@ class RenameAdapter { } catch (err) { const rejectReason = RenameAdapter._asMessage(err); if (rejectReason) { - return { rejectReason, range: undefined!, text: undefined! }; + return { rejectReason, range: undefined!, text: undefined! }; } else { return Promise.reject(err); } diff --git a/src/vs/workbench/api/common/extHostWebviewMessaging.ts b/src/vs/workbench/api/common/extHostWebviewMessaging.ts index e079f66e9e4..88c477baab5 100644 --- a/src/vs/workbench/api/common/extHostWebviewMessaging.ts +++ b/src/vs/workbench/api/common/extHostWebviewMessaging.ts @@ -30,15 +30,15 @@ export function serializeWebviewMessage( const replacer = (_key: string, value: any) => { if (value instanceof ArrayBuffer) { const index = arrayBuffers.add(value); - return { + return { $$vscode_array_buffer_reference$$: true, index, - }; + } satisfies extHostProtocol.WebviewMessageArrayBufferReference; } else if (ArrayBuffer.isView(value)) { const type = getTypedArrayType(value); if (type) { const index = arrayBuffers.add(value.buffer); - return { + return { $$vscode_array_buffer_reference$$: true, index, view: { @@ -46,7 +46,7 @@ export function serializeWebviewMessage( byteLength: value.byteLength, byteOffset: value.byteOffset, } - }; + } satisfies extHostProtocol.WebviewMessageArrayBufferReference; } } diff --git a/src/vs/workbench/api/common/extHostWorkspace.ts b/src/vs/workbench/api/common/extHostWorkspace.ts index d240127a4d4..08b842e84fb 100644 --- a/src/vs/workbench/api/common/extHostWorkspace.ts +++ b/src/vs/workbench/api/common/extHostWorkspace.ts @@ -418,7 +418,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac configuration: this._actualWorkspace.configuration, folders, isUntitled: this._actualWorkspace.isUntitled - } as IWorkspaceData, this._actualWorkspace, undefined, this._extHostFileSystemInfo).workspace || undefined; + }, this._actualWorkspace, undefined, this._extHostFileSystemInfo).workspace || undefined; } } @@ -488,7 +488,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac const excludePattern = (typeof options.exclude === 'string') ? options.exclude : options.exclude ? options.exclude.pattern : undefined; - const fileQueries = { + const fileQueries: IFileQueryBuilderOptions = { ignoreSymlinks: typeof options.followSymlinks === 'boolean' ? !options.followSymlinks : undefined, disregardIgnoreFiles: typeof options.useIgnoreFiles === 'boolean' ? !options.useIgnoreFiles : undefined, disregardGlobalIgnoreFiles: typeof options.useGlobalIgnoreFiles === 'boolean' ? !options.useGlobalIgnoreFiles : undefined, @@ -561,7 +561,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac p.results!.forEach(rawResult => { const result: ITextSearchResult = revive(rawResult); if (resultIsMatch(result)) { - callback({ + callback({ uri, preview: { text: result.preview.text, @@ -572,13 +572,13 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac ranges: mapArrayOrNot( result.ranges, r => new Range(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn)) - }); + } satisfies vscode.TextSearchMatch); } else { - callback({ + callback({ uri, text: result.text, lineNumber: result.lineNumber - }); + } satisfies vscode.TextSearchContext); } }); }; diff --git a/src/vs/workbench/browser/parts/views/treeView.ts b/src/vs/workbench/browser/parts/views/treeView.ts index 6bf667dda10..a9db85d25b4 100644 --- a/src/vs/workbench/browser/parts/views/treeView.ts +++ b/src/vs/workbench/browser/parts/views/treeView.ts @@ -1314,7 +1314,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer{ $treeViewId: this.treeViewId, $treeItemHandle: node.handle }; + templateData.actionBar.context = { $treeViewId: this.treeViewId, $treeItemHandle: node.handle } satisfies TreeViewItemHandleArg; const menuActions = this.menus.getResourceActions([node], templateData.elementDisposable); templateData.actionBar.push(menuActions.actions, { icon: true, label: false }); diff --git a/src/vs/workbench/contrib/chat/browser/chatWidget.ts b/src/vs/workbench/contrib/chat/browser/chatWidget.ts index 40dd8789d54..5a8b65c964e 100644 --- a/src/vs/workbench/contrib/chat/browser/chatWidget.ts +++ b/src/vs/workbench/contrib/chat/browser/chatWidget.ts @@ -335,8 +335,8 @@ export class ChatWidget extends Disposable implements IChatWidget { private onDidChangeItems(skipDynamicLayout?: boolean) { if (this.tree && this._visible) { const treeItems = (this.viewModel?.getItems() ?? []) - .map(item => { - return >{ + .map((item): ITreeElement => { + return { element: item, collapsed: false, collapsible: false diff --git a/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts b/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts index 15d476c39b8..61201d37420 100644 --- a/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts +++ b/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts @@ -11,7 +11,7 @@ import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { IWordAtPosition, getWordAtText } from 'vs/editor/common/core/wordHelper'; import { IDecorationOptions } from 'vs/editor/common/editorCommon'; -import { CompletionContext, CompletionItem, CompletionItemKind, CompletionList } from 'vs/editor/common/languages'; +import { CompletionContext, CompletionItem, CompletionItemKind } from 'vs/editor/common/languages'; import { ITextModel } from 'vs/editor/common/model'; import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'; import { localize } from 'vs/nls'; @@ -300,10 +300,10 @@ class SlashCommandCompletions extends Disposable { return null; } - return { - suggestions: slashCommands.map((c, i) => { + return { + suggestions: slashCommands.map((c, i): CompletionItem => { const withSlash = `/${c.command}`; - return { + return { label: withSlash, insertText: c.executeImmediately ? '' : `${withSlash} `, detail: c.detail, @@ -354,11 +354,11 @@ class AgentCompletions extends Disposable { .filter(a => !a.isDefault) .filter(a => a.locations.includes(widget.location)); - return { - suggestions: agents.map((a, i) => { + return { + suggestions: agents.map((a, i): CompletionItem => { const withAt = `@${a.name}`; const isDupe = !!agents.find(other => other.name === a.name && other.id !== a.id); - return { + return { // Leading space is important because detail has no space at the start by design label: isDupe ? { label: withAt, description: a.description, detail: ` (${a.extensionPublisherDisplayName})` } : @@ -409,10 +409,10 @@ class AgentCompletions extends Disposable { } const usedAgent = parsedRequest[usedAgentIdx] as ChatRequestAgentPart; - return { - suggestions: usedAgent.agent.slashCommands.map((c, i) => { + return { + suggestions: usedAgent.agent.slashCommands.map((c, i): CompletionItem => { const withSlash = `/${c.name}`; - return { + return { label: withSlash, insertText: `${withSlash} `, detail: c.description, @@ -538,9 +538,9 @@ class BuiltinDynamicCompletions extends Disposable { } const afterRange = new Range(position.lineNumber, range.replace.startColumn, position.lineNumber, range.replace.startColumn + '#file:'.length); - return { + return { suggestions: [ - { + { label: `${chatVariableLeader}file`, insertText: `${chatVariableLeader}file:`, detail: localize('pickFileLabel', "Pick a file"), @@ -548,7 +548,7 @@ class BuiltinDynamicCompletions extends Disposable { kind: CompletionItemKind.Text, command: { id: SelectAndInsertFileAction.ID, title: SelectAndInsertFileAction.ID, arguments: [{ widget, range: afterRange }] }, sortText: 'z' - } + } satisfies CompletionItem ] }; } @@ -607,9 +607,9 @@ class VariableCompletions extends Disposable { const variableItems = Array.from(this.chatVariablesService.getVariables()) // This doesn't look at dynamic variables like `file`, where multiple makes sense. .filter(v => !usedVariables.some(usedVar => usedVar.variableName === v.name)) - .map(v => { + .map((v): CompletionItem => { const withLeader = `${chatVariableLeader}${v.name}`; - return { + return { label: withLeader, range, insertText: withLeader + ' ', @@ -619,7 +619,7 @@ class VariableCompletions extends Disposable { }; }); - return { + return { suggestions: variableItems }; } diff --git a/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts b/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts index f937415cf67..6a18b363fa3 100644 --- a/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts +++ b/src/vs/workbench/contrib/chat/common/chatServiceImpl.ts @@ -250,7 +250,7 @@ export class ChatService extends Disposable implements IChatService { throw new Error('Expected array'); } - const sessions = arrayOfSessions.reduce((acc, session) => { + const sessions = arrayOfSessions.reduce((acc, session) => { // Revive serialized markdown strings in response data for (const request of session.requests) { if (Array.isArray(request.response)) { @@ -267,7 +267,7 @@ export class ChatService extends Disposable implements IChatService { acc[session.sessionId] = session; return acc; - }, {} as ISerializableChatsData); + }, {}); return sessions; } catch (err) { this.error('deserializeChats', `Malformed session data: ${err}. [${sessionData.substring(0, 20)}${sessionData.length > 20 ? '...' : ''}]`); diff --git a/src/vs/workbench/contrib/chat/test/common/mockChatService.ts b/src/vs/workbench/contrib/chat/test/common/mockChatService.ts index b0904525427..f2671c73f59 100644 --- a/src/vs/workbench/contrib/chat/test/common/mockChatService.ts +++ b/src/vs/workbench/contrib/chat/test/common/mockChatService.ts @@ -28,6 +28,7 @@ export class MockChatService implements IChatService { throw new Error('Method not implemented.'); } getSession(sessionId: string): IChatModel | undefined { + // eslint-disable-next-line local/code-no-dangerous-type-assertions return {} as IChatModel; } getOrRestoreSession(sessionId: string): IChatModel | undefined { diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index 569a1201c45..0fd22533e89 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -744,7 +744,7 @@ class OpenEditorsDragAndDrop implements IListDragAndDrop{ + return { browserEvent: event, draggedOverCell, cellTop, diff --git a/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts b/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts index 024db0c8919..6cb5b68da50 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts @@ -21,7 +21,6 @@ import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/commo import { ThemeIcon } from 'vs/base/common/themables'; import { ViewContainerLocation } from 'vs/workbench/common/views'; import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSION_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; -import { INotebookOutputActionContext } from 'vs/workbench/contrib/notebook/browser/controller/coreActions'; import { ICellOutputViewModel, ICellViewModel, IInsetRenderOutput, INotebookEditorDelegate, JUPYTER_EXTENSION_ID, RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { mimetypeIcon } from 'vs/workbench/contrib/notebook/browser/notebookIcons'; import { CellContentPart } from 'vs/workbench/contrib/notebook/browser/view/cellPart'; @@ -302,7 +301,7 @@ class CellOutputElement extends Disposable { const toolbar = this._renderDisposableStore.add(this.instantiationService.createInstance(WorkbenchToolBar, mimeTypePicker, { renderDropdownAsChildElement: false })); - toolbar.context = { + toolbar.context = { ui: true, cell: this.output.cellViewModel as ICellViewModel, outputViewModel: this.output, diff --git a/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.ts b/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.ts index 60f0d2a926a..b647817b586 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.ts @@ -64,23 +64,23 @@ export class CollapsedCodeCellExecutionIcon extends Disposable { const state = runState?.state; const { lastRunSuccess } = internalMetadata; if (!state && lastRunSuccess) { - return { + return { text: `$(${successStateIcon.id})`, tooltip: localize('notebook.cell.status.success', "Success"), }; } else if (!state && lastRunSuccess === false) { - return { + return { text: `$(${errorStateIcon.id})`, tooltip: localize('notebook.cell.status.failure', "Failure"), }; } else if (state === NotebookCellExecutionState.Pending || state === NotebookCellExecutionState.Unconfirmed) { - return { + return { text: `$(${pendingStateIcon.id})`, tooltip: localize('notebook.cell.status.pending', "Pending"), }; } else if (state === NotebookCellExecutionState.Executing) { const icon = ThemeIcon.modify(executingStateIcon, 'spin'); - return { + return { text: `$(${icon.id})`, tooltip: localize('notebook.cell.status.executing', "Executing"), }; diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesActions.ts b/src/vs/workbench/contrib/preferences/browser/preferencesActions.ts index 797f056edcf..e706aeb4a42 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesActions.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesActions.ts @@ -37,7 +37,7 @@ export class ConfigureLanguageBasedSettingsAction extends Action { override async run(): Promise { const languages = this.languageService.getSortedRegisteredLanguageNames(); - const picks: IQuickPickItem[] = languages.map(({ languageName, languageId }) => { + const picks: IQuickPickItem[] = languages.map(({ languageName, languageId }): IQuickPickItem => { const description: string = nls.localize('languageDescriptionConfigured', "({0})", languageId); // construct a fake resource to be able to show nice icons if any let fakeResource: URI | undefined; @@ -54,7 +54,7 @@ export class ConfigureLanguageBasedSettingsAction extends Action { label: languageName, iconClasses: getIconClasses(this.modelService, this.languageService, fakeResource), description - } as IQuickPickItem; + }; }); await this.quickInputService.pick(picks, { placeHolder: nls.localize('pickLanguage', "Select Language") }) diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index bdff99acf79..5f47bba5169 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -3585,7 +3585,7 @@ class SCMTreeDataSource implements IAsyncDataSource { + completeData: promise.then((resolvedPromise): ISearchComplete => { const openNotebookResult = resolvedPromise[0]; const closedNotebookResult = resolvedPromise[1]; @@ -94,7 +94,7 @@ export class NotebookSearchService implements INotebookSearchService { results.forEach(onProgress); } this.logService.trace(`local notebook search time | ${searchLocalEnd - searchStart}ms`); - return { + return { messages: [], limitHit: resolved.reduce((prev, cur) => prev || cur.limitHit, false), results, @@ -152,7 +152,7 @@ export class NotebookSearchService implements INotebookSearchService { return; } - const info = { + const info: NotebookPriorityInfo = { isFromSettings: true, filenamePatterns: [association.filenamePattern] }; diff --git a/src/vs/workbench/contrib/search/browser/searchResultsView.ts b/src/vs/workbench/contrib/search/browser/searchResultsView.ts index f3c64a6e7b0..d7c088c442e 100644 --- a/src/vs/workbench/contrib/search/browser/searchResultsView.ts +++ b/src/vs/workbench/contrib/search/browser/searchResultsView.ts @@ -196,7 +196,7 @@ export class FolderMatchRenderer extends Disposable implements ICompressibleTree templateData.badge.setCount(count); templateData.badge.setTitleFormat(count > 1 ? nls.localize('searchFileMatches', "{0} files found", count) : nls.localize('searchFileMatch', "{0} file found", count)); - templateData.actions.context = { viewer: this.searchView.getControl(), element: folder }; + templateData.actions.context = { viewer: this.searchView.getControl(), element: folder } satisfies ISearchActionContext; } } @@ -267,7 +267,7 @@ export class FileMatchRenderer extends Disposable implements ICompressibleTreeRe templateData.badge.setCount(count); templateData.badge.setTitleFormat(count > 1 ? nls.localize('searchMatches', "{0} matches found", count) : nls.localize('searchMatch', "{0} match found", count)); - templateData.actions.context = { viewer: this.searchView.getControl(), element: fileMatch }; + templateData.actions.context = { viewer: this.searchView.getControl(), element: fileMatch } satisfies ISearchActionContext; SearchContext.IsEditableItemKey.bindTo(templateData.contextKeyService).set(!fileMatch.hasOnlyReadOnlyMatches()); @@ -379,7 +379,7 @@ export class MatchRenderer extends Disposable implements ICompressibleTreeRender templateData.lineNumber.textContent = lineNumberStr + extraLinesStr; templateData.disposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), templateData.lineNumber, this.getMatchTitle(match, showLineNumbers))); - templateData.actions.context = { viewer: this.searchView.getControl(), element: match }; + templateData.actions.context = { viewer: this.searchView.getControl(), element: match } satisfies ISearchActionContext; } diff --git a/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts b/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts index 4d907980e32..658cb5fba1b 100644 --- a/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts +++ b/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts @@ -544,7 +544,7 @@ taskDefinitions.push(processTask); taskDefinitions.push({ $ref: '#/definitions/taskDescription' -} as IJSONSchema); +}); const definitionsTaskRunnerConfigurationProperties = definitions.taskRunnerConfiguration.properties!; const tasks = definitionsTaskRunnerConfigurationProperties.tasks; diff --git a/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts b/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts index abac89c073a..d881b3286f9 100644 --- a/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts +++ b/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts @@ -92,12 +92,12 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({ const timelineFilter = registerIcon('timeline-filter', Codicon.filter, localize('timelineFilter', 'Icon for the filter timeline action.')); -MenuRegistry.appendMenuItem(MenuId.TimelineTitle, { +MenuRegistry.appendMenuItem(MenuId.TimelineTitle, { submenu: MenuId.TimelineFilterSubMenu, title: localize('filterTimeline', "Filter Timeline"), group: 'navigation', order: 100, icon: timelineFilter -}); +} satisfies ISubmenuItem); registerSingleton(ITimelineService, TimelineService, InstantiationType.Delayed); diff --git a/src/vs/workbench/contrib/timeline/browser/timelinePane.ts b/src/vs/workbench/contrib/timeline/browser/timelinePane.ts index cdf025f4a5f..606c0ed8582 100644 --- a/src/vs/workbench/contrib/timeline/browser/timelinePane.ts +++ b/src/vs/workbench/contrib/timeline/browser/timelinePane.ts @@ -1207,7 +1207,7 @@ class TimelineTreeRenderer implements ITreeRenderer ({ label, picked: true } as IQuickPickItem)); + const items = storage.extensions.map((label): IQuickPickItem => ({ label, picked: true })); if (items.length === 0) { await quickInputService.pick([{ label: localize('no', 'There are currently no authorized extension URIs.') }]); diff --git a/src/vs/workbench/services/search/common/textSearchManager.ts b/src/vs/workbench/services/search/common/textSearchManager.ts index 84808af5691..7409ea8cd1c 100644 --- a/src/vs/workbench/services/search/common/textSearchManager.ts +++ b/src/vs/workbench/services/search/common/textSearchManager.ts @@ -223,7 +223,7 @@ export class TextSearchManager { } function patternInfoToQuery(patternInfo: IPatternInfo): TextSearchQuery { - return { + return { isCaseSensitive: patternInfo.isCaseSensitive || false, isRegExp: patternInfo.isRegExp || false, isWordMatch: patternInfo.isWordMatch || false, @@ -283,7 +283,7 @@ export class TextSearchResultsCollector { function extensionResultToFrontendResult(data: TextSearchResult): ITextSearchResult { // Warning: result from RipgrepTextSearchEH has fake Range. Don't depend on any other props beyond these... if (extensionResultIsMatch(data)) { - return { + return { preview: { matches: mapArrayOrNot(data.preview.matches, m => ({ startLineNumber: m.start.line, @@ -299,12 +299,12 @@ function extensionResultToFrontendResult(data: TextSearchResult): ITextSearchRes endLineNumber: r.end.line, endColumn: r.end.character })) - }; + } satisfies ITextSearchMatch; } else { - return { + return { text: data.text, lineNumber: data.lineNumber - }; + } satisfies ITextSearchContext; } }