jiebi/CodeConvo huggingface dataset:
flex-grow: 0; } <del> .merge-editor-diff { </del> <ins> .monaco-workbench .merge-editor .merge-editor-diff { </ins> background-color: var(--vscode-mergeEditor-change-background); } <del> .merge-editor-diff-word { </del> <ins> .monaco-workbench .merge-editor .merge-editor-diff-word { </ins> background-color: var(--vscode-mergeEditor-change-word-background); } /* BEGIN: .merge-editor-block */ <del> .merge-editor-block:not(.handled) { </del> <ins> .monaco-workbench .merge-editor .merge-editor-block:not(.handled) { </ins> background-color: var(--vscode-mergeEditor-conflict-unhandledUnfocused-background); } <del> .merge-editor-block:not(.handled):not(.focused) { </del> <ins> .monaco-workbench .merge-editor .merge-editor-block:not(.handled):not(.focused) { </ins> border: 1px solid var(--vscode-mergeEditor-conflict-unhandledUnfocused-border); } <del> .merge-editor-block:not(.handled).focused { </del> <ins> .monaco-workbench .merge-editor .merge-editor-block:not(.handled).focused { </ins> border: 2px solid var(--vscode-mergeEditor-conflict-unhandledFocused-border); } <del> .merge-editor-block.handled:not(.focused) { </del> <ins> .monaco-workbench .merge-editor .merge-editor-block.handled:not(.focused) { </ins> border: 1px solid var(--vscode-mergeEditor-conflict-handledUnfocused-border); } <del> .merge-editor-block.handled:not(.focused).conflicting { </del> <ins> .monaco-workbench .merge-editor .merge-editor-block.handled:not(.focused).conflicting { </ins> background-color: var(--vscode-mergeEditor-conflict-handledUnfocused-background); } <del> .merge-editor-block.handled.focused { </del> <ins> .monaco-workbench .merge-editor .merge-editor-block.handled.focused { </ins> border: 1px solid var(--vscode-mergeEditor-conflict-handledFocused-border); } <del> .merge-editor-block.handled.focused.conflicting { </del> <ins> .monaco-workbench .merge-editor .merge-editor-block.handled.focused.conflicting { </ins> background-color: var(--vscode-mergeEditor-conflict-handledFocused-background); } <del> .merge-editor-simplified.input.i1, .merge-editor-block.use-simplified-decorations.input.i1 { </del> <ins> .monaco-workbench .merge-editor .merge-editor-simplified.input.i1, .merge-editor-block.use-simplified-decorations.input.i1 { </ins> background-color: var(--vscode-mergeEditor-conflict-input1-background); } <del> .merge-editor-simplified.input.i2, .merge-editor-block.use-simplified-decorations.input.i2 { </del> <ins> .monaco-workbench .merge-editor .merge-editor-simplified.input.i2, .merge-editor-block.use-simplified-decorations.input.i2 { </ins> background-color: var(--vscode-mergeEditor-conflict-input2-background); } /* END: .merge-editor-block */ <del> .gutter.monaco-editor>div { </del> <ins> .gutter.monaco-editor > div { </ins> position: absolute; }
color: var(--vscode-editorCodeLens-foreground) } <del> .merge-editor-conflict-actions>span, .merge-editor-conflict-actions>a { </del> <ins> .merge-editor-conflict-actions > span, .merge-editor-conflict-actions > a { </ins> user-select: none; -webkit-user-select: none; white-space: nowrap; } <del> .merge-editor-conflict-actions>a { </del> <ins> .merge-editor-conflict-actions > a { </ins> text-decoration: none; } <del> .merge-editor-conflict-actions>a:hover { </del> <ins> .merge-editor-conflict-actions > a:hover { </ins> cursor: pointer; color: var(--vscode-editorLink-activeForeground) !important; } <del> .merge-editor-conflict-actions>a:hover .codicon { </del> <ins> .merge-editor-conflict-actions > a:hover .codicon { </ins> color: var(--vscode-editorLink-activeForeground) !important; }
import { $, addDisposableListener, append, EventHelper, EventType } from 'vs/base/browser/dom'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { EventType as GestureEventType, Gesture } from 'vs/base/browser/touch'; <del> import { AnchorAlignment, IAnchor, IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; </del> <ins> import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; </ins> import { IMenuOptions } from 'vs/base/browser/ui/menu/menu'; import { ActionRunner, IAction } from 'vs/base/common/actions'; import { Emitter } from 'vs/base/common/event';
(container: HTMLElement): IDisposable | null; } <del> export interface IBaseDropdownOptions { </del> <ins> interface IBaseDropdownOptions { </ins> label?: string; labelRenderer?: ILabelRenderer; } <del> export class BaseDropdown extends ActionRunner { </del> <ins> class BaseDropdown extends ActionRunner { </ins> private _element: HTMLElement; private boxContainer?: HTMLElement; private _label?: HTMLElement;
} } <del> export interface IDropdownOptions extends IBaseDropdownOptions { contextViewProvider: IContextViewProvider; } export class Dropdown extends BaseDropdown { private contextViewProvider: IContextViewProvider; constructor(container: HTMLElement, options: IDropdownOptions) { super(container, options); this.contextViewProvider = options.contextViewProvider; } override show(): void { super.show(); this.element.classList.add('active'); this.contextViewProvider.showContextView({ getAnchor: () => this.getAnchor(), render: (container) => { return this.renderContents(container); }, onDOMEvent: (e, activeElement) => { this.onEvent(e, activeElement); }, onHide: () => this.onHide() }); } protected getAnchor(): HTMLElement | IAnchor { return this.element; } protected onHide(): void { this.element.classList.remove('active'); } override hide(): void { super.hide(); this.contextViewProvider?.hideContextView(); } protected renderContents(container: HTMLElement): IDisposable | null { return null; } } </del> export interface IActionProvider { getActions(): readonly IAction[]; }
} <del> export function findValidPasteFileTarget(explorerService: IExplorerService, targetFolder: ExplorerItem, fileToPaste: { resource: URI; isDirectory?: boolean; allowOverwrite: boolean }, incrementalNaming: 'simple' | 'smart' | 'disabled'): URI { let name = resources.basenameOrAuthority(fileToPaste.resource); </del> <ins> export async function findValidPasteFileTarget( explorerService: IExplorerService, fileService: IFileService, dialogService: IDialogService, targetFolder: ExplorerItem, fileToPaste: { resource: URI; isDirectory?: boolean; allowOverwrite: boolean }, incrementalNaming: 'simple' | 'smart' | 'disabled' ): Promise<URI | undefined> { let name = resources.basenameOrAuthority(fileToPaste.resource); </ins> let candidate = resources.joinPath(targetFolder.resource, name); <ins> // In the disabled case we must ask if it's ok to overwrite the file if it exists if (incrementalNaming === 'disabled') { const canOverwrite = await askForOverwrite(fileService, dialogService, candidate); if (!canOverwrite) { return; } } </ins> while (true && !fileToPaste.allowOverwrite) { if (!explorerService.findClosest(candidate)) { break;
target = element.isDirectory ? element : element.parent!; } <del> const targetFile = findValidPasteFileTarget(explorerService, target, { resource: fileToPaste, isDirectory: fileToPasteStat.isDirectory, allowOverwrite: pasteShouldMove || incrementalNaming === 'disabled' }, incrementalNaming); if (incrementalNaming === 'disabled') { const canOverwrite = await askForOverwrite(fileService, dialogService, targetFile); if (!canOverwrite) { return; } </del> <ins> const targetFile = await findValidPasteFileTarget( explorerService, fileService, dialogService, target, { resource: fileToPaste, isDirectory: fileToPasteStat.isDirectory, allowOverwrite: pasteShouldMove || incrementalNaming === 'disabled' }, incrementalNaming ); if (!targetFile) { return undefined; </ins> } return { source: fileToPaste, target: targetFile };
if (sourceTargetPairs.length >= 1) { // Move/Copy File if (pasteShouldMove) { <del> const resourceFileEdits = sourceTargetPairs.map(pair => new ResourceFileEdit(pair.source, pair.target)); </del> <ins> const resourceFileEdits = sourceTargetPairs.map(pair => new ResourceFileEdit(pair.source, pair.target, { overwrite: incrementalNaming === 'disabled' })); </ins> const options = { confirmBeforeUndo: configurationService.getValue<IFilesConfiguration>().explorer.confirmUndo === UndoConfirmLevel.Verbose, progressLabel: sourceTargetPairs.length > 1 ? nls.localize({ key: 'movingBulkEdit', comment: ['Placeholder will be replaced by the number of files being moved'] }, "Moving {0} files", sourceTargetPairs.length)
// Reuse duplicate action when user copies const explorerConfig = this.configurationService.getValue<IFilesConfiguration>().explorer; <del> const resourceFileEdits = sources.map(({ resource, isDirectory }) => (new ResourceFileEdit(resource, findValidPasteFileTarget(this.explorerService, target, { resource, isDirectory, allowOverwrite: false }, explorerConfig.incrementalNaming), { copy: true }))); </del> <ins> const resourceFileEdits: ResourceFileEdit[] = []; for (const { resource, isDirectory } of sources) { const allowOverwrite = explorerConfig.incrementalNaming === 'disabled'; const newResource = await findValidPasteFileTarget(this.explorerService, this.fileService, this.dialogService, target, { resource, isDirectory, allowOverwrite }, explorerConfig.incrementalNaming ); if (!newResource) { continue; } const resourceEdit = new ResourceFileEdit(resource, newResource, { copy: true, overwrite: allowOverwrite }); resourceFileEdits.push(resourceEdit); } </ins> const labelSufix = getFileOrFolderLabelSufix(sources); await this.explorerService.applyBulkEdit(resourceFileEdits, { confirmBeforeUndo: explorerConfig.confirmUndo === UndoConfirmLevel.Default || explorerConfig.confirmUndo === UndoConfirmLevel.Verbose,
const fontFamily = this._generateFontFamily(); styleSheets.push(` <del> :root { --notebook-cell-output-font-size: ${fontSize}px; --notebook-cell-output-font-family: ${fontFamily}; </del> <ins> .notebook-editor { --notebook-cell-output-font-size: ${outputFontSize}px; </ins> --notebook-cell-input-preview-font-size: ${fontSize}px; --notebook-cell-input-preview-font-family: ${fontFamily}; }
import { ILogService } from 'vs/platform/log/common/log'; import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; <ins> import { isObject, isString } from 'vs/base/common/types'; import { Schemas } from 'vs/base/common/network'; </ins> interface IStoredProfileExtension { identifier: IExtensionIdentifier; <del> location: UriComponents; </del> <ins> location: UriComponents | string; </ins> version: string; metadata?: Metadata; }
if (!Array.isArray(storedProfileExtensions)) { throw new Error(`Invalid extensions content in ${file.toString()}`); } <ins> // TODO @sandy081: Remove this migration after couple of releases let migrate = false; </ins> for (const e of storedProfileExtensions) { if (!isStoredProfileExtension(e)) { throw new Error(`Invalid extensions content in ${file.toString()}`); } <ins> let location: URI; if (isString(e.location)) { location = this.resolveExtensionLocation(file, e.location); } else { location = URI.revive(e.location); const relativePath = this.toRelativePath(file, location); if (relativePath) { migrate = true; e.location = relativePath; } } </ins> extensions.push({ identifier: e.identifier, <del> location: URI.revive(e.location), </del> <ins> location, </ins> version: e.version, metadata: e.metadata, }); } <ins> if (migrate) { await this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions))); } </ins> } // Update
const storedProfileExtensions: IStoredProfileExtension[] = extensions.map(e => ({ identifier: e.identifier, version: e.version, <del> location: e.location.toJSON(), </del> <ins> location: this.toRelativePath(file, e.location) ?? e.location.toJSON(), </ins> metadata: e.metadata })); await this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)));
}); } <ins> private toRelativePath(extensionsProfileLocation: URI, extensionLocation: URI): string | undefined { // Extension Profile location scheme is always vscode-userdata and Extension location scheme is always file // Hence we need to convert the Extension Profile location scheme to file to resolve the relative path const parent = this.uriIdentityService.extUri.dirname(extensionsProfileLocation).with({ scheme: Schemas.file }); if (this.uriIdentityService.extUri.isEqualOrParent(extensionLocation, parent)) { return this.uriIdentityService.extUri.relativePath(parent, extensionLocation); } return undefined; } private resolveExtensionLocation(extensionsProfileLocation: URI, path: string): URI { // Extension Profile location scheme is always vscode-userdata and Extension location scheme is always file // Hence we need to convert the Extension Profile location scheme to file to resolve extension location return this.uriIdentityService.extUri.joinPath(this.uriIdentityService.extUri.dirname(extensionsProfileLocation), path).with({ scheme: Schemas.file }); } </ins> private _migrationPromise: Promise<IStoredProfileExtension[] | undefined> | undefined; private async migrateFromOldDefaultProfileExtensionsLocation(): Promise<IStoredProfileExtension[] | undefined> { if (!this._migrationPromise) {
} function isStoredProfileExtension(candidate: any): candidate is IStoredProfileExtension { <del> return typeof candidate === 'object' </del> <ins> return isObject(candidate) </ins> && isIExtensionIdentifier(candidate.identifier) <del> && isUriComponents(candidate.location) && candidate.version && typeof candidate.version === 'string'; </del> <ins> && (isUriComponents(candidate.location) || isString(candidate.location)) && candidate.version && isString(candidate.version); </ins> } function isUriComponents(thing: unknown): thing is UriComponents { if (!thing) { return false; } <del> return typeof (<any>thing).path === 'string' && typeof (<any>thing).scheme === 'string'; </del> <ins> return isString((<any>thing).path) && isString((<any>thing).scheme); </ins> }
private versionId = 0; private bufferSavedVersionId: number | undefined; private ignoreDirtyOnModelContentChange = false; <ins> private ignoreSaveFromSaveParticipants = false; </ins> private static readonly UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD = 500; private lastModelContentChangeFromUndoRedo: number | undefined = undefined;
let versionId = this.versionId; this.trace(`doSave(${versionId}) - enter with versionId ${versionId}`); <ins> // Return early if saved from within save participant to break recursion // // Scenario: a save participant triggers a save() on the model if (this.ignoreSaveFromSaveParticipants) { this.trace(`doSave(${versionId}) - exit - refusing to save() recursively from save participant`); return; } </ins> // Lookup any running pending save for this versionId and return it if found // // Scenario: user invoked the save action multiple times quickly for the same contents
// Run save participants unless save was cancelled meanwhile if (!saveCancellation.token.isCancellationRequested) { <del> await this.textFileService.files.runSaveParticipants(this, { reason: options.reason ?? SaveReason.EXPLICIT }, saveCancellation.token); </del> <ins> this.ignoreSaveFromSaveParticipants = true; try { await this.textFileService.files.runSaveParticipants(this, { reason: options.reason ?? SaveReason.EXPLICIT }, saveCancellation.token); } finally { this.ignoreSaveFromSaveParticipants = false; } </ins> } } catch (error) { this.logService.error(`[text file model] runSaveParticipants(${versionId}) - resulted in an error: ${error.toString()}`, this.resource.toString());
let versionId = this.versionId; this.trace(`doSave(${versionId}) - enter with versionId ${versionId}`); <ins> // Return early if saved from within save participant to break recursion // // Scenario: a save participant triggers a save() on the working copy if (this.ignoreSaveFromSaveParticipants) { this.trace(`doSave(${versionId}) - exit - refusing to save() recursively from save participant`); return; } </ins> // Lookup any running pending save for this versionId and return it if found // // Scenario: user invoked the save action multiple times quickly for the same contents
// Run save participants unless save was cancelled meanwhile if (!saveCancellation.token.isCancellationRequested) { <del> await this.workingCopyFileService.runSaveParticipants(this, { reason: options.reason ?? SaveReason.EXPLICIT }, saveCancellation.token); </del> <ins> this.ignoreSaveFromSaveParticipants = true; try { await this.workingCopyFileService.runSaveParticipants(this, { reason: options.reason ?? SaveReason.EXPLICIT }, saveCancellation.token); } finally { this.ignoreSaveFromSaveParticipants = false; } </ins> } } catch (error) { this.logService.error(`[stored file working copy] runSaveParticipants(${versionId}) - resulted in an error: ${error.toString()}`, this.resource.toString(), this.typeId);
import { basename } from 'vs/base/common/resources'; import { FileChangesEvent, FileChangeType, FileOperationError, FileOperationResult, NotModifiedSinceFileOperationError } from 'vs/platform/files/common/files'; import { SaveReason, SaveSourceRegistry } from 'vs/workbench/common/editor'; <del> import { Promises } from 'vs/base/common/async'; </del> <ins> import { Promises, timeout } from 'vs/base/common/async'; </ins> import { consumeReadable, consumeStream, isReadableStream } from 'vs/base/common/stream'; import { runWithFakedTimers } from 'vs/base/test/common/timeTravelScheduler';
assert.strictEqual(participationCounter, 1); }); <ins> test('Save Participant, calling save from within is unsupported but does not explode (sync save)', async function () { await workingCopy.resolve(); await testSaveFromSaveParticipant(workingCopy, false); }); test('Save Participant, calling save from within is unsupported but does not explode (async save)', async function () { await workingCopy.resolve(); await testSaveFromSaveParticipant(workingCopy, true); }); async function testSaveFromSaveParticipant(workingCopy: StoredFileWorkingCopy<TestStoredFileWorkingCopyModel>, async: boolean): Promise<void> { assert.strictEqual(accessor.workingCopyFileService.hasSaveParticipants, false); const disposable = accessor.workingCopyFileService.addSaveParticipant({ participate: async () => { if (async) { await timeout(10); } await workingCopy.save({ force: true }); } }); assert.strictEqual(accessor.workingCopyFileService.hasSaveParticipants, true); await workingCopy.save({ force: true }); disposable.dispose(); } </ins> test('revert', async () => { await workingCopy.resolve(); workingCopy.model?.updateContents('hello revert');
const notebook = editor.textModel; const scopedContextKeyService = editor.scopedContextKeyService; <del> const matchResult = notebookKernelService.getMatchingKernel(notebook); </del> <ins> const matchResult = this._notebookKernelService.getMatchingKernel(notebook); </ins> const { selected, all } = matchResult; if (selected && controllerId && selected.id === controllerId && ExtensionIdentifier.equals(selected.extension, extensionId)) {
} } if (!newKernel) { <del> logService.warn(`wanted kernel DOES NOT EXIST, wanted: ${wantedId}, all: ${all.map(k => k.id)}`); </del> <ins> this._logService.warn(`wanted kernel DOES NOT EXIST, wanted: ${wantedId}, all: ${all.map(k => k.id)}`); </ins> return false; } } if (newKernel) { <del> notebookKernelService.selectKernelForNotebook(newKernel, notebook); </del> <ins> this._notebookKernelService.selectKernelForNotebook(newKernel, notebook); </ins> return true; } <del> const quickPick = quickInputService.createQuickPick<KernelQuickPickItem>(); const quickPickItems = this._getKernelPickerQuickPickItems(notebook, matchResult, notebookKernelService, scopedContextKeyService); </del> <ins> const quickPick = this._quickInputService.createQuickPick<KernelQuickPickItem>(); const quickPickItems = this._getKernelPickerQuickPickItems(notebook, matchResult, this._notebookKernelService, scopedContextKeyService); </ins> quickPick.items = quickPickItems; quickPick.canSelectMany = false; quickPick.placeholder = selected <del> ? localize('prompt.placeholder.change', "Change kernel for '{0}'", labelService.getUriLabel(notebook.uri, { relative: true })) : localize('prompt.placeholder.select', "Select kernel for '{0}'", labelService.getUriLabel(notebook.uri, { relative: true })); </del> <ins> ? localize('prompt.placeholder.change', "Change kernel for '{0}'", this._labelService.getUriLabel(notebook.uri, { relative: true })) : localize('prompt.placeholder.select', "Select kernel for '{0}'", this._labelService.getUriLabel(notebook.uri, { relative: true })); </ins> <del> quickPick.busy = notebookKernelService.getKernelDetectionTasks(notebook).length > 0; </del> <ins> quickPick.busy = this._notebookKernelService.getKernelDetectionTasks(notebook).length > 0; </ins> <del> const kernelDetectionTaskListener = notebookKernelService.onDidChangeKernelDetectionTasks(() => { quickPick.busy = notebookKernelService.getKernelDetectionTasks(notebook).length > 0; </del> <ins> const kernelDetectionTaskListener = this._notebookKernelService.onDidChangeKernelDetectionTasks(() => { quickPick.busy = this._notebookKernelService.getKernelDetectionTasks(notebook).length > 0; </ins> }); // run extension recommendataion task if quickPickItems is empty const extensionRecommendataionPromise = quickPickItems.length === 0 <del> ? createCancelablePromise(token => this._showInstallKernelExtensionRecommendation(notebook, quickPick, extensionWorkbenchService, token)) </del> <ins> ? createCancelablePromise(token => this._showInstallKernelExtensionRecommendation(notebook, quickPick, this._extensionWorkbenchService, token)) </ins> : undefined; const kernelChangeEventListener = Event.debounce<void, void>( Event.any( <del> notebookKernelService.onDidChangeSourceActions, notebookKernelService.onDidAddKernel, notebookKernelService.onDidRemoveKernel, notebookKernelService.onDidChangeNotebookAffinity </del> <ins> this._notebookKernelService.onDidChangeSourceActions, this._notebookKernelService.onDidAddKernel, this._notebookKernelService.onDidRemoveKernel, this._notebookKernelService.onDidChangeNotebookAffinity </ins> ), (last, _current) => last, KERNEL_PICKER_UPDATE_DEBOUNCE
extensionRecommendataionPromise?.cancel(); const currentActiveItems = quickPick.activeItems; <del> const matchResult = notebookKernelService.getMatchingKernel(notebook); const quickPickItems = this._getKernelPickerQuickPickItems(notebook, matchResult, notebookKernelService, scopedContextKeyService); </del> <ins> const matchResult = this._notebookKernelService.getMatchingKernel(notebook); const quickPickItems = this._getKernelPickerQuickPickItems(notebook, matchResult, this._notebookKernelService, scopedContextKeyService); </ins> quickPick.keepScrollPosition = true; // recalcuate active items
if (pick) { if (isKernelPick(pick)) { newKernel = pick.kernel; <del> notebookKernelService.selectKernelForNotebook(newKernel, notebook); </del> <ins> this._notebookKernelService.selectKernelForNotebook(newKernel, notebook); </ins> return true; } // actions if (pick.id === 'install') { await this._showKernelExtension( <del> paneCompositeService, extensionWorkbenchService, extensionHostService, </del> <ins> this._paneCompositePartService, this._extensionWorkbenchService, this._extensionService, </ins> notebook.viewType ); // suggestedExtension must be defined for this option to be shown, but still check to make TS happy } else if (isInstallExtensionPick(pick)) { await this._showKernelExtension( <del> paneCompositeService, extensionWorkbenchService, extensionHostService, </del> <ins> this._paneCompositePartService, this._extensionWorkbenchService, this._extensionService, </ins> notebook.viewType, pick.extensionId, <del> productService.quality !== 'stable' </del> <ins> this._productService.quality !== 'stable' </ins> ); } else if (isSourcePick(pick)) { // selected explicilty, it should trigger the execution?