Change:
<!-- Do Not Delete This! featurerequesttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Describe the feature you'd like. --Under remote development, if you click a file from terminal(eg, after ls command)Vscode will try to open a file named the one you just clicked. Actually, the absolute path of the file is already known, So why not open it directly in the editor? I think that would be very useful. Please consider it.
Are you talking about this new behavior? ! I CMD + Clicked on the underlined path and it used to open the file directly since its obvious which file it is. But since a few days or weeks (idk exactly) it opens this menu for me to select the file from a list of files with similar paths. Its pretty annoying and id really like the old behavior back. If you are talking about something different let me know so i can open a separate issue.
Yes, it is. I prefer old behavior too.
what is the working directory of the terminal you're in? The current expected behavior is to open the file directly if you cwd is the folder containing , otherwise a workspace search will happen.
I, obviously, don't know for him but in my example the working directory of the terminal is the folder containing .
hmm ok, I'll try investigate this next month.
For me, mostly, it's project home folder(src's parent folder).
Can reproduce on Windows: ! Shell integration must be disabled, there's also some caching here so try after restarting the window if disabling shell integration.
I can still reproduce this in the latest insiders. I ctrl+clicked on "". Shell integration is off. I closed all VS Code insiders windows before trying to repro. !
I can repro but only in a Windows remote (Windows -Window), not a WSL remote (Windows -Linux).
With file structure: Clicking a link: ! The expectation here is to open immediately without the search because while matches a search it does not match the folder prefix.
Moving to July as it's only for Windows remotes. Also spotted this one:
I can still repro the issue from Windows -Windows remote Version: 1.70.0-insider (system setup) Commit: Using my cloned version of the tree-view extension sample as the open folder and running in the terminal. Tried with shell integration on and off. (and closed all insiders windows inbetween)
I can't reproduce this: ! I saw this related minor issue , but I think this issue is fixed.
I'm still seeing it with the insiders from today.
Actually, I can't get shell integration to turn on even after a restart. I set the setting, but the circle never shows.
that would be the reason then, there could be a few reasons for that. There may be a warning in your console, or are you using powershell 5?
My powershell version is 7.2.5. I have this error in the pty log:
Verified. Here's the Powershell profile I have: Powershell 7 for me is at . Windows Powershell is at . I wonder whether your profile is picking up Windows Powershell by accident?

Discussion:
this._openers.set(TerminalBuiltinLinkType.LocalFile, localFileOpener); this._openers.set(TerminalBuiltinLinkType.LocalFolderInWorkspace, localFolderInWorkspaceOpener); this._openers.set(TerminalBuiltinLinkType.LocalFolderOutsideWorkspace, this._instantiationService.createInstance(TerminalLocalFolderOutsideWorkspaceLinkOpener)); <del> this._openers.set(TerminalBuiltinLinkType.Search, this._instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, localFileOpener, localFolderInWorkspaceOpener, this._processManager.os || OS)); </del> <ins> this._openers.set(TerminalBuiltinLinkType.Search, this._instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, this._processManager.getInitialCwd(), localFileOpener, localFolderInWorkspaceOpener, this._processManager.os || OS)); </ins> this._openers.set(TerminalBuiltinLinkType.Url, this._instantiationService.createInstance(TerminalUrlLinkOpener, !!this._processManager.remoteAuthority)); this._registerStandardLinkProviders();

