jiebi/CodeConvo huggingface dataset:
*/ export function getPreviousFoldLine(lineNumber: number, foldingModel: FoldingModel): number | null { let foldingRegion = foldingModel.getRegionAtLine(lineNumber); <del> if (foldingRegion !== null) { </del> <ins> // If on the folding range start line, go to previous sibling. if (foldingRegion !== null && foldingRegion.startLineNumber === lineNumber) { </ins> // If current line is not the start of the current fold, go to top line of current fold. If not, go to previous fold. if (lineNumber !== foldingRegion.startLineNumber) { return foldingRegion.startLineNumber;
if (foldingModel.regions.length > 0) { foldingRegion = foldingModel.regions.toRegion(foldingModel.regions.length - 1); while (foldingRegion !== null) { <del> // Found non-parent fold before current line. if (foldingRegion.parentIndex === -1 && foldingRegion.startLineNumber < lineNumber) { </del> <ins> // Found fold before current line. if (foldingRegion.startLineNumber < lineNumber) { </ins> return foldingRegion.startLineNumber; } if (foldingRegion.regionIndex > 0) {
*/ export function getNextFoldLine(lineNumber: number, foldingModel: FoldingModel): number | null { let foldingRegion = foldingModel.getRegionAtLine(lineNumber); <del> if (foldingRegion !== null) { </del> <ins> // If on the folding range start line, go to next sibling. if (foldingRegion !== null && foldingRegion.startLineNumber === lineNumber) { </ins> // Find max line number to stay within parent. let expectedParentIndex = foldingRegion.parentIndex; let maxLineNumber = 0;
if (foldingModel.regions.length > 0) { foldingRegion = foldingModel.regions.toRegion(0); while (foldingRegion !== null) { <del> // Found non-parent fold after current line. if (foldingRegion.parentIndex === -1 && foldingRegion.startLineNumber > lineNumber) { </del> <ins> // Found fold after current line. if (foldingRegion.startLineNumber > lineNumber) { </ins> return foldingRegion.startLineNumber; } if (foldingRegion.regionIndex < foldingModel.regions.length) {
assert.strictEqual(getPreviousFoldLine(9, foldingModel), 5); assert.strictEqual(getPreviousFoldLine(5, foldingModel), 3); assert.strictEqual(getPreviousFoldLine(3, foldingModel), null); <ins> // Test when not on a folding region start line. assert.strictEqual(getPreviousFoldLine(4, foldingModel), 3); assert.strictEqual(getPreviousFoldLine(7, foldingModel), 6); assert.strictEqual(getPreviousFoldLine(8, foldingModel), 6); </ins> // Test jump to next. assert.strictEqual(getNextFoldLine(3, foldingModel), 5); <del> assert.strictEqual(getNextFoldLine(4, foldingModel), 5); </del> assert.strictEqual(getNextFoldLine(5, foldingModel), 9); assert.strictEqual(getNextFoldLine(9, foldingModel), null); <ins> // Test when not on a folding region start line. assert.strictEqual(getNextFoldLine(4, foldingModel), 5); assert.strictEqual(getNextFoldLine(7, foldingModel), 9); assert.strictEqual(getNextFoldLine(8, foldingModel), 9); </ins> } finally { textModel.dispose();
} override get capabilities(): EditorInputCapabilities { <del> return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton | EditorInputCapabilities.CanDropIntoEditor; </del> <ins> return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton | EditorInputCapabilities.CanDropIntoEditor | EditorInputCapabilities.ForceDescription; </ins> } setTerminalInstance(instance: ITerminalInstance): void {
async attachToProcess(id: number): Promise<void> { try { <del> this._throwIfNoPty(id).attach(); </del> <ins> await this._throwIfNoPty(id).attach(); </ins> this._logService.trace(`Persistent process reconnection "${id}"`); } catch (e) { this._logService.trace(`Persistent process reconnection "${id}" failed`, e.message); <ins> throw e; </ins> } }
})); } <del> attach(): void { </del> <ins> async attach(): Promise<void> { </ins> this._logService.trace('persistentTerminalProcess#attach', this._persistentProcessId); <ins> if (!this._disconnectRunner1.isScheduled() && !this._disconnectRunner2.isScheduled()) { // Something wrong happened if the disconnect runner is not canceled, this likely means // multiple windows attempted to attach. if (!await this._isOrphaned()) { throw new Error(`Cannot attach to persistent process "${this._persistentProcessId}", it is already adopted`); } this._logService.warn(`Persistent process "${this._persistentProcessId}": Process had no disconnect runners but was an orphan`); } </ins> this._disconnectRunner1.cancel(); this._disconnectRunner2.cancel(); }
if (result) { newProcess = result; } else { <del> this._logService.trace(`Attach to process failed for terminal ${shellLaunchConfig.attachPersistentProcess}`); return undefined; </del> <ins> // Warn and just create a new terminal if attach failed for some reason this._logService.warn(`Attach to process failed for terminal`, shellLaunchConfig.attachPersistentProcess); shellLaunchConfig.attachPersistentProcess = undefined; </ins> } <del> } else { </del> <ins> } if (!newProcess) { </ins> await this._terminalProfileResolverService.resolveShellLaunchConfig(shellLaunchConfig, { remoteAuthority: this.remoteAuthority, os: this.os
if (result) { newProcess = result; } else { <del> this._logService.trace(`Attach to process failed for terminal ${shellLaunchConfig.attachPersistentProcess}`); return undefined; </del> <ins> // Warn and just create a new terminal if attach failed for some reason this._logService.warn(`Attach to process failed for terminal`, shellLaunchConfig.attachPersistentProcess); shellLaunchConfig.attachPersistentProcess = undefined; </ins> } <del> } else { </del> <ins> } if (!newProcess) { </ins> newProcess = await this._launchLocalProcess(backend, shellLaunchConfig, cols, rows, this.userHome, isScreenReaderModeEnabled, variableResolver); } if (!this._isDisposed) {
private async _expandTerminalInstance(t: ITerminalInstanceLayoutInfoById): Promise<IRawTerminalInstanceLayoutInfo<IProcessDetails | null>> { try { const revivedPtyId = this._revivedPtyIdMap.get(t.terminal)?.newId; <ins> this._revivedPtyIdMap.delete(t.terminal); </ins> const persistentProcessId = revivedPtyId ?? t.terminal; const persistentProcess = this._throwIfNoPty(persistentProcessId); const processDetails = persistentProcess && await this._buildProcessDetails(t.terminal, persistentProcess, revivedPtyId !== undefined);
this._initDimensions(); await this._resize(); } else { <ins> const font = this.xterm ? this.xterm.getFont() : this._configHelper.getFont(dom.getWindow(this.domElement)); const maxColsForTexture = Math.floor(Constants.MaxCanvasWidth / (font.charWidth ?? 20)); </ins> // Fixed columns should be at least xterm.js' regular column count <del> const proposedCols = Math.max(this.maxCols, Math.min(this.xterm.getLongestViewportWrappedLineLength(), Constants.MaxSupportedCols)); </del> <ins> const proposedCols = Math.max(this.maxCols, Math.min(this.xterm.getLongestViewportWrappedLineLength(), maxColsForTexture)); </ins> // Don't switch to fixed dimensions if the content already fits as it makes the scroll // bar look bad being off the edge if (proposedCols > this.xterm.raw.cols) {
this._processCwd = processCwd; } <ins> private _clearLinkProviders(): void { dispose(this._linkProvidersDisposables); this._linkProvidersDisposables = []; } </ins> private _registerStandardLinkProviders(): void { <del> dispose(this._standardLinkProvidersDisposables); this._standardLinkProvidersDisposables = []; </del> for (const p of this._standardLinkProviders) { <del> this._standardLinkProvidersDisposables.push(this._xterm.registerLinkProvider(p)); </del> <ins> this._linkProvidersDisposables.push(this._xterm.registerLinkProvider(p)); </ins> } } registerExternalLinkProvider(instance: ITerminalInstance, linkProvider: ITerminalExternalLinkProvider): IDisposable { <ins> // Clear and re-register the standard link providers so they are a lower priority that the new one this._clearLinkProviders(); </ins> const wrappedLinkProvider = this._instantiationService.createInstance(TerminalExternalLinkProviderAdapter, this._xterm, instance, linkProvider, this._wrapLinkHandler.bind(this), this._tooltipCallback.bind(this)); const newLinkProvider = this._xterm.registerLinkProvider(wrappedLinkProvider); <del> // Re-register the standard link providers so they are a lower priority that the new one </del> <ins> this._linkProvidersDisposables.push(newLinkProvider); </ins> this._registerStandardLinkProviders(); return newLinkProvider; }
// Init winpty compat and link handler after process creation as they rely on the // underlying process OS this._processManager.onProcessReady((processTraits) => { <ins> // If links are ready, do not re-create the manager. if (this._areLinksReady) { return; } </ins> if (this._processManager.os === OperatingSystem.Windows) { xterm.setOption('windowsMode', processTraits.requiresWindowsMode || false); // Force line data to be sent when the cursor is moved, the main purpose for
// similar to if the app was launched from the dock // https://github.com/microsoft/vscode/issues/102975 <del> const spawnArgs = ['-n'];				// -n: launches even when opened already </del> <ins> // The following args are for the open command itself, rather than for VS Code: // -n creates a new instance. //    Without -n, the open command re-opens the existing instance as-is. // -g starts the new instance in the background. //    Later, Electron brings the instance to the foreground. //    This way, Mac does not automatically try to foreground the new instance, which causes //    focusing issues when the new instance only sends data to a previous instance and then closes. const spawnArgs = ['-n', '-g']; // -a opens the given application. </ins> spawnArgs.push('-a', process.execPath); // -a: opens a specific application if (verbose) {
const majorNodeVersion = parseInt(/^(d+)./.exec(process.versions.node)[1]); if (majorNodeVersion < 14 || majorNodeVersion >= 17) { <del> console.error('033[1;31m*** Please use node.js versions >=14 and <=17.033[0;0m'); </del> <ins> console.error('033[1;31m*** Please use node.js versions >=14 and <17.033[0;0m'); </ins> err = true; }
#!/bin/sh VSCODE_GIT_ASKPASS_PIPE=`mktemp` <del> ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_EXTRA_ARGS" "$VSCODE_GIT_ASKPASS_MAIN" $* </del> <ins> ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_MAIN" $VSCODE_GIT_ASKPASS_EXTRA_ARGS $* </ins> cat $VSCODE_GIT_ASKPASS_PIPE rm $VSCODE_GIT_ASKPASS_PIPE
margin-top: -1px; } <ins> .codicon-debug-breakpoint.codicon-debug-stackframe-focused::after, .codicon-debug-breakpoint.codicon-debug-stackframe::after { content: 'eb8a'; position: absolute; } </ins> .monaco-editor .debug-top-stack-frame-column { font: normal normal normal 16px/1 codicon; text-rendering: auto;
import { XtermTerminal } from 'vs/workbench/contrib/terminal/browser/xterm/xtermTerminal'; import { escapeNonWindowsPath } from 'vs/platform/terminal/common/terminalEnvironment'; import { IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/workspaceTrust'; <ins> import { isFirefox } from 'vs/base/browser/browser'; </ins> const enum Constants { /**
} this.xterm?.dispose(); <ins> // HACK: Workaround for Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=559561, // as 'blur' event in xterm.raw.textarea is not triggered on xterm.dispose() // See https://github.com/microsoft/vscode/issues/138358 if (isFirefox) { this._terminalFocusContextKey.reset(); this._terminalHasTextContextKey.reset(); this._onDidBlur.fire(this); } </ins> if (this._pressAnyKeyToCloseListener) { this._pressAnyKeyToCloseListener.dispose(); this._pressAnyKeyToCloseListener = undefined;
properties: { searchString: { type: 'string' }, replaceString: { type: 'string' }, <del> regex: { type: 'boolean' }, regexOverride: { type: 'number', description: nls.localize('actions.find.isRegexOverride', 'Overrides "Use Regular Expression" flag.nThe flag will not be saved for the future.n0: Do Nothingn1: Truen2: False') }, wholeWord: { type: 'boolean' }, wholeWordOverride: { type: 'number', description: nls.localize('actions.find.wholeWordOverride', 'Overrides "Match Whole Word" flag.nThe flag will not be saved for the future.n0: Do Nothingn1: Truen2: False') }, matchCase: { type: 'boolean' }, matchCaseOverride: { type: 'number', description: nls.localize('actions.find.matchCaseOverride', 'Overrides "Math Case" flag.nThe flag will not be saved for the future.n0: Do Nothingn1: Truen2: False') }, </del> <ins> isRegex: { type: 'boolean' }, matchWholeWord: { type: 'boolean' }, isCaseSensitive: { type: 'boolean' }, </ins> preserveCase: { type: 'boolean' }, <del> preserveCaseOverride: { type: 'number', description: nls.localize('actions.find.preserveCaseOverride', 'Overrides "Preserve Case" flag.nThe flag will not be saved for the future.n0: Do Nothingn1: Truen2: False') }, </del> findInSelection: { type: 'boolean' }, } }
"explorer/context": [ { "command": "markdown.showPreview", <del> "when": "resourceLangId == markdown", </del> <ins> "when": "resourceLangId == markdown && !hasCustomMarkdownPreview", </ins> "group": "navigation" } ], "editor/title/context": [ { "command": "markdown.showPreview", <del> "when": "resourceLangId == markdown", </del> <ins> "when": "resourceLangId == markdown && !hasCustomMarkdownPreview", </ins> "group": "1_open" } ],
'out-build/vs/base/node/ps.sh', // Terminal shell integration <del> 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish', </del> 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1', 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh', 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-env.zsh', 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh', 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh', 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-login.zsh', <del> 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish', </del> <ins> 'out-build/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish', </ins> '!**/test/**' ];
'out-build/vs/workbench/browser/media/*-theme.css', 'out-build/vs/workbench/contrib/debug/**/*.json', 'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt', <del> 'out-build/vs/workbench/contrib/terminal/browser/media/*.fish', </del> <ins> 'out-build/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/*.fish', </ins> 'out-build/vs/workbench/contrib/terminal/browser/media/*.ps1', 'out-build/vs/workbench/contrib/terminal/browser/media/*.sh', 'out-build/vs/workbench/contrib/terminal/browser/media/*.zsh',
// Usage: `[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"` case 'zsh': file = 'shellIntegration-rc.zsh'; break; // Usage: `string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish)` <del> case 'fish': file = 'shellIntegration.fish'; break; </del> <ins> case 'fish': file = 'fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish'; break; </ins> default: throw new Error('Error using --locate-shell-integration-path: Invalid shell type'); } console.log(join(getAppRoot(), 'out', 'vs', 'workbench', 'contrib', 'terminal', 'browser', 'media', file));
// The injection mechanism used for fish is to add a custom dir to $XDG_DATA_DIRS which // is similar to $ZDOTDIR in zsh but contains a list of directories to run from. const oldDataDirs = env?.XDG_DATA_DIRS ?? '/usr/local/share:/usr/share'; <del> const newDataDir = path.join(appRoot, 'out/vs/workbench/contrib/xdg_data'); </del> <ins> const newDataDir = path.join(appRoot, 'out/vs/workbench/contrib/terminal/browser/media/fish_xdg_data'); </ins> envMixin['XDG_DATA_DIRS'] = `${oldDataDirs}:${newDataDir}`; addEnvMixinPathPrefix(options, envMixin); return { newArgs: undefined, envMixin };
case 'fish': { // The injection mechanism used for fish is to add a custom dir to $XDG_DATA_DIRS which // is similar to $ZDOTDIR in zsh but contains a list of directories to run from. <del> // const oldDataDirs = env?.XDG_DATA_DIRS ?? '/usr/local/share:/usr/share'; // const newDataDir = path.join(appRoot, 'out/vs/workbench/contrib/terminal/browser/media/fish_xdg_data'); // envMixin['XDG_DATA_DIRS'] = `${oldDataDirs}:${newDataDir}`; // addEnvMixinPathPrefix(options, envMixin); // return { newArgs: undefined, envMixin }; return undefined; </del> <ins> const oldDataDirs = env?.XDG_DATA_DIRS ?? '/usr/local/share:/usr/share'; const newDataDir = path.join(appRoot, 'out/vs/workbench/contrib/terminal/browser/media/fish_xdg_data'); envMixin['XDG_DATA_DIRS'] = `${oldDataDirs}:${newDataDir}`; addEnvMixinPathPrefix(options, envMixin); return { newArgs: undefined, envMixin }; </ins> } case 'pwsh': { if (!originalArgs || arePwshImpliedArgs(originalArgs)) {
__vsc_esc D end <ins> # Preserve the user's existing prompt, to wrap in our escape sequences. function __preserve_fish_prompt --on-event fish_prompt if functions --query fish_prompt if functions --query __vsc_fish_prompt # Erase the fallback so it can be set to the user's prompt functions --erase __vsc_fish_prompt end functions --copy fish_prompt __vsc_fish_prompt functions --erase __preserve_fish_prompt # Now __vsc_fish_prompt is guaranteed to be defined __init_vscode_shell_integration else if functions --query __vsc_fish_prompt # There is no fish_prompt set, so stick with the default functions --erase __preserve_fish_prompt # Now __vsc_fish_prompt is guaranteed to be defined __init_vscode_shell_integration else function __vsc_fish_prompt echo -n (whoami)@(prompt_hostname) (prompt_pwd) '~> ' end end end end __preserve_fish_prompt </ins> # Sent whenever a new fish prompt is about to be displayed. # Updates the current working directory. function __vsc_update_cwd --on-event fish_prompt
functions fish_mode_prompt | string match -rvq '^ *(#|function |end$|$)' end <del> # Preserve the user's existing prompt, to wrap in our escape sequences. functions --copy fish_prompt __vsc_fish_prompt </del> # Preserve and wrap fish_mode_prompt (which appears to the left of the regular # prompt), but only if it's not defined as an empty function (which is the # officially documented way to disable that feature). <del> if __vsc_fish_has_mode_prompt functions --copy fish_mode_prompt __vsc_fish_mode_prompt function fish_mode_prompt __vsc_fish_prompt_start __vsc_fish_mode_prompt end function fish_prompt __vsc_fish_prompt __vsc_fish_cmd_start end else # No fish_mode_prompt, so put everything in fish_prompt. function fish_prompt __vsc_fish_prompt_start __vsc_fish_prompt __vsc_fish_cmd_start </del> <ins> function __init_vscode_shell_integration if __vsc_fish_has_mode_prompt functions --copy fish_mode_prompt __vsc_fish_mode_prompt function fish_mode_prompt __vsc_fish_prompt_start __vsc_fish_mode_prompt end function fish_prompt __vsc_fish_prompt __vsc_fish_cmd_start end else # No fish_mode_prompt, so put everything in fish_prompt. function fish_prompt __vsc_fish_prompt_start __vsc_fish_prompt __vsc_fish_cmd_start end </ins> end end
resourceProvider: WebviewResourceProvider, ): Promise<MarkdownContentProviderOutput> { const rendered = await this.engine.render(markdownDocument, resourceProvider); <del> const html = `<div class="markdown-body">${rendered.html}<div class="code-line" data-line="${markdownDocument.lineCount}"></div></div>`; </del> <ins> const html = `<div class="markdown-body" dir="auto">${rendered.html}<div class="code-line" data-line="${markdownDocument.lineCount}"></div></div>`; </ins> return { html, containingImages: rendered.containingImages
const outDir = path.join(outputRoot, 'media'); async function build() { <del> fs.copyFileSync( path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'), path.join(outDir, 'codicon.css')); fs.copyFileSync( path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'), path.join(outDir, 'codicon.ttf')); </del> await esbuild.build({ <del> entryPoints: [ path.join(srcDir, 'index.ts') ], </del> <ins> entryPoints: { 'index': path.join(srcDir, 'index.ts'), 'codicon': path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'), }, loader: { '.ttf': 'dataurl', }, </ins> bundle: true, minify: true, sourcemap: false,
const newRenderMode = e.altKey && e.ctrlKey ? altMode : defaultMode; if (newRenderMode !== this._activeRenderMode) { this._activeRenderMode = newRenderMode; <del> const ranges = this._getHintsRanges(); const copies = this._copyInlayHintsWithCurrentAnchor(this._editor.getModel()); this._updateHintsDecorators(ranges, copies); </del> <ins> const model = this._editor.getModel(); const copies = this._copyInlayHintsWithCurrentAnchor(model); this._updateHintsDecorators([model.getFullModelRange()], copies); </ins> scheduler.schedule(0); } }));
} // return inlay hints but with an anchor that reflects "updates" <del> // that happens after receiving them, e.g adding new lines before a hint </del> <ins> // that happened after receiving them, e.g adding new lines before a hint </ins> private _copyInlayHintsWithCurrentAnchor(model: ITextModel): InlayHintItem[] { const items = new Map<InlayHintItem, InlayHintItem>(); for (const [id, obj] of this._decorationsMetadata) {
const container = document.createElement('span'); container.classList.add('all-options'); parent.appendChild(container); <del> const action = new Action('all', localize('all', "Show Quick Pick Options..."), Codicon.chevronDown.classNames, true, () => { </del> <ins> const action = new Action('all', localize('all', "Show Search Modes..."), Codicon.chevronDown.classNames, true, () => { </ins> quickInputService.quickAccess.show('?'); }); const dropdown = new ActionViewItem(undefined, action, { icon: true, label: false, hoverDelegate });
import 'vs/css!./media/extensionEditor'; import { localize } from 'vs/nls'; import * as arrays from 'vs/base/common/arrays'; <del> import { OS } from 'vs/base/common/platform'; </del> <ins> import { OS, locale } from 'vs/base/common/platform'; </ins> import { Event, Emitter } from 'vs/base/common/event'; import { Cache, CacheResult } from 'vs/base/common/cache'; import { Action, IAction } from 'vs/base/common/actions';
append(moreInfo, $('.more-info-entry', undefined, $('div', undefined, localize('release date', "Released on")), <del> $('div', undefined, new Date(gallery.releaseDate).toLocaleString(undefined, { hourCycle: 'h23' })) </del> <ins> $('div', undefined, new Date(gallery.releaseDate).toLocaleString(locale, { hourCycle: 'h23' })) </ins> ), $('.more-info-entry', undefined, $('div', undefined, localize('last updated', "Last updated")), <del> $('div', undefined, new Date(gallery.lastUpdated).toLocaleString(undefined, { hourCycle: 'h23' })) </del> <ins> $('div', undefined, new Date(gallery.lastUpdated).toLocaleString(locale, { hourCycle: 'h23' })) </ins> ) ); }
const repoPath = path.normalize(result.stdout.trimLeft().replace(/[rn]+$/, '')); if (isWindows) { <del> // On Git 2.25+ if you call `rev-parse --show-toplevel` on a mapped drive, instead of getting the mapped drive path back, you get the UNC path for the mapped drive. // So we will try to normalize it back to the mapped drive path, if possible </del> <ins> // On Git 2.25+ if you call `rev-parse --show-toplevel` on a mapped drive, instead of getting the mapped // drive path back, you get the UNC path for the mapped drive. So we will try to normalize it back to the // mapped drive path, if possible </ins> const repoUri = Uri.file(repoPath); const pathUri = Uri.file(repositoryPath); if (repoUri.authority.length !== 0 && pathUri.authority.length === 0) {
return path.normalize(pathUri.fsPath); } <ins> // On Windows, there are cases in which the normalized path for a mapped folder contains a trailing `` // character (ex: serverfolder) due to the implementation of `path.normalize()`. This behaviour is // by design as documented in https://github.com/nodejs/node/issues/1765. if (repoUri.authority.length !== 0) { return repoPath.replace(/$/, ''); } </ins> } return repoPath;
return false; } <del> const match = /^(?:https://github.com/|git@github.com:)([^/]+)/([^/.]+)(?:.git)?$/i.exec(remoteUrl); </del> <ins> const match = /^(?:https://github.com/|git@github.com:)([^/]+)/([^/.]+)/i.exec(remoteUrl); </ins> if (!match) { return false; }