Clean up some type assertions (#211751)
Clean up some assertions Mostly just removing extra type assertions or adding them to a better spot Also addresses some missing semicolons that snuck in somehow
This commit is contained in:
parent
e6d29e4ba1
commit
e483059807
|
@ -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')
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -596,7 +596,7 @@ export namespace CursorMove {
|
|||
return true;
|
||||
};
|
||||
|
||||
export const metadata = <ICommandMetadata>{
|
||||
export const metadata: ICommandMetadata = {
|
||||
description: 'Move cursor to a logical position in the view',
|
||||
args: [
|
||||
{
|
||||
|
|
|
@ -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, <ISubmenuItem>{
|
||||
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
||||
submenu: MenuId.EditorContextPeek,
|
||||
title: nls.localize('peek.submenu', "Peek"),
|
||||
group: 'navigation',
|
||||
order: 100
|
||||
});
|
||||
} satisfies ISubmenuItem);
|
||||
|
||||
export interface SymbolNavigationActionConfig {
|
||||
openToSide: boolean;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 &&
|
||||
|
|
|
@ -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<IOpenerService>({
|
||||
_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);
|
||||
});
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<IDecorationData | undefined> => {
|
||||
const data = await queue.enqueue(uri, token);
|
||||
if (!data) {
|
||||
return undefined;
|
||||
}
|
||||
const [bubble, tooltip, letter, themeColor] = data;
|
||||
return <IDecorationData>{
|
||||
return {
|
||||
weight: 10,
|
||||
bubble: bubble ?? false,
|
||||
color: themeColor?.id,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,22 +133,22 @@ class EditorProviderStore {
|
|||
private readonly _providers = new Map<string, ProviderEntry>();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -792,7 +792,7 @@ class RenameAdapter {
|
|||
private readonly _logService: ILogService
|
||||
) { }
|
||||
|
||||
async provideRenameEdits(resource: URI, position: IPosition, newName: string, token: CancellationToken): Promise<extHostProtocol.IWorkspaceEditDto | undefined> {
|
||||
async provideRenameEdits(resource: URI, position: IPosition, newName: string, token: CancellationToken): Promise<extHostProtocol.IWorkspaceEditDto & languages.Rejection | undefined> {
|
||||
|
||||
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 <extHostProtocol.IWorkspaceEditDto>{ rejectReason, edits: undefined! };
|
||||
return { rejectReason, edits: undefined! };
|
||||
} else {
|
||||
// generic error
|
||||
return Promise.reject<extHostProtocol.IWorkspaceEditDto>(err);
|
||||
|
@ -849,7 +849,7 @@ class RenameAdapter {
|
|||
} catch (err) {
|
||||
const rejectReason = RenameAdapter._asMessage(err);
|
||||
if (rejectReason) {
|
||||
return <languages.RenameLocation & languages.Rejection>{ rejectReason, range: undefined!, text: undefined! };
|
||||
return { rejectReason, range: undefined!, text: undefined! };
|
||||
} else {
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ export function serializeWebviewMessage(
|
|||
const replacer = (_key: string, value: any) => {
|
||||
if (value instanceof ArrayBuffer) {
|
||||
const index = arrayBuffers.add(value);
|
||||
return <extHostProtocol.WebviewMessageArrayBufferReference>{
|
||||
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 <extHostProtocol.WebviewMessageArrayBufferReference>{
|
||||
return {
|
||||
$$vscode_array_buffer_reference$$: true,
|
||||
index,
|
||||
view: {
|
||||
|
@ -46,7 +46,7 @@ export function serializeWebviewMessage(
|
|||
byteLength: value.byteLength,
|
||||
byteOffset: value.byteOffset,
|
||||
}
|
||||
};
|
||||
} satisfies extHostProtocol.WebviewMessageArrayBufferReference;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 = <IFileQueryBuilderOptions>{
|
||||
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<URI> = revive(rawResult);
|
||||
if (resultIsMatch(result)) {
|
||||
callback(<vscode.TextSearchMatch>{
|
||||
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(<vscode.TextSearchContext>{
|
||||
callback({
|
||||
uri,
|
||||
text: result.text,
|
||||
lineNumber: result.lineNumber
|
||||
});
|
||||
} satisfies vscode.TextSearchContext);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1314,7 +1314,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
|||
}
|
||||
}
|
||||
|
||||
templateData.actionBar.context = <TreeViewItemHandleArg>{ $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 });
|
||||
|
|
|
@ -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 <ITreeElement<ChatTreeItem>>{
|
||||
.map((item): ITreeElement<ChatTreeItem> => {
|
||||
return {
|
||||
element: item,
|
||||
collapsed: false,
|
||||
collapsible: false
|
||||
|
|
|
@ -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 <CompletionList>{
|
||||
suggestions: slashCommands.map((c, i) => {
|
||||
return {
|
||||
suggestions: slashCommands.map((c, i): CompletionItem => {
|
||||
const withSlash = `/${c.command}`;
|
||||
return <CompletionItem>{
|
||||
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 <CompletionList>{
|
||||
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 <CompletionItem>{
|
||||
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 <CompletionList>{
|
||||
suggestions: usedAgent.agent.slashCommands.map((c, i) => {
|
||||
return {
|
||||
suggestions: usedAgent.agent.slashCommands.map((c, i): CompletionItem => {
|
||||
const withSlash = `/${c.name}`;
|
||||
return <CompletionItem>{
|
||||
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 <CompletionList>{
|
||||
return {
|
||||
suggestions: [
|
||||
<CompletionItem>{
|
||||
{
|
||||
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 <CompletionItem>{
|
||||
return {
|
||||
label: withLeader,
|
||||
range,
|
||||
insertText: withLeader + ' ',
|
||||
|
@ -619,7 +619,7 @@ class VariableCompletions extends Disposable {
|
|||
};
|
||||
});
|
||||
|
||||
return <CompletionList>{
|
||||
return {
|
||||
suggestions: variableItems
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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<ISerializableChatsData>((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 ? '...' : ''}]`);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -744,7 +744,7 @@ class OpenEditorsDragAndDrop implements IListDragAndDrop<OpenEditor | IEditorGro
|
|||
return false;
|
||||
} else {
|
||||
// Allow droping files to open them
|
||||
return { accept: true, effect: { type: ListDragOverEffectType.Move }, feedback: [-1] } as IListDragOverReaction;
|
||||
return { accept: true, effect: { type: ListDragOverEffectType.Move }, feedback: [-1] };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -758,7 +758,7 @@ class OpenEditorsDragAndDrop implements IListDragAndDrop<OpenEditor | IEditorGro
|
|||
dropEffectPosition = ListDragOverEffectPosition.After; break;
|
||||
}
|
||||
|
||||
return { accept: true, effect: { type: ListDragOverEffectType.Move, position: dropEffectPosition }, feedback: [_targetIndex] } as IListDragOverReaction;
|
||||
return { accept: true, effect: { type: ListDragOverEffectType.Move, position: dropEffectPosition }, feedback: [_targetIndex] };
|
||||
}
|
||||
|
||||
drop(data: IDragAndDropData, targetElement: OpenEditor | IEditorGroup | undefined, _targetIndex: number, targetSector: ListViewTargetSector | undefined, originalEvent: DragEvent): void {
|
||||
|
|
|
@ -146,7 +146,7 @@ export class CellDragAndDropController extends Disposable {
|
|||
const dragPosInElement = dragOffset - cellTop;
|
||||
const dragPosRatio = dragPosInElement / cellHeight;
|
||||
|
||||
return <CellDragEvent>{
|
||||
return {
|
||||
browserEvent: event,
|
||||
draggedOverCell,
|
||||
cellTop,
|
||||
|
|
|
@ -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 = <INotebookOutputActionContext>{
|
||||
toolbar.context = {
|
||||
ui: true,
|
||||
cell: this.output.cellViewModel as ICellViewModel,
|
||||
outputViewModel: this.output,
|
||||
|
|
|
@ -64,23 +64,23 @@ export class CollapsedCodeCellExecutionIcon extends Disposable {
|
|||
const state = runState?.state;
|
||||
const { lastRunSuccess } = internalMetadata;
|
||||
if (!state && lastRunSuccess) {
|
||||
return <IExecutionItem>{
|
||||
return {
|
||||
text: `$(${successStateIcon.id})`,
|
||||
tooltip: localize('notebook.cell.status.success', "Success"),
|
||||
};
|
||||
} else if (!state && lastRunSuccess === false) {
|
||||
return <IExecutionItem>{
|
||||
return {
|
||||
text: `$(${errorStateIcon.id})`,
|
||||
tooltip: localize('notebook.cell.status.failure', "Failure"),
|
||||
};
|
||||
} else if (state === NotebookCellExecutionState.Pending || state === NotebookCellExecutionState.Unconfirmed) {
|
||||
return <IExecutionItem>{
|
||||
return {
|
||||
text: `$(${pendingStateIcon.id})`,
|
||||
tooltip: localize('notebook.cell.status.pending', "Pending"),
|
||||
};
|
||||
} else if (state === NotebookCellExecutionState.Executing) {
|
||||
const icon = ThemeIcon.modify(executingStateIcon, 'spin');
|
||||
return <IExecutionItem>{
|
||||
return {
|
||||
text: `$(${icon.id})`,
|
||||
tooltip: localize('notebook.cell.status.executing', "Executing"),
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ export class ConfigureLanguageBasedSettingsAction extends Action {
|
|||
|
||||
override async run(): Promise<void> {
|
||||
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") })
|
||||
|
|
|
@ -3585,7 +3585,7 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
|
|||
type: 'actionButton',
|
||||
repository: inputOrElement,
|
||||
button: actionButton
|
||||
} as ISCMActionButton);
|
||||
} satisfies ISCMActionButton);
|
||||
}
|
||||
|
||||
// ResourceGroups
|
||||
|
@ -3613,7 +3613,7 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
|
|||
ariaLabel = localize('syncOutgoingSeparatorHeaderAriaLabel', "Outgoing changes");
|
||||
}
|
||||
|
||||
children.push({ label, ariaLabel, repository: inputOrElement, type: 'separator' } as SCMViewSeparatorElement);
|
||||
children.push({ label, ariaLabel, repository: inputOrElement, type: 'separator' } satisfies SCMViewSeparatorElement);
|
||||
}
|
||||
|
||||
children.push(...historyItemGroups);
|
||||
|
|
|
@ -83,7 +83,7 @@ export class NotebookSearchService implements INotebookSearchService {
|
|||
|
||||
const promise = Promise.all([localResultPromise, closedResultsPromise]);
|
||||
return {
|
||||
completeData: promise.then((resolvedPromise) => {
|
||||
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 <ISearchComplete>{
|
||||
return {
|
||||
messages: [],
|
||||
limitHit: resolved.reduce((prev, cur) => prev || cur.limitHit, false),
|
||||
results,
|
||||
|
@ -152,7 +152,7 @@ export class NotebookSearchService implements INotebookSearchService {
|
|||
return;
|
||||
}
|
||||
|
||||
const info = <NotebookPriorityInfo>{
|
||||
const info: NotebookPriorityInfo = {
|
||||
isFromSettings: true,
|
||||
filenamePatterns: [association.filenamePattern]
|
||||
};
|
||||
|
|
|
@ -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 = <ISearchActionContext>{ 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 = <ISearchActionContext>{ 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 = <ISearchActionContext>{ viewer: this.searchView.getControl(), element: match };
|
||||
templateData.actions.context = { viewer: this.searchView.getControl(), element: match } satisfies ISearchActionContext;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ taskDefinitions.push(processTask);
|
|||
|
||||
taskDefinitions.push({
|
||||
$ref: '#/definitions/taskDescription'
|
||||
} as IJSONSchema);
|
||||
});
|
||||
|
||||
const definitionsTaskRunnerConfigurationProperties = definitions.taskRunnerConfiguration.properties!;
|
||||
const tasks = definitionsTaskRunnerConfigurationProperties.tasks;
|
||||
|
|
|
@ -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, <ISubmenuItem>{
|
||||
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);
|
||||
|
|
|
@ -1207,7 +1207,7 @@ class TimelineTreeRenderer implements ITreeRenderer<TreeElement, FuzzyScore, Tim
|
|||
template.timestamp.ariaLabel = item.relativeTimeFullWord ?? '';
|
||||
template.timestamp.parentElement!.classList.toggle('timeline-timestamp--duplicate', isTimelineItem(item) && item.hideRelativeTime);
|
||||
|
||||
template.actionBar.context = { uri: this.uri, item } as TimelineActionContext;
|
||||
template.actionBar.context = { uri: this.uri, item } satisfies TimelineActionContext;
|
||||
template.actionBar.actionRunner = new TimelineActionRunner();
|
||||
template.actionBar.push(this.commands.getItemActions(item), { icon: true, label: false });
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ class ManageAuthorizedExtensionURIsAction extends Action2 {
|
|||
const storageService = accessor.get(IStorageService);
|
||||
const quickInputService = accessor.get(IQuickInputService);
|
||||
const storage = new UserTrustedExtensionIdStorage(storageService);
|
||||
const items = storage.extensions.map(label => ({ 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.') }]);
|
||||
|
|
|
@ -223,7 +223,7 @@ export class TextSearchManager {
|
|||
}
|
||||
|
||||
function patternInfoToQuery(patternInfo: IPatternInfo): TextSearchQuery {
|
||||
return <TextSearchQuery>{
|
||||
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 <ITextSearchMatch>{
|
||||
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 <ITextSearchContext>{
|
||||
return {
|
||||
text: data.text,
|
||||
lineNumber: data.lineNumber
|
||||
};
|
||||
} satisfies ITextSearchContext;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue