jiebi/CodeConvo huggingface dataset:
statusBarItem.command = cancelCommandId; statusBarItem.show(); <del> const clonePromise = this.git.clone(url, parentPath, tokenSource.token); </del> <ins> const clonePromise = this.git.clone(url, this.handlePathTilde(parentPath), tokenSource.token); </ins> try { window.withProgress({ location: ProgressLocation.SourceControl, title: localize('cloning', "Cloning git repository...") }, () => clonePromise);
import * as strings from 'vs/base/common/strings'; import * as objects from 'vs/base/common/objects'; import * as platform from 'vs/base/common/platform'; <del> import * as stdfork from 'vs/base/node/stdFork'; </del> import { Emitter, Event } from 'vs/base/common/event'; import { TPromise } from 'vs/base/common/winjs.base'; import { ExtensionsChannelId } from 'vs/platform/extensionManagement/common/extensionManagement';
if (this.adapterExecutable.command === 'node' && this.outputService) { if (Array.isArray(this.adapterExecutable.args) && this.adapterExecutable.args.length > 0) { <del> stdfork.fork(this.adapterExecutable.args[0], this.adapterExecutable.args.slice(1), {}, (err, child) => { if (err) { e(new Error(nls.localize('unableToLaunchDebugAdapter', "Unable to launch debug adapter from '{0}'.", this.adapterExecutable.args[0]))); } this.serverProcess = child; c(null); </del> <ins> const child = cp.fork(this.adapterExecutable.args[0], this.adapterExecutable.args.slice(1), { execArgv: ['-e', 'delete process.env.ELECTRON_RUN_AS_NODE;require(process.argv[1])'].concat(process.execArgv || []), silent: true </ins> }); <ins> if (!child.pid) { e(new Error(nls.localize('unableToLaunchDebugAdapter', "Unable to launch debug adapter from '{0}'.", this.adapterExecutable.args[0]))); } this.serverProcess = child; c(null); </ins> } else { e(new Error(nls.localize('unableToLaunchDebugAdapterNoArgs', "Unable to launch debug adapter."))); }
if (previous) { if (next) { const betweenProgress = (offset - window.scrollY - previous.element.getBoundingClientRect().top) / (next.element.getBoundingClientRect().top - previous.element.getBoundingClientRect().top); <del> return previous.line + betweenProgress * (next.line - previous.line); </del> <ins> const line = previous.line + betweenProgress * (next.line - previous.line); return (0 <= line) ? line : 0; </ins> } else { <del> return previous.line; </del> <ins> return (0 <= previous.line) ? previous.line : 0; </ins> } } return null;
else { // Do open files <del> usedWindows.push(this.doOpenFilesInExistingWindow(bestWindowOrFolder, filesToOpen, filesToCreate, filesToDiff, filesToWait)); </del> <ins> usedWindows.push(this.doOpenFilesInExistingWindow(openConfig, bestWindowOrFolder, filesToOpen, filesToCreate, filesToDiff, filesToWait)); </ins> // Reset these because we handled them filesToOpen = [];
const windowOnWorkspace = windowsOnWorkspace[0]; // Do open files <del> usedWindows.push(this.doOpenFilesInExistingWindow(windowOnWorkspace, filesToOpen, filesToCreate, filesToDiff, filesToWait)); </del> <ins> usedWindows.push(this.doOpenFilesInExistingWindow(openConfig, windowOnWorkspace, filesToOpen, filesToCreate, filesToDiff, filesToWait)); </ins> // Reset these because we handled them filesToOpen = [];
const windowOnFolderPath = windowsOnFolderPath[0]; // Do open files <del> usedWindows.push(this.doOpenFilesInExistingWindow(windowOnFolderPath, filesToOpen, filesToCreate, filesToDiff, filesToWait)); </del> <ins> usedWindows.push(this.doOpenFilesInExistingWindow(openConfig, windowOnFolderPath, filesToOpen, filesToCreate, filesToDiff, filesToWait)); </ins> // Reset these because we handled them filesToOpen = [];
return arrays.distinct(usedWindows); } <del> private doOpenFilesInExistingWindow(window: ICodeWindow, filesToOpen: IPath[], filesToCreate: IPath[], filesToDiff: IPath[], filesToWait: IPathsToWaitFor): ICodeWindow { </del> <ins> private doOpenFilesInExistingWindow(configuration: IOpenConfiguration, window: ICodeWindow, filesToOpen: IPath[], filesToCreate: IPath[], filesToDiff: IPath[], filesToWait: IPathsToWaitFor): ICodeWindow { </ins> window.focus(); // make sure window has focus window.ready().then(readyWindow => { <del> readyWindow.send('vscode:openFiles', { filesToOpen, filesToCreate, filesToDiff, filesToWait }); </del> <ins> const termProgram = configuration.userEnv ? configuration.userEnv['TERM_PROGRAM'] : void 0; readyWindow.send('vscode:openFiles', { filesToOpen, filesToCreate, filesToDiff, filesToWait, termProgram }); </ins> }); return window;
import { TERMINAL_BACKGROUND_COLOR, TERMINAL_BORDER_COLOR } from 'vs/workbench/parts/terminal/electron-browser/terminalColorRegistry'; import { DataTransfers } from 'vs/base/browser/dnd'; import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; <ins> import { ipcRenderer as ipc } from 'electron'; import { IOpenFileRequest } from 'vs/platform/windows/common/windows'; import { whenDeleted } from 'vs/base/node/pfs'; </ins> export class TerminalPanel extends Panel {
this._updateFont(); this._updateTheme(); <ins> ipc.on('vscode:openFiles', (_event: any, request: IOpenFileRequest) => { // if the request to open files is coming in from the integrated terminal (identified though // the termProgram variable) and we are instructed to wait for editors close, wait for the // marker file to get deleted and then focus back to the integrated terminal. if (request.termProgram === 'vscode' && request.filesToWait) { whenDeleted(request.filesToWait.waitMarkerFilePath).then(() => this.focus()); } }); </ins> // Force another layout (first is setContainers) since config has changed this.layout(new Dimension(this._terminalContainer.offsetWidth, this._terminalContainer.offsetHeight)); return TPromise.as(void 0);
for (let i = 0, len = events.length; i < len; i++) { const resource = events[i].resource; const isJson = paths.extname(resource.fsPath) === '.json'; <del> const isDeletedSettingsFolder = (events[i].type === FileChangeType.DELETED && paths.isEqual(paths.basename(resource.fsPath), this.configFolderRelativePath)); </del> <ins> const isDeletedSettingsFolder = (events[i].type === FileChangeType.DELETED && paths.basename(resource.fsPath) === this.configFolderRelativePath); </ins> if (!isJson && !isDeletedSettingsFolder) { continue; // only JSON files or the actual settings folder }
<del> <?xml version='1.0' standalone='no' ?> <svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10px' height='10px'> <style> circle { animation: ball 0.6s linear infinite; } circle:nth-child(2) { animation-delay: 0.075s; } circle:nth-child(3) { animation-delay: 0.15s; } circle:nth-child(4) { animation-delay: 0.225s; } circle:nth-child(5) { animation-delay: 0.3s; } circle:nth-child(6) { animation-delay: 0.375s; } circle:nth-child(7) { animation-delay: 0.45s; } circle:nth-child(8) { animation-delay: 0.525s; } @keyframes ball { from { opacity: 1; } to { opacity: 0.3; } } </style> <g style="fill:white;"> <circle cx='5' cy='1' r='1' style='opacity:0.3;' /> <circle cx='7.8284' cy='2.1716' r='1' style='opacity:0.3;' /> <circle cx='9' cy='5' r='1' style='opacity:0.3;' /> <circle cx='7.8284' cy='7.8284' r='1' style='opacity:0.3;' /> <circle cx='5' cy='9' r='1' style='opacity:0.3;' /> <circle cx='2.1716' cy='7.8284' r='1' style='opacity:0.3;' /> <circle cx='1' cy='5' r='1' style='opacity:0.3;' /> <circle cx='2.1716' cy='2.1716' r='1' style='opacity:0.3;' /> </g> </svg> </del>
*--------------------------------------------------------------------------------------------*/ .monaco-workbench > .part.statusbar > .statusbar-item.progress { <del> background-image: url(progress.svg); background-repeat: no-repeat; background-position: left; padding-left: 14px; display: inline; </del> <ins> padding-left: 5px; } .monaco-workbench > .part.statusbar > .statusbar-item.progress .spinner-container { padding-right: 5px; </ins> } .monaco-workbench .progress-badge > .badge-content {
render(element: HTMLElement): IDisposable { this._element = element; <del> this._label = new OcticonLabel(this._element); </del> this._element.classList.add('progress'); <ins> const container = document.createElement('span'); this._element.appendChild(container); const spinnerContainer = document.createElement('span'); spinnerContainer.classList.add('spinner-container'); container.appendChild(spinnerContainer); const spinner = new OcticonLabel(spinnerContainer); spinner.text = '$(sync~spin)'; const labelContainer = document.createElement('span'); container.appendChild(labelContainer); this._label = new OcticonLabel(labelContainer); </ins> this.hide(); return null; }
const info = document.createElement('div'); const building = document.createElement('div'); <ins> const errorTitle = n => nls.localize('totalErrors', "{0} Errors", n); const warningTitle = n => nls.localize('totalWarnings', "{0} Warnings", n); const infoTitle = n => nls.localize('totalInfos', "{0} Infos", n); </ins> Dom.addClass(element, 'task-statusbar-item'); Dom.addClass(label, 'task-statusbar-item-label'); element.appendChild(label); <del> element.title = nls.localize('problems', "Problems"); </del> Dom.addClass(errorIcon, 'task-statusbar-item-label-error'); Dom.addClass(errorIcon, 'mask-icon');
} })); <del> let updateStatus = (element: HTMLDivElement, icon: HTMLDivElement, stats: number): boolean => { if (stats > 0) { element.innerHTML = stats.toString(); $(element).show(); $(icon).show(); return true; </del> <ins> const manyProblems = nls.localize('manyProblems', "10K+"); const packNumber = n => n > 9999 ? manyProblems : n > 999 ? n.toString().charAt(0) + 'K' : n.toString(); let updateLabel = (stats: MarkerStatistics) => { error.innerHTML = packNumber(stats.errors); error.title = errorIcon.title = errorTitle(stats.errors); warning.innerHTML = packNumber(stats.warnings); warning.title = warningIcon.title = warningTitle(stats.warnings); if (stats.infos > 0) { info.innerHTML = packNumber(stats.infos); info.title = infoIcon.title = infoTitle(stats.infos); $(info).show(); $(infoIcon).show(); </ins> } else { <del> $(element).hide(); $(icon).hide(); return false; </del> <ins> $(info).hide(); $(infoIcon).hide(); </ins> } }; <del> let manyMarkers = nls.localize('manyMarkers', "99+"); let updateLabel = (stats: MarkerStatistics) => { error.innerHTML = stats.errors < 100 ? stats.errors.toString() : manyMarkers; warning.innerHTML = stats.warnings < 100 ? stats.warnings.toString() : manyMarkers; updateStatus(info, infoIcon, stats.infos); }; </del> this.markerService.onMarkerChanged((changedResources) => { updateLabel(this.markerService.getStatistics()); });
hoverMessage.appendMarkdown('n'); for (const { message, resource, startLineNumber, startColumn } of relatedInformation) { hoverMessage.appendMarkdown( <del> `* [${basename(resource.path)}(${startLineNumber}, ${startColumn})](${resource.toString(false)}#${startLineNumber},${startColumn}): `${message}` n` </del> <ins> `* [${basename(resource.path)}(${startLineNumber}, ${startColumn})](${resource.toString(false)}#${startLineNumber},${startColumn}): ` </ins> ); <ins> hoverMessage.appendText(`${message}`); hoverMessage.appendMarkdown('n'); </ins> } hoverMessage.appendMarkdown('n'); }
<del> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-disabled-grey{fill:#848484;}</style></defs><title>breakpoint-function-unverified</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M13.7,13H2.3L8,2.741Z"/></g><g id="iconBg"><path class="icon-disabled-grey" d="M8,4.8,4,12h8ZM8,6.859,10.3,11H5.7Z"/></g></svg> </del>  No newline at end of file <ins> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-disabled-grey{fill:#848484;}</style></defs><title>breakpoint-function-unverified</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M13.95,13H2.05L8,2.291Z"/></g><g id="iconBg"><path class="icon-disabled-grey" d="M8,4.35,3.75,12h8.5ZM8,6.924l2.125,3.826H5.875Z"/></g></svg> </ins>  No newline at end of file
<del> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-disabled-grey{fill:#848484;}</style></defs><title>breakpoint-log-unverified</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M13.414,8,8,13.414,2.586,8,8,2.586Z"/></g><g id="iconBg"><path class="icon-disabled-grey" d="M8,4,4,8l4,4,4-4ZM5.414,8,8,5.414,10.586,8,8,10.586Z"/></g></svg> </del>  No newline at end of file <ins> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-disabled-grey{fill:#848484;}</style></defs><title>breakpoint-log-unverified</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M13.664,8,8,13.664,2.336,8,8,2.336Z"/></g><g id="iconBg"><path class="icon-disabled-grey" d="M8,3.75,3.75,8,8,12.25,12.25,8ZM5.518,8,8,5.518,10.482,8,8,10.482Z"/></g></svg> </ins>  No newline at end of file
<del> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-disabled-grey{fill:#848484;}</style></defs><title>breakpoint-unverified</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M12.632,8A4.632,4.632,0,1,1,8,3.368,4.638,4.638,0,0,1,12.632,8Z"/></g><g id="iconBg"><path class="icon-disabled-grey" d="M8,4.211A3.789,3.789,0,1,0,11.789,8,3.788,3.788,0,0,0,8,4.211ZM8,10.79A2.79,2.79,0,1,1,10.79,8,2.794,2.794,0,0,1,8,10.79Z"/></g></svg> </del>  No newline at end of file <ins> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-disabled-grey{fill:#848484;}</style></defs><title>breakpoint-unverified</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M12.632,8A4.632,4.632,0,1,1,8,3.368,4.638,4.638,0,0,1,12.632,8Z"/></g><g id="iconBg"><path class="icon-disabled-grey" d="M8,4.211A3.789,3.789,0,1,0,11.79,8,3.788,3.788,0,0,0,8,4.211ZM8,10.29A2.29,2.29,0,1,1,10.29,8,2.292,2.292,0,0,1,8,10.29Z"/></g></svg> </ins>  No newline at end of file
const extRecommendations = this.extensionTipsService.getAllRecommendationsWithReason(); if (extRecommendations[extension.id.toLowerCase()]) { <del> data.root.setAttribute('aria-label', extension.displayName + '. ' + extRecommendations[extension.id]); </del> <ins> data.root.setAttribute('aria-label', extension.displayName + '. ' + extRecommendations[extension.id.toLowerCase()].reasonText); </ins> addClass(data.root, 'recommended'); data.root.title = extRecommendations[extension.id.toLowerCase()].reasonText; }
"command": "git.stashPopLatest", "title": "%command.stashPopLatest%", "category": "Git" <ins> }, { "command": "git.stashApply", "title": "%command.stashApply%", "category": "Git" }, { "command": "git.stashApplyLatest", "title": "%command.stashApplyLatest%", "category": "Git" </ins> } ], "menus": {
{ "command": "git.stashPopLatest", "when": "config.git.enabled && gitOpenRepositoryCount != 0" <ins> }, { "command": "git.stashApply", "when": "config.git.enabled && gitOpenRepositoryCount != 0" }, { "command": "git.stashApplyLatest", "when": "config.git.enabled && gitOpenRepositoryCount != 0" </ins> } ], "scm/title": [
"when": "scmProvider == git" }, { <ins> "command": "git.stashApply", "group": "5_stash", "when": "scmProvider == git" }, { "command": "git.stashApplyLatest", "group": "5_stash", "when": "scmProvider == git" }, { </ins> "command": "git.showOutput", "group": "7_repository", "when": "scmProvider == git"
"command.stash": "Stash", "command.stashPop": "Pop Stash...", "command.stashPopLatest": "Pop Latest Stash", <ins> "command.stashApply": "Apply Stash...", "command.stashApplyLatest": "Apply Latest Stash", </ins> "config.enabled": "Whether git is enabled", "config.path": "Path to the git executable", "config.autoRepositoryDetection": "Configures when repositories should be automatically detected.",
'use strict'; import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, MessageOptions } from 'vscode'; <del> import { Ref, RefType, Git, GitErrorCodes, Branch } from './git'; </del> <ins> import { Ref, RefType, Git, GitErrorCodes, Branch, Stash } from './git'; </ins> import { Repository, Resource, Status, CommitOptions, ResourceGroupType } from './repository'; import { Model } from './model'; import { toGitUri, fromGitUri } from './uri';
@command('git.stashPop', { repository: true }) async stashPop(repository: Repository): Promise<void> { <ins> const placeHolder = localize('pick stash to pop', "Pick a stash to pop"); const choice = await this.pickStash(repository, placeHolder); if (!choice) { return; } await repository.popStash(choice.id); } @command('git.stashPopLatest', { repository: true }) async stashPopLatest(repository: Repository): Promise<void> { </ins> const stashes = await repository.getStashes(); <del> if (stashes.length === 0) { window.showInformationMessage(localize('no stashes', "There are no stashes to restore.")); </del> <ins> if (!this.anyStashesAvailableToRestore(stashes)) { </ins> return; } <del> const picks = stashes.map(r => ({ label: `#${r.index}:  ${r.description}`, description: '', details: '', id: r.index })); const placeHolder = localize('pick stash to pop', "Pick a stash to pop"); const choice = await window.showQuickPick(picks, { placeHolder }); </del> <ins> await repository.popStash(); } @command('git.stashApply', { repository: true }) async stashApply(repository: Repository): Promise<void> { const placeHolder = localize('pick stash to apply', "Pick a stash to apply"); const choice = await this.pickStash(repository, placeHolder); </ins> if (!choice) { return; } <del> await repository.popStash(choice.id); </del> <ins> await repository.applyStash(choice.id); </ins> } <del> @command('git.stashPopLatest', { repository: true }) async stashPopLatest(repository: Repository): Promise<void> { </del> <ins> @command('git.stashApplyLatest', { repository: true }) async stashApplyLatest(repository: Repository): Promise<void> { </ins> const stashes = await repository.getStashes(); <del> if (stashes.length === 0) { </del> <ins> if (!this.anyStashesAvailableToRestore(stashes)) { return; } await repository.applyStash(); } private anyStashesAvailableToRestore(stashes: Stash[]): boolean { const stashesAvailable = stashes.length > 0; if (!stashesAvailable) { </ins> window.showInformationMessage(localize('no stashes', "There are no stashes to restore.")); <ins> } return stashesAvailable; } private async pickStash(repository: Repository, placeHolder: string) { const stashes = await repository.getStashes(); if (!this.anyStashesAvailableToRestore(stashes)) { </ins> return; } <del> await repository.popStash(); </del> <ins> const picks = stashes.map(r => ({ label: `#${r.index}:  ${r.description}`, description: '', details: '', id: r.index })); return await window.showQuickPick(picks, { placeHolder }); </ins> } private createCommand(id: string, key: string, method: Function, options: CommandOptions): (...args: any[]) => any { const result = (...args: any[]) => { let result: Promise<any>;
} async popStash(index?: number): Promise<void> { <del> try { const args = ['stash', 'pop']; </del> <ins> const args = ['stash', 'pop']; this.popOrApplyStash(args, index); } async applyStash(index?: number): Promise<void> { const args = ['stash', 'apply']; this.popOrApplyStash(args, index); } private async popOrApplyStash(args: string[], index?: number): Promise<void> { try { </ins> if (typeof index === 'number') { args.push(`stash@{${index}}`); }
return await this.run(Operation.Stash, () => this.repository.popStash(index)); } <ins> async applyStash(index?: number): Promise<void> { return await this.run(Operation.Stash, () => this.repository.applyStash(index)); } </ins> async getCommitTemplate(): Promise<string> { return await this.run(Operation.GetCommitTemplate, async () => this.repository.getCommitTemplate()); }
this._toDispose.push(this._editor.onContextMenu((e: IEditorMouseEvent) => this._onContextMenu(e))); this._toDispose.push(this._editor.onDidScrollChange((e: IScrollEvent) => { <del> if (this._contextMenuIsBeingShownCount > 0) { </del> <ins> if (this._contextMenuIsBeingShownCount > 0 && e.scrollTopChanged) { </ins> this._contextViewService.hideContextView(); } }));
} // 1.file.txt=>2.file.txt <del> let prefixFileRegex = RegExp('(d+)(' + separators + '.*)(..*)$'); </del> <ins> let prefixFileRegex = RegExp('^(d+)(' + separators + '.*)(..*)$'); </ins> if (!isFolder && name.match(prefixFileRegex)) { return name.replace(prefixFileRegex, (match, g1?, g2?, g3?) => { let number = parseInt(g1);
} // 1.txt=>2.txt <del> let prefixFileNoNameRegex = RegExp('(d+)(..*)$'); </del> <ins> let prefixFileNoNameRegex = RegExp('^(d+)(..*)$'); </ins> if (!isFolder && name.match(prefixFileNoNameRegex)) { return name.replace(prefixFileNoNameRegex, (match, g1?, g2?) => { let number = parseInt(g1);
assert.strictEqual(result, '2.test.js'); }); <ins> test('Increment file name with prefix version - check if starting from digit', function () { const name = 'F1.test.js'; const result = incrementFileName(name, false); assert.strictEqual(result, 'F1.test.1.js'); }); </ins> test('Increment file name with just version in name', function () { const name = '1.js'; const result = incrementFileName(name, false); assert.strictEqual(result, '2.js'); }); <ins> test('Increment file name with just version in name - check if starting from digit', function () { const name = 'F1.js'; const result = incrementFileName(name, false); assert.strictEqual(result, 'F1.1.js'); }); </ins> test('Increment file name with just version in name, too big number', function () { const name = '9007199254740992.js'; const result = incrementFileName(name, false);
this.value = value.trim(); } <del> static autocompletions(): string[] { </del> <ins> static autocompletions(query: string): string[] { </ins> const commands = ['installed', 'outdated', 'enabled', 'disabled', 'builtin', 'recommended', 'sort', 'category', 'tag', 'ext']; const subcommands = { 'sort': ['installs', 'rating', 'name'],
'ext': [''] }; <ins> let queryContains = (substr: string) => query.indexOf(substr) > -1; let hasSort = subcommands.sort.some(subcommand => queryContains(`@sort:${subcommand}`)); let hasCategory = subcommands.category.some(subcommand => queryContains(`@category:${subcommand}`)); </ins> return flatten( <del> commands.map(command => subcommands[command] ? subcommands[command].map(subcommand => `@${command}:${subcommand}${subcommand === '' ? '' : ' '}`) : [`@${command} `])); </del> <ins> commands.map(command => { if (hasSort && command === 'sort' || hasCategory && command === 'category') { return []; } if (subcommands[command]) { return subcommands[command].map(subcommand => `@${command}:${subcommand}${subcommand === '' ? '' : ' '}`); } else { return [`@${command} `]; } })); </ins> } static parse(value: string): Query {
// dont show autosuggestions if the user has typed something, but hasn't used the trigger character if (alreadyTypedCount > 0 && query[wordStart] !== '@') { return []; } <del> return Query.autocompletions().map(replacement => ({ fullText: replacement, overwrite: alreadyTypedCount })); </del> <ins> return Query.autocompletions(query).map(replacement => ({ fullText: replacement, overwrite: alreadyTypedCount })); </ins> } private count(): number {