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