jiebi/CodeConvo huggingface dataset:
private _disposeFocusStickyScrollStore() { this._stickyScrollFocusedContextKey.set(false); <del> this._focusDisposableStore!.dispose(); </del> <ins> this._focusDisposableStore?.dispose(); </ins> this._focused = false; <ins> this._positionRevealed = false; this._onMouseDown = false; </ins> } public focus(): void { <ins> // If the mouse is down, do not focus on the sticky scroll if (this._onMouseDown) { this._onMouseDown = false; this._editor.focus(); return; } </ins> const focusState = this._stickyScrollFocusedContextKey.get(); if (focusState === true) { return;
public goToFocused(): void { const lineNumbers = this._stickyScrollWidget.lineNumbers; this._disposeFocusStickyScrollStore(); <del> this._editor.revealPosition({ lineNumber: lineNumbers[this._focusedStickyElementIndex], column: 1 }); </del> <ins> this._revealPosition({ lineNumber: lineNumbers[this._focusedStickyElementIndex], column: 1 }); } private _revealPosition(position: IPosition): void { this._positionRevealed = true; this._editor.revealPosition(position); this._editor.setSelection(Range.fromPositions(position)); this._editor.focus(); </ins> } private _createClickLinkGesture(): IDisposable {
if (this._focused) { this._disposeFocusStickyScrollStore(); } <del> this._editor.revealPosition({ lineNumber: this._stickyScrollWidget.hoverOnLine, column: 1 }); </del> <ins> this._revealPosition({ lineNumber: this._stickyScrollWidget.hoverOnLine, column: 1 }); </ins> } this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel()!.uri, range: this._stickyRangeProjectedOnEditor! }); } else if (!e.isRightClick) { // Normal click <del> const position = { lineNumber: this._stickyScrollWidget.hoverOnLine, column: this._stickyScrollWidget.hoverOnColumn }; </del> if (this._focused) { this._disposeFocusStickyScrollStore(); } <del> this._editor.revealPosition(position); this._editor.setSelection(Range.fromPositions(position)); </del> <ins> this._revealPosition({ lineNumber: this._stickyScrollWidget.hoverOnLine, column: this._stickyScrollWidget.hoverOnColumn }); </ins> } })); return linkGestureStore;
import { AudioCue, IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey'; <ins> import { withNullAsUndefined } from 'vs/base/common/types'; </ins> const enum CssClass { Active = 'active', Hide = 'hide' } <ins> interface IAccessibleBufferQuickPickItem extends IQuickPickItem { lineNumber: number; exitCode?: number; } </ins> export class AccessibleBufferWidget extends DisposableStore { private _accessibleBuffer: HTMLElement; private _bufferEditor: CodeEditorWidget;
if (insertion && model && lineCount > this._xterm.raw.rows) { const lineNumber = lineCount + 1; model.pushEditOperations(null, [{ <del> range: { startLineNumber: lineNumber, endLineNumber: lineNumber, startColumn: 1, endColumn: 1 }, text: this._getContent(true) </del> <ins> range: { startLineNumber: lineNumber, endLineNumber: lineNumber, startColumn: 1, endColumn: 1 }, text: this._getContent(1) </ins> }], () => []); } else { model = await this._getTextModel(this._instance.resource.with({ fragment: this._getContent() }));
this._bufferEditor.focus(); } <del> private async _getTextModel(resource: URI): Promise<ITextModel | null> { const existing = this._modelService.getModel(resource); if (existing && !existing.isDisposed()) { return existing; } return this._modelService.createModel(resource.fragment, null, resource, false); } private _getContent(lastBufferIndex?: boolean): string { const buffer = this._xterm?.raw.buffer.active; </del> <ins> private _getContent(startIndex?: number): string { const buffer = this._xterm.raw.buffer.active; </ins> if (!buffer) { return ''; }
const scrollback: number = this._configurationService.getValue(TerminalSettingId.Scrollback); const maxBufferSize = scrollback + this._xterm.raw.rows - 1; const end = Math.min(maxBufferSize, buffer.length - 1); <del> if (lastBufferIndex) { </del> <ins> if (startIndex) { </ins> // If the last buffer index is requested, this is as a result of // a dynamic addition. Return only the last line to prevent duplication. const line = buffer.getLine(end - 1)?.translateToString(false).replace(new RegExp(' ', 'g'), 'xA0'); <del> const result = line ? (this._prependNewLine ? 'n' : '') + line + 'n' : ''; this._prependNewLine = false; </del> <ins> const result = line ? line + 'n' : ''; </ins> return result; } <del> this._bufferToEditorIndex = new Map(); </del> const lines: string[] = []; let currentLine: string = ''; for (let i = 0; i <= end; i++) {
continue; } const isWrapped = buffer.getLine(i + 1)?.isWrapped; <del> this._bufferToEditorIndex.set(i, lines.length); </del> currentLine += line.translateToString(!isWrapped); if (currentLine && !isWrapped || i === end - 1) { lines.push(currentLine.replace(new RegExp(' ', 'g'), 'xA0'));
<del> ## Find in Outputs * Find is no longer **synchronous** * Progress bar in Find Widget * Require all outputs to be rendered first * `window.find` * Shadow DOM nodes are skipped in non-chromium browsers * no builtin css rule for find match color * `hiliteColor` * Modifies DOM * Shadow DOM not supported, we can potentially have our own impl * Find match range serialization `document.getSelection` * `document.getSelection().getRangeAt(0).cloneRange()` not immutable, changed when document active selection changes * range will be invalid after `hiliteColor` executed * require our own serialization/deserialization * Performance * `window.find` can be slow * We currently travese the DOM tree to figure out which cell/output contain the find match belongs to, it's really costly. One idea is checking the absolute position of the find match and compare it with output container positions. * Search only rendered outputs * MutationObserver for output change * Change active selection to the beginning of the new output and then request `window.find` </del>
private didLayout = false; private emptyViews: ISplitViewView<{ top: number; left: number }>[] | undefined; private readonly splitViewDisposables = new DisposableStore(); <del> private centeredLayoutFixedWidth = true; </del> constructor( private container: HTMLElement, private view: IView, <del> public state: CenteredViewState = { ...defaultState } </del> <ins> public state: CenteredViewState = { ...defaultState }, private centeredLayoutFixedWidth: boolean = false </ins> ) { this.container.appendChild(this.view.element); // Make sure to hide the split view overflow like sashes #52892
this.doCreateGridControl(options); // Centered layout widget <del> this.centeredLayoutWidget = this._register(new CenteredViewLayout(this.container, this.gridWidgetView, this.profileMemento[EditorPart.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY])); </del> <ins> this.centeredLayoutWidget = this._register(new CenteredViewLayout(this.container, this.gridWidgetView, this.profileMemento[EditorPart.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY], this._partOptions.centeredLayoutFixedWidth)); </ins> this._register(this.onDidChangeEditorPartOptions(e => this.centeredLayoutWidget.setFixedWidth(e.newPartOptions.centeredLayoutFixedWidth ?? false))); // Drag & Drop support
.pipe(util.skipDirectories()) .pipe(util.fixWin32DirectoryPermissions()) .pipe(filter(['**', '!**/.github/**'], { dot: true })) // https://github.com/microsoft/vscode/issues/116523 <del> .pipe(electron({ ...config, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: true })) </del> <ins> .pipe(electron({ ...config, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false })) </ins> .pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version'], { dot: true })); if (platform === 'linux') {
}); } exports.config = { <del> version: product.electronRepository ? '22.4.4' : util.getElectronVersion(), </del> <ins> version: product.electronRepository ? '22.4.5' : util.getElectronVersion(), </ins> productAppName: product.nameLong, companyName: 'Microsoft Corporation', copyright: 'Copyright (C) 2023 Microsoft. All rights reserved',
}; } async function main(arch = process.arch) { <del> const version = product.electronRepository ? '22.4.4' : util.getElectronVersion(); </del> <ins> const version = product.electronRepository ? '22.4.5' : util.getElectronVersion(); </ins> const electronPath = path.join(root, '.build', 'electron'); const versionFile = path.join(electronPath, 'version'); const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;
} export const config = { <del> version: product.electronRepository ? '22.4.4' : util.getElectronVersion(), </del> <ins> version: product.electronRepository ? '22.4.5' : util.getElectronVersion(), </ins> productAppName: product.nameLong, companyName: 'Microsoft Corporation', copyright: 'Copyright (C) 2023 Microsoft. All rights reserved',
} async function main(arch = process.arch): Promise<void> { <del> const version = product.electronRepository ? '22.4.4' : util.getElectronVersion(); </del> <ins> const version = product.electronRepository ? '22.4.5' : util.getElectronVersion(); </ins> const electronPath = path.join(root, '.build', 'electron'); const versionFile = path.join(electronPath, 'version'); const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;
} /** <ins> * Removes any query string from the link. * @param link The link to use. */ export function removeLinkQueryString(link: string): string { // Skip ? in UNC paths const start = link.startsWith('?') ? 4 : 0; const index = link.indexOf('?', start); if (index === -1) { return link; } return link.substring(0, index); } /** </ins> * Returns the optional link suffix which contains line and column information. * @param link The link to parse. */
*--------------------------------------------------------------------------------------------*/ import { ITerminalLinkResolver, ResolvedLink } from 'vs/workbench/contrib/terminalContrib/links/browser/links'; <del> import { removeLinkSuffix, winDrivePrefix } from 'vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing'; </del> <ins> import { removeLinkSuffix, removeLinkQueryString, winDrivePrefix } from 'vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing'; </ins> import { URI } from 'vs/base/common/uri'; import { ITerminalBackend, ITerminalProcessManager } from 'vs/workbench/contrib/terminal/common/terminal'; import { Schemas } from 'vs/base/common/network';
} } <del> // Remove any line/col suffix before processing the path </del> <ins> // Remove any line/col suffix </ins> let linkUrl = removeLinkSuffix(link); <del> if (!linkUrl) { </del> <ins> // Remove any query string linkUrl = removeLinkQueryString(linkUrl); // Exit early if the link is determines as not valid already if (linkUrl.length === 0) { </ins> cache.set(link, null); return null; }
import { deepStrictEqual, ok, strictEqual } from 'assert'; import { OperatingSystem } from 'vs/base/common/platform'; <del> import { detectLinks, detectLinkSuffixes, getLinkSuffix, IParsedLink, removeLinkSuffix } from 'vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing'; </del> <ins> import { detectLinks, detectLinkSuffixes, getLinkSuffix, IParsedLink, removeLinkQueryString, removeLinkSuffix } from 'vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing'; </ins> interface ITestLink { link: string;
); }); }); <ins> suite('removeLinkQueryString', () => { test('should remove any query string from the link', () => { strictEqual(removeLinkQueryString('?a=b'), ''); strictEqual(removeLinkQueryString('foo?a=b'), 'foo'); strictEqual(removeLinkQueryString('./foo?a=b'), './foo'); strictEqual(removeLinkQueryString('/foo/bar?a=b'), '/foo/bar'); strictEqual(removeLinkQueryString('foo?a=b?'), 'foo'); strictEqual(removeLinkQueryString('foo?a=b&c=d'), 'foo'); }); test('should respect ? in UNC paths', () => { strictEqual(removeLinkQueryString('?foo?a=b'), '?foo',); }); }); </ins> suite('detectLinks', () => { test('foo(1, 2) bar[3, 4] "baz" on line 5', () => { deepStrictEqual(
'builtin-extensions-dir': { type: 'string' }, 'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") }, 'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extensions.") }, <del> 'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extensions."), args: 'category' }, </del> <ins> 'category': { type: 'string', allowEmptyValue: true, cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extensions."), args: 'category' }, </ins> 'install-extension': { type: 'string[]', cat: 'e', args: 'ext-id | path', description: localize('installExtension', "Installs or updates an extension. The argument is either an extension id or a path to a VSIX. The identifier of an extension is '${publisher}.${name}'. Use '--force' argument to update to latest version. To install a specific version provide '@${version}'. For example: 'vscode.csharp@1.2.3'.") }, 'pre-release': { type: 'boolean', cat: 'e', description: localize('install prerelease', "Installs the pre-release version of the extension, when using --install-extension") }, 'uninstall-extension': { type: 'string[]', cat: 'e', args: 'ext-id', description: localize('uninstallExtension', "Uninstalls an extension.") },
pick: async () => { // Do a late 'onDebugDynamicConfigurationsName' activation so extensions are not activated too early #108578 await this.adapterManager.activateDebuggers(onDebugDynamicConfigurationsName, type); <del> const disposables = new DisposableStore(); const input = disposables.add(this.quickInputService.createQuickPick<IDynamicPickItem>()); input.busy = true; input.placeholder = nls.localize('selectConfiguration', "Select Launch Configuration"); input.show(); const chosenPromise = new Promise<IDynamicPickItem | undefined>(resolve => { disposables.add(input.onDidAccept(() => resolve(input.activeItems[0]))); disposables.add(input.onDidTriggerItemButton(async (context) => { resolve(undefined); const { launch, config } = context.item; await launch.openConfigFile({ preserveFocus: false, type: config.type, suppressInitialConfigs: true }); // Only Launch have a pin trigger button await (launch as Launch).writeConfiguration(config); await this.selectConfiguration(launch, config.name); this.removeRecentDynamicConfigurations(config.name, config.type); })); }); </del> const token = new CancellationTokenSource(); const picks: Promise<IDynamicPickItem[]>[] = [];
} }); <ins> const disposables = new DisposableStore(); const input = disposables.add(this.quickInputService.createQuickPick<IDynamicPickItem>()); input.busy = true; input.placeholder = nls.localize('selectConfiguration', "Select Launch Configuration"); const chosenPromise = new Promise<IDynamicPickItem | undefined>(resolve => { disposables.add(input.onDidAccept(() => resolve(input.activeItems[0]))); disposables.add(input.onDidTriggerItemButton(async (context) => { resolve(undefined); const { launch, config } = context.item; await launch.openConfigFile({ preserveFocus: false, type: config.type, suppressInitialConfigs: true }); // Only Launch have a pin trigger button await (launch as Launch).writeConfiguration(config); await this.selectConfiguration(launch, config.name); this.removeRecentDynamicConfigurations(config.name, config.type); })); }); </ins> const nestedPicks = await Promise.all(picks); const items = flatten(nestedPicks); input.items = items; input.busy = false; <ins> input.show(); </ins> const chosen = await chosenPromise; disposables.dispose();
} else { if (options.hideOnHover === undefined) { // When unset, will default to true when it's a string or when it's markdown that <del> // appears to have a link using a naive check for '](' hideOnHover = typeof options.content === 'string' || isMarkdownString(options.content) && !options.content.value.includes(']('); </del> <ins> // appears to have a link using a naive check for '](' and '</a>' hideOnHover = typeof options.content === 'string' || isMarkdownString(options.content) && !options.content.value.includes('](') && !options.content.value.includes('</a>'); </ins> } else { // It's set explicitly hideOnHover = options.hideOnHover;
const isWrapped = buffer.getLine(i + 1)?.isWrapped; currentLine += line.translateToString(!isWrapped); if (currentLine && !isWrapped || i === (buffer.baseY + this._xterm.raw.rows - 1)) { <del> const line = replaceWithNonBreakingSpaces(currentLine); </del> if (line.length) { <del> cachedLines.push(line); </del> <ins> cachedLines.push(currentLine); </ins> currentLine = ''; } }
const isWrapped = buffer.getLine(i + 1)?.isWrapped; currentLine += line.translateToString(!isWrapped); if (currentLine && !isWrapped || i === (buffer.baseY + this._xterm.raw.rows - 1)) { <del> const line = replaceWithNonBreakingSpaces(currentLine); if (line.length) { </del> <ins> if (currentLine.length) { </ins> this._priorEditorViewportLineCount++; <del> this._lines.push(line); </del> <ins> this._lines.push(currentLine); </ins> currentLine = ''; } }
import { writeP } from 'vs/workbench/contrib/terminal/browser/terminalTestHelpers'; import { XtermTerminal } from 'vs/workbench/contrib/terminal/browser/xterm/xtermTerminal'; import { ITerminalConfiguration } from 'vs/workbench/contrib/terminal/common/terminal'; <del> import { BufferContentTracker, replaceWithNonBreakingSpaces } from 'vs/workbench/contrib/terminalContrib/accessibility/browser/bufferContentTracker'; </del> <ins> import { BufferContentTracker } from 'vs/workbench/contrib/terminalContrib/accessibility/browser/bufferContentTracker'; </ins> import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { TestLifecycleService } from 'vs/workbench/test/browser/workbenchTestServices'; import { Terminal } from 'xterm';
assert.strictEqual(bufferTracker.lines.length, 0); await writeP(xterm.raw, prompt); xterm.clearBuffer(); <del> await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> assert.deepStrictEqual(bufferTracker.lines, [prompt]); <del> assert.strictEqual(bufferTracker.lines.length, 1); </del> }); test('repeated updates should not change the content', async () => { assert.strictEqual(bufferTracker.lines.length, 0); await writeP(xterm.raw, prompt); <del> await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> assert.deepStrictEqual(bufferTracker.lines, [prompt]); <del> assert.strictEqual(bufferTracker.lines.length, 1); await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> assert.deepStrictEqual(bufferTracker.lines, [prompt]); <del> assert.strictEqual(bufferTracker.lines.length, 1); await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> assert.deepStrictEqual(bufferTracker.lines, [prompt]); <del> assert.strictEqual(bufferTracker.lines.length, 1); </del> }); test('should add lines in the viewport and scrollback', async () => { await writeAndAssertBufferState(promptPlusData, 38, xterm.raw, bufferTracker);
test('should refresh viewport', async () => { await writeAndAssertBufferState(promptPlusData, 6, xterm.raw, bufferTracker); await writeP(xterm.raw, 'x1b[3Ainserteddata'); <del> await bufferTracker.update(); assert.deepStrictEqual(bufferTracker.lines, [promptPlusData, promptPlusData, `${promptPlusData}inserteddata`, promptPlusData, promptPlusData, promptPlusData].map(s => replaceWithNonBreakingSpaces(s))); </del> <ins> bufferTracker.update(); assert.deepStrictEqual(bufferTracker.lines, [promptPlusData, promptPlusData, `${promptPlusData}inserteddata`, promptPlusData, promptPlusData, promptPlusData]); </ins> }); test('should refresh viewport with full scrollback', async () => { <del> const content = replaceWithNonBreakingSpaces(`${prompt}rn`.repeat(1030).trimEnd()); </del> <ins> const content = `${prompt}rn`.repeat(1030).trimEnd(); </ins> await writeP(xterm.raw, content); <del> await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> await writeP(xterm.raw, 'x1b[4Ainsertion'); <del> await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> const expected = content.split('rn'); expected[1025] = `${prompt}insertion`; assert.deepStrictEqual(bufferTracker.lines[1025], `${prompt}insertion`);
test('should cap the size of the cached lines, removing old lines in favor of new lines', async () => { const content = `${prompt}rn`.repeat(1036).trimEnd(); await writeP(xterm.raw, content); <del> await bufferTracker.update(); const expected = content.split('rn').map(s => replaceWithNonBreakingSpaces(s)); </del> <ins> bufferTracker.update(); const expected = content.split('rn'); </ins> // delete the 6 lines that should be trimmed for (let i = 0; i < 6; i++) { expected.pop(); } // insert a new character await writeP(xterm.raw, 'x1b[2Ainsertion'); <del> await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> expected[1027] = `${prompt}insertion`; assert.strictEqual(bufferTracker.lines.length, expected.length); assert.deepStrictEqual(bufferTracker.lines, expected);
async function writeAndAssertBufferState(data: string, rows: number, terminal: Terminal, bufferTracker: BufferContentTracker): Promise<void> { const content = `${data}rn`.repeat(rows).trimEnd(); await writeP(terminal, content); <del> await bufferTracker.update(); </del> <ins> bufferTracker.update(); </ins> assert.strictEqual(bufferTracker.lines.length, rows); <del> assert.deepStrictEqual(bufferTracker.lines, content.split('rn').map(s => replaceWithNonBreakingSpaces(s))); </del> <ins> assert.deepStrictEqual(bufferTracker.lines, content.split('rn')); </ins> }
} try { itemOrItems = Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems]; <del> await Promise.all(itemOrItems.map(element => { return tree.expand(element, false); })); </del> <ins> for (const element of itemOrItems) { await tree.expand(element, false); } </ins> } catch (e) { // The extension could have changed the tree during the reveal. // Because of that, we ignore errors.
const inputWidget = this.instantiationService.createInstance(SCMInputWidget, inputElement, this.overflowWidgetsDomNode); templateDisposable.add(inputWidget); <del> return { inputWidget, elementDisposables: new DisposableStore(), templateDisposable }; </del> <ins> return { inputWidget, inputWidgetHeight: InputRenderer.DEFAULT_HEIGHT, elementDisposables: new DisposableStore(), templateDisposable }; </ins> } renderElement(node: ITreeNode<ISCMInput, FuzzyScore>, index: number, templateData: InputTemplate): void {
// Rerender the element whenever the editor content height changes const onDidChangeContentHeight = () => { const contentHeight = templateData.inputWidget.getContentHeight(); <del> const lastContentHeight = this.contentHeights.get(input)!; </del> this.contentHeights.set(input, contentHeight); <del> if (lastContentHeight !== contentHeight) { </del> <ins> if (templateData.inputWidgetHeight !== contentHeight) { </ins> this.updateHeight(input, contentHeight + 10); <ins> templateData.inputWidgetHeight = contentHeight; </ins> templateData.inputWidget.layout(); } };
override async setInput(newInput: GettingStartedInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken) { this.container.classList.remove('animatable'); this.editorInput = newInput; <del> await this.lifecycleService.when(LifecyclePhase.Restored); </del> await super.setInput(newInput, options, context, token); <ins> await this.lifecycleService.when(LifecyclePhase.Restored); </ins> await this.buildCategoriesSlide(); if (this.shouldAnimate()) { setTimeout(() => this.container.classList.add('animatable'), 0);
} result[id] = <DecorationData>[data.propagate, data.tooltip, data.badge, data.color]; } catch (e) { <del> this._logService.warn(`INVALID decoration from extension '${extensionId}': ${e}`); </del> <ins> this._logService.warn(`INVALID decoration from extension '${extensionId.identifier.value}': ${e}`); </ins> } } catch (err) { this._logService.error(err);