constructor( private readonly _capabilities: ITerminalCapabilityStore, <ins> private readonly _initialCwd: Promise<string>, </ins> private readonly _localFileOpener: TerminalLocalFileLinkOpener, private readonly _localFolderInWorkspaceOpener: TerminalLocalFolderInWorkspaceLinkOpener, private readonly _os: OperatingSystem,

} private async _getExactMatch(sanitizedLink: string): Promise<IResourceMatch | undefined> { <ins> // Make the link relative to the cwd if it isn't absolute const pathModule = osPathModule(this._os); const isAbsolute = pathModule.isAbsolute(sanitizedLink); let absolutePath: string | undefined = isAbsolute ? sanitizedLink : undefined; const initialCwd = await this._initialCwd; if (!isAbsolute && initialCwd.length > 0) { absolutePath = pathModule.join(initialCwd, sanitizedLink); } // Try open as an absolute link </ins> let resourceMatch: IResourceMatch | undefined; <del> if (osPathModule(this._os).isAbsolute(sanitizedLink)) { </del> <ins> if (absolutePath) { const slashNormalizedPath = this._os === OperatingSystem.Windows ? absolutePath.replace(//g, '/') : absolutePath; </ins> const scheme = this._workbenchEnvironmentService.remoteAuthority ? Schemas.vscodeRemote : Schemas.file; <del> const slashNormalizedPath = this._os === OperatingSystem.Windows ? sanitizedLink.replace(//g, '/') : sanitizedLink; </del> const uri = URI.from({ scheme, path: slashNormalizedPath }); try { const fileStat = await this._fileService.stat(uri);

// File or dir doesn't exist, continue on } } <ins> // Search the workspace if an exact match based on the absolute path was not found </ins> if (!resourceMatch) { const results = await this._searchService.fileSearch( this._fileQueryBuilder.file(this._workspaceContextService.getWorkspace().folders, {

instantiationService.stub(IViewDescriptorService, viewDescriptorService); xterm = new Terminal({ cols: 80, rows: 30 }); <del> linkManager = instantiationService.createInstance(TestLinkManager, xterm, upcastPartial<ITerminalProcessManager>({}), { </del> <ins> linkManager = instantiationService.createInstance(TestLinkManager, xterm, upcastPartial<ITerminalProcessManager>({ async getInitialCwd() { return ''; } }), { </ins> get<T extends TerminalCapability>(capability: T): ITerminalCapabilityImplMap[T] | undefined { return undefined; }

capabilities.add(TerminalCapability.CommandDetection, commandDetection); }); <ins> test('should open single exact match against cwd when searching if it exists', async () => { localFileOpener = instantiationService.createInstance(TerminalLocalFileLinkOpener, OperatingSystem.Linux); const localFolderOpener = instantiationService.createInstance(TerminalLocalFolderInWorkspaceLinkOpener); opener = instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, Promise.resolve('/initial/cwd'), localFileOpener, localFolderOpener, OperatingSystem.Linux); fileService.setFiles([ URI.from({ scheme: Schemas.file, path: '/initial/cwd/foo/bar.txt' }), URI.from({ scheme: Schemas.file, path: '/initial/cwd/foo2/bar.txt' }) ]); await opener.open({ text: 'foo/bar.txt', bufferRange: { start: { x: 1, y: 1 }, end: { x: 8, y: 1 } }, type: TerminalBuiltinLinkType.Search }); deepStrictEqual(activationResult, { link: 'file:///initial/cwd/foo/bar.txt', source: 'editor' }); }); </ins> suite('macOS/Linux', () => { setup(() => { localFileOpener = instantiationService.createInstance(TerminalLocalFileLinkOpener, OperatingSystem.Linux); const localFolderOpener = instantiationService.createInstance(TerminalLocalFolderInWorkspaceLinkOpener); <del> opener = instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, localFileOpener, localFolderOpener, OperatingSystem.Linux); </del> <ins> opener = instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, Promise.resolve(''), localFileOpener, localFolderOpener, OperatingSystem.Linux); </ins> }); test('should apply the cwd to the link only when the file exists and cwdDetection is enabled', async () => {

setup(() => { localFileOpener = instantiationService.createInstance(TerminalLocalFileLinkOpener, OperatingSystem.Windows); const localFolderOpener = instantiationService.createInstance(TerminalLocalFolderInWorkspaceLinkOpener); <del> opener = instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, localFileOpener, localFolderOpener, OperatingSystem.Windows); </del> <ins> opener = instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, Promise.resolve(''), localFileOpener, localFolderOpener, OperatingSystem.Windows); </ins> }); test('should apply the cwd to the link only when the file exists and cwdDetection is enabled', async () => {