jiebi/CodeConvo huggingface dataset:
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ILogService } from 'vs/platform/log/common/log'; import { SnippetSession } from './snippetSession'; <del> import { EditorState, CodeEditorStateFlag } from 'vs/editor/browser/core/editorState'; </del> export class SnippetController2 implements IEditorContribution {
this._updateState(); <del> // we listen on model and selection changes. usually // both events come in together and this is to prevent // that we don't call _updateState twice. let state: EditorState; let dedupedUpdateState = () => { if (!state || !state.validate(this._editor)) { this._updateState(); state = new EditorState(this._editor, CodeEditorStateFlag.Selection | CodeEditorStateFlag.Value); } }; </del> this._snippetListener = [ <del> this._editor.onDidChangeModelContent(e => { if (e.isFlush) { this.cancel(); } else { setTimeout(dedupedUpdateState, 0); } }), this._editor.onDidChangeCursorSelection(dedupedUpdateState), </del> <ins> this._editor.onDidChangeModelContent(e => e.isFlush && this.cancel()), </ins> this._editor.onDidChangeModel(() => this.cancel()), <ins> this._editor.onDidChangeCursorSelection(() => this._updateState()) </ins> ]; }
assertSelections(editor, new Selection(1, 1, 1, 7), new Selection(2, 5, 2, 11)); editor.trigger('test', 'cut', {}); <del> assertContextKeys(contextKeys, false, false, false); </del> <ins> assertContextKeys(contextKeys, true, false, true); </ins> assertSelections(editor, new Selection(1, 1, 1, 1), new Selection(2, 5, 2, 5)); editor.trigger('test', 'type', { text: 'abc' }); <del> assertContextKeys(contextKeys, false, false, false); </del> <ins> assertContextKeys(contextKeys, true, false, true); </ins> ctrl.next(); assertContextKeys(contextKeys, false, false, false);
assertSelections(editor, new Selection(1, 4, 1, 4), new Selection(2, 8, 2, 8)); assertContextKeys(contextKeys, true, false, true); <del> // ctrl.next(); // assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11)); // assertContextKeys(contextKeys, true, true, true); </del> <ins> ctrl.next(); assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11)); assertContextKeys(contextKeys, true, true, true); </ins> ctrl.next(); assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11));
ctrl.insert('farboo'); assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11)); <del> // assertContextKeys(contextKeys, true, false, true); </del> <ins> assertContextKeys(contextKeys, true, false, true); </ins> <del> // ctrl.next(); // assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11)); </del> <ins> ctrl.next(); assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11)); </ins> assertContextKeys(contextKeys, false, false, false); });
assertSelections(editor, new Selection(1, 22, 1, 22)); }); <del> test('A little confusing visual effect of highlighting for snippet tabstop #43270', async function () { </del> <ins> test('User defined snippet tab stops ignored #72862', function () { </ins> const ctrl = new SnippetController2(editor, logService, contextKeys); model.setValue(''); editor.setSelection(new Selection(1, 1, 1, 1)); <del> ctrl.insert('background-color: ${1:fff};$0'); assertSelections(editor, new Selection(1, 19, 1, 22)); editor.setSelection(new Selection(1, 22, 1, 22)); </del> <ins> ctrl.insert('export default $1'); </ins> assertContextKeys(contextKeys, true, false, true); <del> editor.trigger('', 'deleteRight', null); assert.equal(model.getValue(), 'background-color: fff'); await timeout(0); // this depends on re-scheduling of events... assertContextKeys(contextKeys, false, false, false); </del> }); });
// reset selection to placeholder session.next(); <del> assert.equal(session.isSelectionWithinPlaceholders(), false); </del> <ins> assert.equal(session.isSelectionWithinPlaceholders(), true); </ins> assert.equal(session.isAtLastPlaceholder, true); assertSelections(editor, new Selection(1, 13, 1, 13), new Selection(2, 17, 2, 17)); });
* Split search paths (./ or ../ or absolute paths in the includePatterns) into absolute paths and globs applied to those paths */ private expandSearchPathPatterns(searchPaths: string[]): ISearchPathPattern[] { <del> if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY || !searchPaths || !searchPaths.length) { </del> <ins> if (!searchPaths || !searchPaths.length) { </ins> // No workspace => ignore search paths return []; }
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IDebugService, IExpression, IExpressionContainer } from 'vs/workbench/contrib/debug/common/debug'; import { Expression } from 'vs/workbench/contrib/debug/common/debugModel'; <del> import { renderExpressionValue } from 'vs/workbench/contrib/debug/browser/baseDebugView'; </del> <ins> import { renderExpressionValue, replaceWhitespace } from 'vs/workbench/contrib/debug/browser/baseDebugView'; </ins> import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; import { attachStylerCallback } from 'vs/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService';
updateProblemMatchers(); jsonRegistry.notifySchemaChanged(schemaId); }); <ins> const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration); configurationRegistry.registerConfiguration({ id: 'Tasks', order: 100, title: nls.localize('tasksConfigurationTitle', "Tasks"), type: 'object', properties: { 'tasks.terminal.windowsAllowConpty': { markdownDescription: nls.localize('tasks.terminal.windowsAllowConpty', "Works in conjunction with the `#terminal.integrated.windowsEnableConpty#` setting. Both must be enabled for tasks to use conpty. Defaults to `false`."), type: 'boolean', default: false } } }); </ins>
import { Schemas } from 'vs/base/common/network'; import { getWindowsBuildNumber } from 'vs/workbench/contrib/terminal/node/terminal'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; <ins> import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; </ins> interface TerminalData { terminal: ITerminalInstance;
const env = terminalEnvironment.createTerminalEnvironment(shellLaunchConfig, lastActiveWorkspace, envFromConfigValue, this._configurationResolverService, isWorkspaceShellAllowed, this._productService.version, this._configHelper.config.setLocaleVariables); this._logService.debug(`Terminal process launching`, shellLaunchConfig, initialCwd, cols, rows, env); <del> return this._terminalInstanceService.createTerminalProcess(shellLaunchConfig, initialCwd, cols, rows, env, this._configHelper.config.windowsEnableConpty); </del> <ins> const useConpty = (shellLaunchConfig.forceWinpty !== true) && this._configHelper.config.windowsEnableConpty; return this._terminalInstanceService.createTerminalProcess(shellLaunchConfig, initialCwd, cols, rows, env, useConpty); </ins> } public setDimensions(cols: number, rows: number): void {
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle'; import { Event, Emitter } from 'vs/base/common/event'; <del> import { EventType, addDisposableListener, addClass, removeClass, isAncestor, getClientArea, position, size } from 'vs/base/browser/dom'; </del> <ins> import { EventType, addDisposableListener, addClass, removeClass, isAncestor, getClientArea, position, size, EventHelper } from 'vs/base/browser/dom'; </ins> import { onDidChangeFullscreen, isFullscreen, getZoomFactor } from 'vs/base/browser/browser'; import { IBackupFileService } from 'vs/workbench/services/backup/common/backup'; import { Registry } from 'vs/platform/registry/common/platform'; <del> import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform'; </del> <ins> import { isWindows, isLinux, isMacintosh, isWeb } from 'vs/base/common/platform'; </ins> import { pathsToEditors } from 'vs/workbench/common/editor'; import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart'; import { PanelPart } from 'vs/workbench/browser/parts/panel/panelPart';
// Prevent workbench from scrolling #55456 this._register(addDisposableListener(this.container, EventType.SCROLL, () => this.container.scrollTop = 0)); <ins> // Prevent native context menus in web #73781 if (isWeb) { this._register(addDisposableListener(this.container, EventType.CONTEXT_MENU, (e) => EventHelper.stop(e, true))); } </ins> // Menubar visibility changes if ((isWindows || isLinux) && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') { this._register(this.titleService.onMenubarVisibilityChange(visible => this.onMenubarToggled(visible)));
this._sourceControl.inputBox.validateInput = this.validateInput.bind(this); this.disposables.push(this._sourceControl); <del> this._mergeGroup = this._sourceControl.createResourceGroup('merge', localize('merge changes', "Merge Changes")); this._indexGroup = this._sourceControl.createResourceGroup('index', localize('staged changes', "Staged Changes")); this._workingTreeGroup = this._sourceControl.createResourceGroup('workingTree', localize('changes', "Changes")); </del> <ins> this._mergeGroup = this._sourceControl.createResourceGroup('merge', localize('merge changes', "MERGE CHANGES")); this._indexGroup = this._sourceControl.createResourceGroup('index', localize('staged changes', "STAGED CHANGES")); this._workingTreeGroup = this._sourceControl.createResourceGroup('workingTree', localize('changes', "CHANGES")); </ins> const updateIndexGroupVisibility = () => { const config = workspace.getConfiguration('git', root);
default: true, markdownDescription: nls.localize('editor.suggest.showConstructors', "When enabled IntelliSense shows `constructor`-suggestions.") }, <ins> 'editor.suggest.showDeprecated': { type: 'boolean', default: true, markdownDescription: nls.localize('editor.suggest.showDeprecated', "When enabled IntelliSense shows `deprecated`-suggestions.") }, </ins> 'editor.suggest.showFields': { type: 'boolean', default: true,
showMethods: boolean(input.showMethods, this.defaultValue.showMethods), showFunctions: boolean(input.showFunctions, this.defaultValue.showFunctions), showConstructors: boolean(input.showConstructors, this.defaultValue.showConstructors), <ins> showDeprecated: boolean(input.showDeprecated, this.defaultValue.showDeprecated), </ins> showFields: boolean(input.showFields, this.defaultValue.showFields), showVariables: boolean(input.showVariables, this.defaultValue.showVariables), showClasses: boolean(input.showClasses, this.defaultValue.showClasses),
break; } <del> const itemKindFilter = SuggestModel._createItemKindFilter(this._editor); </del> <ins> const { itemKind: itemKindFilter, showDeprecated } = SuggestModel._createSuggestFilter(this._editor); </ins> const wordDistance = WordDistance.create(this._editorWorkerService, this._editor); const completions = provideSuggestionItems( model, this._editor.getPosition(), <del> new CompletionOptions(snippetSortOrder, itemKindFilter, onlyFrom), </del> <ins> new CompletionOptions(snippetSortOrder, itemKindFilter, onlyFrom, showDeprecated), </ins> suggestCtx, this._requestToken.token );
if (!suggestOptions.showUsers) { result.add(CompletionItemKind.User); } if (!suggestOptions.showIssues) { result.add(CompletionItemKind.Issue); } <del> return result; </del> <ins> return { itemKind: result, showDeprecated: suggestOptions.showDeprecated }; </ins> } private _onNewContext(ctx: LineContext): void {
], { sticky: true, <del> neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE }, </del> <ins> neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.GLOBAL }, </ins> onCancel: () => { /* __GDPR__ "terminalLaunchRecommendation:popup" : {
args.push('--'); if (paths && paths.length) { <del> args.push.apply(args, paths.map(sanitizePath)); </del> <ins> for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) { await this.run([...args, ...chunk]); } </ins> } else { args.push('.'); <ins> await this.run(args); </ins> } <del> await this.run(args); </del> } async rm(paths: string[]): Promise<void> {
args = ['reset', '-q', treeish, '--']; } <del> if (paths && paths.length) { args.push.apply(args, paths.map(sanitizePath)); } else { args.push('.'); } </del> try { <del> await this.run(args); </del> <ins> if (paths && paths.length > 0) { for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) { await this.run([...args, ...chunk]); } } else { args.push('.'); await this.run(args); } </ins> } catch (err) { // In case there are merge conflicts to be resolved, git reset will output // some "needs merge" data. We try to get around that.
"command.timelineCopyCommitId": "Copy Commit ID", "command.timelineCopyCommitMessage": "Copy Commit Message", "config.enabled": "Whether git is enabled.", <del> "config.path": "Path and filename of the git executable, e.g. `C:Program FilesGitbingit.exe` (Windows).", </del> <ins> "config.path": "Path and filename of the git executable, e.g. `C:Program FilesGitbingit.exe` (Windows). This can also be an array of string values containing multiple paths to look up.", </ins> "config.autoRepositoryDetection": "Configures when repositories should be automatically detected.", "config.autoRepositoryDetection.true": "Scan for both subfolders of the current opened folder and parent folders of open files.", "config.autoRepositoryDetection.false": "Disable automatic repository scanning.",
.then(undefined, () => findGitWin32InPath(onLookup)); } <del> export function findGit(hint: string | undefined, onLookup: (path: string) => void): Promise<IGit> { const first = hint ? findSpecificGit(hint, onLookup) : Promise.reject<IGit>(null); return first .then(undefined, () => { switch (process.platform) { case 'darwin': return findGitDarwin(onLookup); case 'win32': return findGitWin32(onLookup); default: return findSpecificGit('git', onLookup); } }) .then(null, () => Promise.reject(new Error('Git installation not found.'))); </del> <ins> export async function findGit(hint: string | string[] | undefined, onLookup: (path: string) => void): Promise<IGit> { const hints = Array.isArray(hint) ? hint : hint ? [hint] : []; for (const hint of hints) { try { return await findSpecificGit(hint, onLookup); } catch { // noop } } try { switch (process.platform) { case 'darwin': return await findGitDarwin(onLookup); case 'win32': return await findGitWin32(onLookup); default: return await findSpecificGit('git', onLookup); } } catch { // noop } throw new Error('Git installation not found.'); </ins> } export interface IExecutionResult<T extends string | Buffer> {
} async function createModel(context: ExtensionContext, outputChannel: OutputChannel, telemetryReporter: TelemetryReporter, disposables: Disposable[]): Promise<Model> { <del> const pathHint = workspace.getConfiguration('git').get<string>('path'); </del> <ins> const pathHint = workspace.getConfiguration('git').get<string | string[]>('path'); </ins> const info = await findGit(pathHint, path => outputChannel.appendLine(localize('looking', "Looking for git in: {0}", path))); const askpass = await Askpass.create(outputChannel, context.storagePath);
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { Snippet, SnippetSource } from 'vs/workbench/contrib/snippets/browser/snippetsFile'; <del> import { IQuickPickItem, IQuickInputService, QuickPickInput } from 'vs/platform/quickinput/common/quickInput'; </del> import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; <del> import { Codicon } from 'vs/base/common/codicons'; import { Event } from 'vs/base/common/event'; </del> <ins> import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { pickSnippet } from 'vs/workbench/contrib/snippets/browser/snippetPicker'; </ins> class Args {
} SnippetController2.get(editor)?.insert(snippet.codeSnippet, { clipboardText }); } <del> private async _pickSnippet(snippetService: ISnippetsService, quickInputService: IQuickInputService, languageId: string): Promise<Snippet | undefined> { interface ISnippetPick extends IQuickPickItem { snippet: Snippet; } const snippets = (await snippetService.getSnippets(languageId, { includeDisabledSnippets: true, includeNoPrefixSnippets: true })).sort(Snippet.compare); const makeSnippetPicks = () => { const result: QuickPickInput<ISnippetPick>[] = []; let prevSnippet: Snippet | undefined; for (const snippet of snippets) { const pick: ISnippetPick = { label: snippet.prefix || snippet.name, detail: snippet.description, snippet }; if (!prevSnippet || prevSnippet.snippetSource !== snippet.snippetSource || prevSnippet.source !== snippet.source) { let label = ''; switch (snippet.snippetSource) { case SnippetSource.User: label = nls.localize('sep.userSnippet', "User Snippets"); break; case SnippetSource.Extension: label = snippet.source; break; case SnippetSource.Workspace: label = nls.localize('sep.workspaceSnippet', "Workspace Snippets"); break; } result.push({ type: 'separator', label }); } if (snippet.snippetSource === SnippetSource.Extension) { const isEnabled = snippetService.isEnabled(snippet); if (isEnabled) { pick.buttons = [{ iconClass: Codicon.eyeClosed.classNames, tooltip: nls.localize('disableSnippet', 'Hide from IntelliSense') }]; } else { pick.description = nls.localize('isDisabled', "(hidden from IntelliSense)"); pick.buttons = [{ iconClass: Codicon.eye.classNames, tooltip: nls.localize('enable.snippet', 'Show in IntelliSense') }]; } } result.push(pick); prevSnippet = snippet; } return result; }; const picker = quickInputService.createQuickPick<ISnippetPick>(); picker.placeholder = nls.localize('pick.placeholder', "Select a snippet"); picker.matchOnDetail = true; picker.ignoreFocusOut = false; picker.keepScrollPosition = true; picker.onDidTriggerItemButton(ctx => { const isEnabled = snippetService.isEnabled(ctx.item.snippet); snippetService.updateEnablement(ctx.item.snippet, !isEnabled); picker.items = makeSnippetPicks(); }); picker.items = makeSnippetPicks(); picker.show(); // wait for an item to be picked or the picker to become hidden await Promise.race([Event.toPromise(picker.onDidAccept), Event.toPromise(picker.onDidHide)]); const result = picker.selectedItems[0]?.snippet; picker.dispose(); return result; } </del> } registerEditorAction(InsertSnippetAction);
<ins> /*--------------------------------------------------------------------------------------------- *  Copyright (c) Microsoft Corporation. All rights reserved. *  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EditorAction2 } from 'vs/editor/browser/editorExtensions'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { SnippetController2 } from 'vs/editor/contrib/snippet/browser/snippetController2'; import { localize } from 'vs/nls'; import { registerAction2 } from 'vs/platform/actions/common/actions'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { pickSnippet } from 'vs/workbench/contrib/snippets/browser/snippetPicker'; import { ISnippetsService } from 'vs/workbench/contrib/snippets/browser/snippets.contribution'; registerAction2(class SurroundWithAction extends EditorAction2 { constructor() { super({ id: 'editor.action.surroundWithSnippet', title: { value: localize('label', 'Surround With Snippet...'), original: 'Surround With Snippet...' }, precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasNonEmptySelection), f1: true }); } async runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, ...args: any[]) { const snippetService = accessor.get(ISnippetsService); const clipboardService = accessor.get(IClipboardService); const instaService = accessor.get(IInstantiationService); if (!editor.hasModel()) { return; } const { lineNumber, column } = editor.getPosition(); editor.getModel().tokenizeIfCheap(lineNumber); const languageId = editor.getModel().getLanguageIdAtPosition(lineNumber, column); const allSnippets = await snippetService.getSnippets(languageId, { includeNoPrefixSnippets: true, includeDisabledSnippets: true }); const surroundSnippets = allSnippets.filter(snippet => snippet.usesSelection); const snippet = await instaService.invokeFunction(pickSnippet, surroundSnippets); if (!snippet) { return; } let clipboardText: string | undefined; if (snippet.needsClipboard) { clipboardText = await clipboardService.readText(); } SnippetController2.get(editor)?.insert(snippet.codeSnippet, { clipboardText }); } }); </ins>
import 'vs/workbench/contrib/snippets/browser/snippets.contribution'; import 'vs/workbench/contrib/snippets/browser/snippetsService'; import 'vs/workbench/contrib/snippets/browser/insertSnippet'; <ins> import 'vs/workbench/contrib/snippets/browser/surroundWithSnippet'; </ins> import 'vs/workbench/contrib/snippets/browser/configureSnippets'; import 'vs/workbench/contrib/snippets/browser/tabCompletion';
DOM.append(this.noResultsMessage, this.clearFilterLinkContainer); <del> const clearSearchContainer = $('span.clear-search'); clearSearchContainer.textContent = ' - '; const clearSearch = DOM.append(clearSearchContainer, $('a.pointer.prominent', { tabindex: 0 }, localize('clearSearch', 'Clear Search'))); this._register(DOM.addDisposableListener(clearSearch, DOM.EventType.CLICK, (e: MouseEvent) => { DOM.EventHelper.stop(e, false); this.clearSearchResults(); })); DOM.append(this.noResultsMessage, clearSearchContainer); </del> this._register(attachStylerCallback(this.themeService, { editorForeground }, colors => { this.noResultsMessage.style.color = colors.editorForeground ? colors.editorForeground.toString() : null; }));
} focus(): void { <del> if (this.activeElement) { this.activeElement.focus(); } </del> <ins> this.activeElement?.focus(); </ins> } showFind(): void { <del> if (this.activeElement && (<Webview>this.activeElement).showFind) { (<Webview>this.activeElement).showFind(); } </del> <ins> this.activeWebview?.showFind(); </ins> } runFindAction(previous: boolean): void { <del> if (this.activeElement && (<Webview>this.activeElement).runFindAction) { (<Webview>this.activeElement).runFindAction(previous); </del> <ins> this.activeWebview?.runFindAction(previous); } public get activeWebview(): Webview | undefined { if (!this.activeElement || !(this.activeElement as Webview).runFindAction) { return undefined; </ins> } <ins> return this.activeElement as Webview; </ins> } private onNavbarChange(extension: IExtension, { id, focus }: { id: string | null, focus: boolean }, template: IExtensionEditorTemplate): void {
import { InstallExtensionQuickAccessProvider, ManageExtensionsQuickAccessProvider } from 'vs/workbench/contrib/extensions/browser/extensionsQuickAccess'; import { ExtensionRecommendationsService } from 'vs/workbench/contrib/extensions/browser/extensionRecommendationsService'; import { CONTEXT_SYNC_ENABLEMENT } from 'vs/workbench/services/userDataSync/common/userDataSync'; <ins> import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/clipboard'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { MultiCommand } from 'vs/editor/browser/editorExtensions'; import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; </ins> // Singletons registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);