mirror of
https://github.com/Microsoft/vscode
synced 2024-09-29 16:01:05 +00:00
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;
|
const parent = objectNode.parent as TSESTree.TSTypeAssertion | TSESTree.TSAsExpression;
|
||||||
if (
|
if (
|
||||||
// Allow `as const` assertions
|
// 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
|
// For also now still allow `any` casts
|
||||||
|| (parent.typeAnnotation.type === 'TSAnyKeyword')
|
|| (parent.typeAnnotation.type === 'TSAnyKeyword')
|
||||||
|
|
|
@ -626,7 +626,7 @@ const y = 2;
|
||||||
const incomplete = `- list item one
|
const incomplete = `- list item one
|
||||||
|
|
||||||
\`\`\`js
|
\`\`\`js
|
||||||
let x = 1;`
|
let x = 1;`;
|
||||||
const tokens = marked.lexer(incomplete);
|
const tokens = marked.lexer(incomplete);
|
||||||
const newTokens = fillInIncompleteTokens(tokens);
|
const newTokens = fillInIncompleteTokens(tokens);
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ const y = 2;
|
||||||
- sub item
|
- sub item
|
||||||
- text
|
- text
|
||||||
newline for some reason
|
newline for some reason
|
||||||
`
|
`;
|
||||||
const tokens = marked.lexer(list);
|
const tokens = marked.lexer(list);
|
||||||
const newTokens = fillInIncompleteTokens(tokens);
|
const newTokens = fillInIncompleteTokens(tokens);
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ const y = 2;
|
||||||
|
|
||||||
test('list with incomplete link text', () => {
|
test('list with incomplete link text', () => {
|
||||||
const incomplete = `- list item one
|
const incomplete = `- list item one
|
||||||
- item two [link`
|
- item two [link`;
|
||||||
const tokens = marked.lexer(incomplete);
|
const tokens = marked.lexer(incomplete);
|
||||||
const newTokens = fillInIncompleteTokens(tokens);
|
const newTokens = fillInIncompleteTokens(tokens);
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ const y = 2;
|
||||||
|
|
||||||
test('list with incomplete link target', () => {
|
test('list with incomplete link target', () => {
|
||||||
const incomplete = `- list item one
|
const incomplete = `- list item one
|
||||||
- item two [link](`
|
- item two [link](`;
|
||||||
const tokens = marked.lexer(incomplete);
|
const tokens = marked.lexer(incomplete);
|
||||||
const newTokens = fillInIncompleteTokens(tokens);
|
const newTokens = fillInIncompleteTokens(tokens);
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ const y = 2;
|
||||||
|
|
||||||
test('list with incomplete link with other stuff', () => {
|
test('list with incomplete link with other stuff', () => {
|
||||||
const incomplete = `- list item one
|
const incomplete = `- list item one
|
||||||
- item two [\`link`
|
- item two [\`link`;
|
||||||
const tokens = marked.lexer(incomplete);
|
const tokens = marked.lexer(incomplete);
|
||||||
const newTokens = fillInIncompleteTokens(tokens);
|
const newTokens = fillInIncompleteTokens(tokens);
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ export class DiffEditorEditors extends Disposable {
|
||||||
this._argCodeEditorWidgetOptions = null as any;
|
this._argCodeEditorWidgetOptions = null as any;
|
||||||
|
|
||||||
this._register(autorunHandleChanges({
|
this._register(autorunHandleChanges({
|
||||||
createEmptyChangeSummary: () => ({} as IDiffEditorConstructionOptions),
|
createEmptyChangeSummary: (): IDiffEditorConstructionOptions => ({}),
|
||||||
handleChange: (ctx, changeSummary) => {
|
handleChange: (ctx, changeSummary) => {
|
||||||
if (ctx.didChange(_options.editorOptions)) {
|
if (ctx.didChange(_options.editorOptions)) {
|
||||||
Object.assign(changeSummary, ctx.change.changedOptions);
|
Object.assign(changeSummary, ctx.change.changedOptions);
|
||||||
|
|
|
@ -596,7 +596,7 @@ export namespace CursorMove {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const metadata = <ICommandMetadata>{
|
export const metadata: ICommandMetadata = {
|
||||||
description: 'Move cursor to a logical position in the view',
|
description: 'Move cursor to a logical position in the view',
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,12 +41,12 @@ import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeat
|
||||||
import { Iterable } from 'vs/base/common/iterator';
|
import { Iterable } from 'vs/base/common/iterator';
|
||||||
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
|
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
|
||||||
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.EditorContext, <ISubmenuItem>{
|
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
||||||
submenu: MenuId.EditorContextPeek,
|
submenu: MenuId.EditorContextPeek,
|
||||||
title: nls.localize('peek.submenu', "Peek"),
|
title: nls.localize('peek.submenu', "Peek"),
|
||||||
group: 'navigation',
|
group: 'navigation',
|
||||||
order: 100
|
order: 100
|
||||||
});
|
} satisfies ISubmenuItem);
|
||||||
|
|
||||||
export interface SymbolNavigationActionConfig {
|
export interface SymbolNavigationActionConfig {
|
||||||
openToSide: boolean;
|
openToSide: boolean;
|
||||||
|
|
|
@ -194,22 +194,22 @@ export class HoverController extends Disposable implements IEditorContribution {
|
||||||
const isMouseOnStickyMarginHoverWidget = (mouseEvent: IEditorMouseEvent, isHoverSticky: boolean) => {
|
const isMouseOnStickyMarginHoverWidget = (mouseEvent: IEditorMouseEvent, isHoverSticky: boolean) => {
|
||||||
const isMouseOnMarginHoverWidget = this._isMouseOnMarginHoverWidget(mouseEvent);
|
const isMouseOnMarginHoverWidget = this._isMouseOnMarginHoverWidget(mouseEvent);
|
||||||
return isHoverSticky && isMouseOnMarginHoverWidget;
|
return isHoverSticky && isMouseOnMarginHoverWidget;
|
||||||
}
|
};
|
||||||
const isMouseOnStickyContentHoverWidget = (mouseEvent: IEditorMouseEvent, isHoverSticky: boolean) => {
|
const isMouseOnStickyContentHoverWidget = (mouseEvent: IEditorMouseEvent, isHoverSticky: boolean) => {
|
||||||
const isMouseOnContentHoverWidget = this._isMouseOnContentHoverWidget(mouseEvent);
|
const isMouseOnContentHoverWidget = this._isMouseOnContentHoverWidget(mouseEvent);
|
||||||
return isHoverSticky && isMouseOnContentHoverWidget;
|
return isHoverSticky && isMouseOnContentHoverWidget;
|
||||||
}
|
};
|
||||||
const isMouseOnColorPicker = (mouseEvent: IEditorMouseEvent) => {
|
const isMouseOnColorPicker = (mouseEvent: IEditorMouseEvent) => {
|
||||||
const isMouseOnContentHoverWidget = this._isMouseOnContentHoverWidget(mouseEvent);
|
const isMouseOnContentHoverWidget = this._isMouseOnContentHoverWidget(mouseEvent);
|
||||||
const isColorPickerVisible = this._contentWidget?.isColorPickerVisible;
|
const isColorPickerVisible = this._contentWidget?.isColorPickerVisible;
|
||||||
return isMouseOnContentHoverWidget && isColorPickerVisible;
|
return isMouseOnContentHoverWidget && isColorPickerVisible;
|
||||||
}
|
};
|
||||||
// TODO@aiday-mar verify if the following is necessary code
|
// TODO@aiday-mar verify if the following is necessary code
|
||||||
const isTextSelectedWithinContentHoverWidget = (mouseEvent: IEditorMouseEvent, sticky: boolean) => {
|
const isTextSelectedWithinContentHoverWidget = (mouseEvent: IEditorMouseEvent, sticky: boolean) => {
|
||||||
return sticky
|
return sticky
|
||||||
&& this._contentWidget?.containsNode(mouseEvent.event.browserEvent.view?.document.activeElement)
|
&& this._contentWidget?.containsNode(mouseEvent.event.browserEvent.view?.document.activeElement)
|
||||||
&& !mouseEvent.event.browserEvent.view?.getSelection()?.isCollapsed
|
&& !mouseEvent.event.browserEvent.view?.getSelection()?.isCollapsed;
|
||||||
}
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isMouseOnStickyMarginHoverWidget(mouseEvent, isHoverSticky)
|
isMouseOnStickyMarginHoverWidget(mouseEvent, isHoverSticky)
|
||||||
|
@ -312,7 +312,7 @@ export class HoverController extends Disposable implements IEditorContribution {
|
||||||
otherWidget = contentWidget;
|
otherWidget = contentWidget;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`HoverWidgetType ${hoverWidgetType} is unrecognized`)
|
throw new Error(`HoverWidgetType ${hoverWidgetType} is unrecognized`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const showsOrWillShow = currentWidget.showsOrWillShow(mouseEvent);
|
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 {
|
equals(other: GhostTextPart): boolean {
|
||||||
return this.column === other.column &&
|
return this.column === other.column &&
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { IOpenerService } from '../../common/opener';
|
import { IOpenerService } from '../../common/opener';
|
||||||
|
|
||||||
export const NullOpenerService = Object.freeze({
|
export const NullOpenerService = Object.freeze<IOpenerService>({
|
||||||
_serviceBrand: undefined,
|
_serviceBrand: undefined,
|
||||||
registerOpener() { return Disposable.None; },
|
registerOpener() { return Disposable.None; },
|
||||||
registerValidator() { return Disposable.None; },
|
registerValidator() { return Disposable.None; },
|
||||||
|
@ -16,4 +16,4 @@ export const NullOpenerService = Object.freeze({
|
||||||
registerExternalOpener() { return Disposable.None; },
|
registerExternalOpener() { return Disposable.None; },
|
||||||
async open() { return false; },
|
async open() { return false; },
|
||||||
async resolveExternalUri(uri: URI) { return { resolved: uri, dispose() { } }; },
|
async resolveExternalUri(uri: URI) { return { resolved: uri, dispose() { } }; },
|
||||||
} as IOpenerService);
|
});
|
||||||
|
|
|
@ -76,12 +76,12 @@ export const State = {
|
||||||
Uninitialized: { type: StateType.Uninitialized } as Uninitialized,
|
Uninitialized: { type: StateType.Uninitialized } as Uninitialized,
|
||||||
Disabled: (reason: DisablementReason) => ({ type: StateType.Disabled, reason }) as Disabled,
|
Disabled: (reason: DisablementReason) => ({ type: StateType.Disabled, reason }) as Disabled,
|
||||||
Idle: (updateType: UpdateType, error?: string) => ({ type: StateType.Idle, updateType, error }) as Idle,
|
Idle: (updateType: UpdateType, error?: string) => ({ type: StateType.Idle, updateType, error }) as Idle,
|
||||||
CheckingForUpdates: (explicit: boolean) => ({ type: StateType.CheckingForUpdates, explicit } as CheckingForUpdates),
|
CheckingForUpdates: (explicit: boolean): CheckingForUpdates => ({ type: StateType.CheckingForUpdates, explicit }),
|
||||||
AvailableForDownload: (update: IUpdate) => ({ type: StateType.AvailableForDownload, update } as AvailableForDownload),
|
AvailableForDownload: (update: IUpdate): AvailableForDownload => ({ type: StateType.AvailableForDownload, update }),
|
||||||
Downloading: { type: StateType.Downloading } as Downloading,
|
Downloading: { type: StateType.Downloading } as Downloading,
|
||||||
Downloaded: (update: IUpdate) => ({ type: StateType.Downloaded, update } as Downloaded),
|
Downloaded: (update: IUpdate): Downloaded => ({ type: StateType.Downloaded, update }),
|
||||||
Updating: (update: IUpdate) => ({ type: StateType.Updating, update } as Updating),
|
Updating: (update: IUpdate): Updating => ({ type: StateType.Updating, update }),
|
||||||
Ready: (update: IUpdate) => ({ type: StateType.Ready, update } as Ready),
|
Ready: (update: IUpdate): Ready => ({ type: StateType.Ready, update }),
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IAutoUpdater extends Event.NodeEventEmitter {
|
export interface IAutoUpdater extends Event.NodeEventEmitter {
|
||||||
|
|
|
@ -87,13 +87,13 @@ export class MainThreadDecorations implements MainThreadDecorationsShape {
|
||||||
const registration = this._decorationsService.registerDecorationsProvider({
|
const registration = this._decorationsService.registerDecorationsProvider({
|
||||||
label,
|
label,
|
||||||
onDidChange: emitter.event,
|
onDidChange: emitter.event,
|
||||||
provideDecorations: async (uri, token) => {
|
provideDecorations: async (uri, token): Promise<IDecorationData | undefined> => {
|
||||||
const data = await queue.enqueue(uri, token);
|
const data = await queue.enqueue(uri, token);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const [bubble, tooltip, letter, themeColor] = data;
|
const [bubble, tooltip, letter, themeColor] = data;
|
||||||
return <IDecorationData>{
|
return {
|
||||||
weight: 10,
|
weight: 10,
|
||||||
bubble: bubble ?? false,
|
bubble: bubble ?? false,
|
||||||
color: themeColor?.id,
|
color: themeColor?.id,
|
||||||
|
|
|
@ -107,7 +107,7 @@ function safeStringifyArgumentsToArray(args: IArguments, includeStack: boolean):
|
||||||
if (includeStack) {
|
if (includeStack) {
|
||||||
const stack = new Error().stack;
|
const stack = new Error().stack;
|
||||||
if (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>();
|
private readonly _providers = new Map<string, ProviderEntry>();
|
||||||
|
|
||||||
public addTextProvider(viewType: string, extension: IExtensionDescription, provider: vscode.CustomTextEditorProvider): vscode.Disposable {
|
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 {
|
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 {
|
public get(viewType: string): ProviderEntry | undefined {
|
||||||
return this._providers.get(viewType);
|
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)) {
|
if (this._providers.has(viewType)) {
|
||||||
throw new Error(`Provider for viewType:${viewType} already registered`);
|
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));
|
return new extHostTypes.Disposable(() => this._providers.delete(viewType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -792,7 +792,7 @@ class RenameAdapter {
|
||||||
private readonly _logService: ILogService
|
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 doc = this._documents.getDocument(resource);
|
||||||
const pos = typeConvert.Position.to(position);
|
const pos = typeConvert.Position.to(position);
|
||||||
|
@ -807,7 +807,7 @@ class RenameAdapter {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const rejectReason = RenameAdapter._asMessage(err);
|
const rejectReason = RenameAdapter._asMessage(err);
|
||||||
if (rejectReason) {
|
if (rejectReason) {
|
||||||
return <extHostProtocol.IWorkspaceEditDto>{ rejectReason, edits: undefined! };
|
return { rejectReason, edits: undefined! };
|
||||||
} else {
|
} else {
|
||||||
// generic error
|
// generic error
|
||||||
return Promise.reject<extHostProtocol.IWorkspaceEditDto>(err);
|
return Promise.reject<extHostProtocol.IWorkspaceEditDto>(err);
|
||||||
|
@ -849,7 +849,7 @@ class RenameAdapter {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const rejectReason = RenameAdapter._asMessage(err);
|
const rejectReason = RenameAdapter._asMessage(err);
|
||||||
if (rejectReason) {
|
if (rejectReason) {
|
||||||
return <languages.RenameLocation & languages.Rejection>{ rejectReason, range: undefined!, text: undefined! };
|
return { rejectReason, range: undefined!, text: undefined! };
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject<any>(err);
|
return Promise.reject<any>(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,15 +30,15 @@ export function serializeWebviewMessage(
|
||||||
const replacer = (_key: string, value: any) => {
|
const replacer = (_key: string, value: any) => {
|
||||||
if (value instanceof ArrayBuffer) {
|
if (value instanceof ArrayBuffer) {
|
||||||
const index = arrayBuffers.add(value);
|
const index = arrayBuffers.add(value);
|
||||||
return <extHostProtocol.WebviewMessageArrayBufferReference>{
|
return {
|
||||||
$$vscode_array_buffer_reference$$: true,
|
$$vscode_array_buffer_reference$$: true,
|
||||||
index,
|
index,
|
||||||
};
|
} satisfies extHostProtocol.WebviewMessageArrayBufferReference;
|
||||||
} else if (ArrayBuffer.isView(value)) {
|
} else if (ArrayBuffer.isView(value)) {
|
||||||
const type = getTypedArrayType(value);
|
const type = getTypedArrayType(value);
|
||||||
if (type) {
|
if (type) {
|
||||||
const index = arrayBuffers.add(value.buffer);
|
const index = arrayBuffers.add(value.buffer);
|
||||||
return <extHostProtocol.WebviewMessageArrayBufferReference>{
|
return {
|
||||||
$$vscode_array_buffer_reference$$: true,
|
$$vscode_array_buffer_reference$$: true,
|
||||||
index,
|
index,
|
||||||
view: {
|
view: {
|
||||||
|
@ -46,7 +46,7 @@ export function serializeWebviewMessage(
|
||||||
byteLength: value.byteLength,
|
byteLength: value.byteLength,
|
||||||
byteOffset: value.byteOffset,
|
byteOffset: value.byteOffset,
|
||||||
}
|
}
|
||||||
};
|
} satisfies extHostProtocol.WebviewMessageArrayBufferReference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -418,7 +418,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
|
||||||
configuration: this._actualWorkspace.configuration,
|
configuration: this._actualWorkspace.configuration,
|
||||||
folders,
|
folders,
|
||||||
isUntitled: this._actualWorkspace.isUntitled
|
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 :
|
const excludePattern = (typeof options.exclude === 'string') ? options.exclude :
|
||||||
options.exclude ? options.exclude.pattern : undefined;
|
options.exclude ? options.exclude.pattern : undefined;
|
||||||
|
|
||||||
const fileQueries = <IFileQueryBuilderOptions>{
|
const fileQueries: IFileQueryBuilderOptions = {
|
||||||
ignoreSymlinks: typeof options.followSymlinks === 'boolean' ? !options.followSymlinks : undefined,
|
ignoreSymlinks: typeof options.followSymlinks === 'boolean' ? !options.followSymlinks : undefined,
|
||||||
disregardIgnoreFiles: typeof options.useIgnoreFiles === 'boolean' ? !options.useIgnoreFiles : undefined,
|
disregardIgnoreFiles: typeof options.useIgnoreFiles === 'boolean' ? !options.useIgnoreFiles : undefined,
|
||||||
disregardGlobalIgnoreFiles: typeof options.useGlobalIgnoreFiles === 'boolean' ? !options.useGlobalIgnoreFiles : undefined,
|
disregardGlobalIgnoreFiles: typeof options.useGlobalIgnoreFiles === 'boolean' ? !options.useGlobalIgnoreFiles : undefined,
|
||||||
|
@ -561,7 +561,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
|
||||||
p.results!.forEach(rawResult => {
|
p.results!.forEach(rawResult => {
|
||||||
const result: ITextSearchResult<URI> = revive(rawResult);
|
const result: ITextSearchResult<URI> = revive(rawResult);
|
||||||
if (resultIsMatch(result)) {
|
if (resultIsMatch(result)) {
|
||||||
callback(<vscode.TextSearchMatch>{
|
callback({
|
||||||
uri,
|
uri,
|
||||||
preview: {
|
preview: {
|
||||||
text: result.preview.text,
|
text: result.preview.text,
|
||||||
|
@ -572,13 +572,13 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
|
||||||
ranges: mapArrayOrNot(
|
ranges: mapArrayOrNot(
|
||||||
result.ranges,
|
result.ranges,
|
||||||
r => new Range(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn))
|
r => new Range(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn))
|
||||||
});
|
} satisfies vscode.TextSearchMatch);
|
||||||
} else {
|
} else {
|
||||||
callback(<vscode.TextSearchContext>{
|
callback({
|
||||||
uri,
|
uri,
|
||||||
text: result.text,
|
text: result.text,
|
||||||
lineNumber: result.lineNumber
|
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);
|
const menuActions = this.menus.getResourceActions([node], templateData.elementDisposable);
|
||||||
templateData.actionBar.push(menuActions.actions, { icon: true, label: false });
|
templateData.actionBar.push(menuActions.actions, { icon: true, label: false });
|
||||||
|
|
|
@ -335,8 +335,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
||||||
private onDidChangeItems(skipDynamicLayout?: boolean) {
|
private onDidChangeItems(skipDynamicLayout?: boolean) {
|
||||||
if (this.tree && this._visible) {
|
if (this.tree && this._visible) {
|
||||||
const treeItems = (this.viewModel?.getItems() ?? [])
|
const treeItems = (this.viewModel?.getItems() ?? [])
|
||||||
.map(item => {
|
.map((item): ITreeElement<ChatTreeItem> => {
|
||||||
return <ITreeElement<ChatTreeItem>>{
|
return {
|
||||||
element: item,
|
element: item,
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
collapsible: false
|
collapsible: false
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { Position } from 'vs/editor/common/core/position';
|
||||||
import { Range } from 'vs/editor/common/core/range';
|
import { Range } from 'vs/editor/common/core/range';
|
||||||
import { IWordAtPosition, getWordAtText } from 'vs/editor/common/core/wordHelper';
|
import { IWordAtPosition, getWordAtText } from 'vs/editor/common/core/wordHelper';
|
||||||
import { IDecorationOptions } from 'vs/editor/common/editorCommon';
|
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 { ITextModel } from 'vs/editor/common/model';
|
||||||
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
|
@ -300,10 +300,10 @@ class SlashCommandCompletions extends Disposable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <CompletionList>{
|
return {
|
||||||
suggestions: slashCommands.map((c, i) => {
|
suggestions: slashCommands.map((c, i): CompletionItem => {
|
||||||
const withSlash = `/${c.command}`;
|
const withSlash = `/${c.command}`;
|
||||||
return <CompletionItem>{
|
return {
|
||||||
label: withSlash,
|
label: withSlash,
|
||||||
insertText: c.executeImmediately ? '' : `${withSlash} `,
|
insertText: c.executeImmediately ? '' : `${withSlash} `,
|
||||||
detail: c.detail,
|
detail: c.detail,
|
||||||
|
@ -354,11 +354,11 @@ class AgentCompletions extends Disposable {
|
||||||
.filter(a => !a.isDefault)
|
.filter(a => !a.isDefault)
|
||||||
.filter(a => a.locations.includes(widget.location));
|
.filter(a => a.locations.includes(widget.location));
|
||||||
|
|
||||||
return <CompletionList>{
|
return {
|
||||||
suggestions: agents.map((a, i) => {
|
suggestions: agents.map((a, i): CompletionItem => {
|
||||||
const withAt = `@${a.name}`;
|
const withAt = `@${a.name}`;
|
||||||
const isDupe = !!agents.find(other => other.name === a.name && other.id !== a.id);
|
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
|
// Leading space is important because detail has no space at the start by design
|
||||||
label: isDupe ?
|
label: isDupe ?
|
||||||
{ label: withAt, description: a.description, detail: ` (${a.extensionPublisherDisplayName})` } :
|
{ label: withAt, description: a.description, detail: ` (${a.extensionPublisherDisplayName})` } :
|
||||||
|
@ -409,10 +409,10 @@ class AgentCompletions extends Disposable {
|
||||||
}
|
}
|
||||||
|
|
||||||
const usedAgent = parsedRequest[usedAgentIdx] as ChatRequestAgentPart;
|
const usedAgent = parsedRequest[usedAgentIdx] as ChatRequestAgentPart;
|
||||||
return <CompletionList>{
|
return {
|
||||||
suggestions: usedAgent.agent.slashCommands.map((c, i) => {
|
suggestions: usedAgent.agent.slashCommands.map((c, i): CompletionItem => {
|
||||||
const withSlash = `/${c.name}`;
|
const withSlash = `/${c.name}`;
|
||||||
return <CompletionItem>{
|
return {
|
||||||
label: withSlash,
|
label: withSlash,
|
||||||
insertText: `${withSlash} `,
|
insertText: `${withSlash} `,
|
||||||
detail: c.description,
|
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);
|
const afterRange = new Range(position.lineNumber, range.replace.startColumn, position.lineNumber, range.replace.startColumn + '#file:'.length);
|
||||||
return <CompletionList>{
|
return {
|
||||||
suggestions: [
|
suggestions: [
|
||||||
<CompletionItem>{
|
{
|
||||||
label: `${chatVariableLeader}file`,
|
label: `${chatVariableLeader}file`,
|
||||||
insertText: `${chatVariableLeader}file:`,
|
insertText: `${chatVariableLeader}file:`,
|
||||||
detail: localize('pickFileLabel', "Pick a file"),
|
detail: localize('pickFileLabel', "Pick a file"),
|
||||||
|
@ -548,7 +548,7 @@ class BuiltinDynamicCompletions extends Disposable {
|
||||||
kind: CompletionItemKind.Text,
|
kind: CompletionItemKind.Text,
|
||||||
command: { id: SelectAndInsertFileAction.ID, title: SelectAndInsertFileAction.ID, arguments: [{ widget, range: afterRange }] },
|
command: { id: SelectAndInsertFileAction.ID, title: SelectAndInsertFileAction.ID, arguments: [{ widget, range: afterRange }] },
|
||||||
sortText: 'z'
|
sortText: 'z'
|
||||||
}
|
} satisfies CompletionItem
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -607,9 +607,9 @@ class VariableCompletions extends Disposable {
|
||||||
const variableItems = Array.from(this.chatVariablesService.getVariables())
|
const variableItems = Array.from(this.chatVariablesService.getVariables())
|
||||||
// This doesn't look at dynamic variables like `file`, where multiple makes sense.
|
// This doesn't look at dynamic variables like `file`, where multiple makes sense.
|
||||||
.filter(v => !usedVariables.some(usedVar => usedVar.variableName === v.name))
|
.filter(v => !usedVariables.some(usedVar => usedVar.variableName === v.name))
|
||||||
.map(v => {
|
.map((v): CompletionItem => {
|
||||||
const withLeader = `${chatVariableLeader}${v.name}`;
|
const withLeader = `${chatVariableLeader}${v.name}`;
|
||||||
return <CompletionItem>{
|
return {
|
||||||
label: withLeader,
|
label: withLeader,
|
||||||
range,
|
range,
|
||||||
insertText: withLeader + ' ',
|
insertText: withLeader + ' ',
|
||||||
|
@ -619,7 +619,7 @@ class VariableCompletions extends Disposable {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return <CompletionList>{
|
return {
|
||||||
suggestions: variableItems
|
suggestions: variableItems
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ export class ChatService extends Disposable implements IChatService {
|
||||||
throw new Error('Expected array');
|
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
|
// Revive serialized markdown strings in response data
|
||||||
for (const request of session.requests) {
|
for (const request of session.requests) {
|
||||||
if (Array.isArray(request.response)) {
|
if (Array.isArray(request.response)) {
|
||||||
|
@ -267,7 +267,7 @@ export class ChatService extends Disposable implements IChatService {
|
||||||
|
|
||||||
acc[session.sessionId] = session;
|
acc[session.sessionId] = session;
|
||||||
return acc;
|
return acc;
|
||||||
}, {} as ISerializableChatsData);
|
}, {});
|
||||||
return sessions;
|
return sessions;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.error('deserializeChats', `Malformed session data: ${err}. [${sessionData.substring(0, 20)}${sessionData.length > 20 ? '...' : ''}]`);
|
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.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
getSession(sessionId: string): IChatModel | undefined {
|
getSession(sessionId: string): IChatModel | undefined {
|
||||||
|
// eslint-disable-next-line local/code-no-dangerous-type-assertions
|
||||||
return {} as IChatModel;
|
return {} as IChatModel;
|
||||||
}
|
}
|
||||||
getOrRestoreSession(sessionId: string): IChatModel | undefined {
|
getOrRestoreSession(sessionId: string): IChatModel | undefined {
|
||||||
|
|
|
@ -744,7 +744,7 @@ class OpenEditorsDragAndDrop implements IListDragAndDrop<OpenEditor | IEditorGro
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// Allow droping files to open them
|
// 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;
|
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 {
|
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 dragPosInElement = dragOffset - cellTop;
|
||||||
const dragPosRatio = dragPosInElement / cellHeight;
|
const dragPosRatio = dragPosInElement / cellHeight;
|
||||||
|
|
||||||
return <CellDragEvent>{
|
return {
|
||||||
browserEvent: event,
|
browserEvent: event,
|
||||||
draggedOverCell,
|
draggedOverCell,
|
||||||
cellTop,
|
cellTop,
|
||||||
|
|
|
@ -21,7 +21,6 @@ import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/commo
|
||||||
import { ThemeIcon } from 'vs/base/common/themables';
|
import { ThemeIcon } from 'vs/base/common/themables';
|
||||||
import { ViewContainerLocation } from 'vs/workbench/common/views';
|
import { ViewContainerLocation } from 'vs/workbench/common/views';
|
||||||
import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSION_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
|
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 { 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 { mimetypeIcon } from 'vs/workbench/contrib/notebook/browser/notebookIcons';
|
||||||
import { CellContentPart } from 'vs/workbench/contrib/notebook/browser/view/cellPart';
|
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, {
|
const toolbar = this._renderDisposableStore.add(this.instantiationService.createInstance(WorkbenchToolBar, mimeTypePicker, {
|
||||||
renderDropdownAsChildElement: false
|
renderDropdownAsChildElement: false
|
||||||
}));
|
}));
|
||||||
toolbar.context = <INotebookOutputActionContext>{
|
toolbar.context = {
|
||||||
ui: true,
|
ui: true,
|
||||||
cell: this.output.cellViewModel as ICellViewModel,
|
cell: this.output.cellViewModel as ICellViewModel,
|
||||||
outputViewModel: this.output,
|
outputViewModel: this.output,
|
||||||
|
|
|
@ -64,23 +64,23 @@ export class CollapsedCodeCellExecutionIcon extends Disposable {
|
||||||
const state = runState?.state;
|
const state = runState?.state;
|
||||||
const { lastRunSuccess } = internalMetadata;
|
const { lastRunSuccess } = internalMetadata;
|
||||||
if (!state && lastRunSuccess) {
|
if (!state && lastRunSuccess) {
|
||||||
return <IExecutionItem>{
|
return {
|
||||||
text: `$(${successStateIcon.id})`,
|
text: `$(${successStateIcon.id})`,
|
||||||
tooltip: localize('notebook.cell.status.success', "Success"),
|
tooltip: localize('notebook.cell.status.success', "Success"),
|
||||||
};
|
};
|
||||||
} else if (!state && lastRunSuccess === false) {
|
} else if (!state && lastRunSuccess === false) {
|
||||||
return <IExecutionItem>{
|
return {
|
||||||
text: `$(${errorStateIcon.id})`,
|
text: `$(${errorStateIcon.id})`,
|
||||||
tooltip: localize('notebook.cell.status.failure', "Failure"),
|
tooltip: localize('notebook.cell.status.failure', "Failure"),
|
||||||
};
|
};
|
||||||
} else if (state === NotebookCellExecutionState.Pending || state === NotebookCellExecutionState.Unconfirmed) {
|
} else if (state === NotebookCellExecutionState.Pending || state === NotebookCellExecutionState.Unconfirmed) {
|
||||||
return <IExecutionItem>{
|
return {
|
||||||
text: `$(${pendingStateIcon.id})`,
|
text: `$(${pendingStateIcon.id})`,
|
||||||
tooltip: localize('notebook.cell.status.pending', "Pending"),
|
tooltip: localize('notebook.cell.status.pending', "Pending"),
|
||||||
};
|
};
|
||||||
} else if (state === NotebookCellExecutionState.Executing) {
|
} else if (state === NotebookCellExecutionState.Executing) {
|
||||||
const icon = ThemeIcon.modify(executingStateIcon, 'spin');
|
const icon = ThemeIcon.modify(executingStateIcon, 'spin');
|
||||||
return <IExecutionItem>{
|
return {
|
||||||
text: `$(${icon.id})`,
|
text: `$(${icon.id})`,
|
||||||
tooltip: localize('notebook.cell.status.executing', "Executing"),
|
tooltip: localize('notebook.cell.status.executing', "Executing"),
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@ export class ConfigureLanguageBasedSettingsAction extends Action {
|
||||||
|
|
||||||
override async run(): Promise<void> {
|
override async run(): Promise<void> {
|
||||||
const languages = this.languageService.getSortedRegisteredLanguageNames();
|
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);
|
const description: string = nls.localize('languageDescriptionConfigured', "({0})", languageId);
|
||||||
// construct a fake resource to be able to show nice icons if any
|
// construct a fake resource to be able to show nice icons if any
|
||||||
let fakeResource: URI | undefined;
|
let fakeResource: URI | undefined;
|
||||||
|
@ -54,7 +54,7 @@ export class ConfigureLanguageBasedSettingsAction extends Action {
|
||||||
label: languageName,
|
label: languageName,
|
||||||
iconClasses: getIconClasses(this.modelService, this.languageService, fakeResource),
|
iconClasses: getIconClasses(this.modelService, this.languageService, fakeResource),
|
||||||
description
|
description
|
||||||
} as IQuickPickItem;
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.quickInputService.pick(picks, { placeHolder: nls.localize('pickLanguage', "Select Language") })
|
await this.quickInputService.pick(picks, { placeHolder: nls.localize('pickLanguage', "Select Language") })
|
||||||
|
|
|
@ -3585,7 +3585,7 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
|
||||||
type: 'actionButton',
|
type: 'actionButton',
|
||||||
repository: inputOrElement,
|
repository: inputOrElement,
|
||||||
button: actionButton
|
button: actionButton
|
||||||
} as ISCMActionButton);
|
} satisfies ISCMActionButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceGroups
|
// ResourceGroups
|
||||||
|
@ -3613,7 +3613,7 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
|
||||||
ariaLabel = localize('syncOutgoingSeparatorHeaderAriaLabel', "Outgoing changes");
|
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);
|
children.push(...historyItemGroups);
|
||||||
|
|
|
@ -83,7 +83,7 @@ export class NotebookSearchService implements INotebookSearchService {
|
||||||
|
|
||||||
const promise = Promise.all([localResultPromise, closedResultsPromise]);
|
const promise = Promise.all([localResultPromise, closedResultsPromise]);
|
||||||
return {
|
return {
|
||||||
completeData: promise.then((resolvedPromise) => {
|
completeData: promise.then((resolvedPromise): ISearchComplete => {
|
||||||
const openNotebookResult = resolvedPromise[0];
|
const openNotebookResult = resolvedPromise[0];
|
||||||
const closedNotebookResult = resolvedPromise[1];
|
const closedNotebookResult = resolvedPromise[1];
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ export class NotebookSearchService implements INotebookSearchService {
|
||||||
results.forEach(onProgress);
|
results.forEach(onProgress);
|
||||||
}
|
}
|
||||||
this.logService.trace(`local notebook search time | ${searchLocalEnd - searchStart}ms`);
|
this.logService.trace(`local notebook search time | ${searchLocalEnd - searchStart}ms`);
|
||||||
return <ISearchComplete>{
|
return {
|
||||||
messages: [],
|
messages: [],
|
||||||
limitHit: resolved.reduce((prev, cur) => prev || cur.limitHit, false),
|
limitHit: resolved.reduce((prev, cur) => prev || cur.limitHit, false),
|
||||||
results,
|
results,
|
||||||
|
@ -152,7 +152,7 @@ export class NotebookSearchService implements INotebookSearchService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = <NotebookPriorityInfo>{
|
const info: NotebookPriorityInfo = {
|
||||||
isFromSettings: true,
|
isFromSettings: true,
|
||||||
filenamePatterns: [association.filenamePattern]
|
filenamePatterns: [association.filenamePattern]
|
||||||
};
|
};
|
||||||
|
|
|
@ -196,7 +196,7 @@ export class FolderMatchRenderer extends Disposable implements ICompressibleTree
|
||||||
templateData.badge.setCount(count);
|
templateData.badge.setCount(count);
|
||||||
templateData.badge.setTitleFormat(count > 1 ? nls.localize('searchFileMatches', "{0} files found", count) : nls.localize('searchFileMatch', "{0} file found", 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.setCount(count);
|
||||||
templateData.badge.setTitleFormat(count > 1 ? nls.localize('searchMatches', "{0} matches found", count) : nls.localize('searchMatch', "{0} match found", 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());
|
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.lineNumber.textContent = lineNumberStr + extraLinesStr;
|
||||||
templateData.disposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), templateData.lineNumber, this.getMatchTitle(match, showLineNumbers)));
|
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({
|
taskDefinitions.push({
|
||||||
$ref: '#/definitions/taskDescription'
|
$ref: '#/definitions/taskDescription'
|
||||||
} as IJSONSchema);
|
});
|
||||||
|
|
||||||
const definitionsTaskRunnerConfigurationProperties = definitions.taskRunnerConfiguration.properties!;
|
const definitionsTaskRunnerConfigurationProperties = definitions.taskRunnerConfiguration.properties!;
|
||||||
const tasks = definitionsTaskRunnerConfigurationProperties.tasks;
|
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.'));
|
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,
|
submenu: MenuId.TimelineFilterSubMenu,
|
||||||
title: localize('filterTimeline', "Filter Timeline"),
|
title: localize('filterTimeline', "Filter Timeline"),
|
||||||
group: 'navigation',
|
group: 'navigation',
|
||||||
order: 100,
|
order: 100,
|
||||||
icon: timelineFilter
|
icon: timelineFilter
|
||||||
});
|
} satisfies ISubmenuItem);
|
||||||
|
|
||||||
registerSingleton(ITimelineService, TimelineService, InstantiationType.Delayed);
|
registerSingleton(ITimelineService, TimelineService, InstantiationType.Delayed);
|
||||||
|
|
|
@ -1207,7 +1207,7 @@ class TimelineTreeRenderer implements ITreeRenderer<TreeElement, FuzzyScore, Tim
|
||||||
template.timestamp.ariaLabel = item.relativeTimeFullWord ?? '';
|
template.timestamp.ariaLabel = item.relativeTimeFullWord ?? '';
|
||||||
template.timestamp.parentElement!.classList.toggle('timeline-timestamp--duplicate', isTimelineItem(item) && item.hideRelativeTime);
|
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.actionRunner = new TimelineActionRunner();
|
||||||
template.actionBar.push(this.commands.getItemActions(item), { icon: true, label: false });
|
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 storageService = accessor.get(IStorageService);
|
||||||
const quickInputService = accessor.get(IQuickInputService);
|
const quickInputService = accessor.get(IQuickInputService);
|
||||||
const storage = new UserTrustedExtensionIdStorage(storageService);
|
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) {
|
if (items.length === 0) {
|
||||||
await quickInputService.pick([{ label: localize('no', 'There are currently no authorized extension URIs.') }]);
|
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 {
|
function patternInfoToQuery(patternInfo: IPatternInfo): TextSearchQuery {
|
||||||
return <TextSearchQuery>{
|
return {
|
||||||
isCaseSensitive: patternInfo.isCaseSensitive || false,
|
isCaseSensitive: patternInfo.isCaseSensitive || false,
|
||||||
isRegExp: patternInfo.isRegExp || false,
|
isRegExp: patternInfo.isRegExp || false,
|
||||||
isWordMatch: patternInfo.isWordMatch || false,
|
isWordMatch: patternInfo.isWordMatch || false,
|
||||||
|
@ -283,7 +283,7 @@ export class TextSearchResultsCollector {
|
||||||
function extensionResultToFrontendResult(data: TextSearchResult): ITextSearchResult {
|
function extensionResultToFrontendResult(data: TextSearchResult): ITextSearchResult {
|
||||||
// Warning: result from RipgrepTextSearchEH has fake Range. Don't depend on any other props beyond these...
|
// Warning: result from RipgrepTextSearchEH has fake Range. Don't depend on any other props beyond these...
|
||||||
if (extensionResultIsMatch(data)) {
|
if (extensionResultIsMatch(data)) {
|
||||||
return <ITextSearchMatch>{
|
return {
|
||||||
preview: {
|
preview: {
|
||||||
matches: mapArrayOrNot(data.preview.matches, m => ({
|
matches: mapArrayOrNot(data.preview.matches, m => ({
|
||||||
startLineNumber: m.start.line,
|
startLineNumber: m.start.line,
|
||||||
|
@ -299,12 +299,12 @@ function extensionResultToFrontendResult(data: TextSearchResult): ITextSearchRes
|
||||||
endLineNumber: r.end.line,
|
endLineNumber: r.end.line,
|
||||||
endColumn: r.end.character
|
endColumn: r.end.character
|
||||||
}))
|
}))
|
||||||
};
|
} satisfies ITextSearchMatch;
|
||||||
} else {
|
} else {
|
||||||
return <ITextSearchContext>{
|
return {
|
||||||
text: data.text,
|
text: data.text,
|
||||||
lineNumber: data.lineNumber
|
lineNumber: data.lineNumber
|
||||||
};
|
} satisfies ITextSearchContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue