Change:
My project is under https://user- Reproduce steps: vscode open a folder which file path contains space, for example: an integrated terminal the path link Versions:
nice I can repro with the space in the name, thanks for following up
I can still repro with Windows.
I looked into this, and it will be tricky because we currently use space as one of the characters which indicates the end of a path. One idea would be to check if such a link exists (using our original regex) and if not, use regex on the subsequent sequence - then concatenating the two results for First result would be doesn't exist process exists
https://user- Look the above video, I have several questions. path is not a existed path in the disk, but also clickable. I click the , it open a file which is not why the whole string is recogonized to a path? the real path is:
this is actually about when the parents of the link have a space, it's expected currently that an absolute path with a space won't work.
is it expected that a local link with a space somewhere within the path is not detected? that is the case currently - verified via adding a test to
absolute paths (eg. ) won't work because of Relative paths without spaces with absolute ancestors that have spaces (eg. inside ) should work but don't in some cases.
When verifying, make sure to test both on a Windows machine and a non-Windows machine.
Doesn't work for me on a Mac, I guess thats probably because I still haven't got the fix in the latest insider build.
are you on ?
Worked for me on macOS. Don't have a Windows machine to try this out so someone else will need to verify on Windows.
Yes, I'm on that same version. Here's what it looks like for me on a Mac with spaces !
still not work in latest version: https://user-
For absolute paths, see I wasn't able to get to work, though. It'd open the file, but place the cursor at the beginning.
please provide some more details, it works for me: !
This is the behaviour with version 1.70.0 After ctrl+clik a popup appears at the top of the screen and I have to hit enter to go to the suggested file:line.
I can repro that on Windows, Remote-WSL and macOS. The file must not be in the root directory for this to happen. !
let's track that problem in and as this issue is becoming quite unwieldy/unfocused.
created to track the problem related to quotes you're seeing. Could you re-verify this if all good outside of these 3 issues I created? It's difficult to manage this issue as it's so general.

Discussion:
import { IHostService } from 'vs/workbench/services/host/browser/host'; import { QueryBuilder } from 'vs/workbench/services/search/common/queryBuilder'; import { ISearchService } from 'vs/workbench/services/search/common/search'; <ins> import { basename } from 'vs/base/common/path'; </ins> export class TerminalLocalFileLinkOpener implements ITerminalLinkOpener { constructor(

if (!link.uri) { throw new Error('Tried to open file link without a resolved URI'); } <del> const lineColumnInfo: ILineColumnInfo = this.extractLineColumnInfo(link.text); </del> <ins> const lineColumnInfo: ILineColumnInfo = this.extractLineColumnInfo(link.text, link.uri); </ins> const selection: ITextEditorSelection = { startLineNumber: lineColumnInfo.lineNumber, startColumn: lineColumnInfo.columnNumber

* * @param link Url link which may contain line and column number. */ <del> extractLineColumnInfo(link: string): ILineColumnInfo { </del> <ins> extractLineColumnInfo(link: string, uri?: URI): ILineColumnInfo { </ins> const lineColumnInfo: ILineColumnInfo = { lineNumber: 1, columnNumber: 1 }; <ins> // If a URI was passed in the exact file is known, sanitize the link text such that the // folders and file name do not contain whitespace. The actual path isn't important in // extracting the line and column from the regex so this is safe if (uri) { const fileName = basename(uri.path); const index = link.indexOf(fileName); const endIndex = index + fileName.length; link = link.slice(0, endIndex).replace(/s/g, '_') + link.slice(endIndex); } </ins> // The local link regex only works for non file:// links, check these for a simple // `:line:col` suffix if (link.startsWith('file://')) {

import { Schemas } from 'vs/base/common/network'; import { OperatingSystem } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; <del> import { ITextResourceEditorInput } from 'vs/platform/editor/common/editor'; </del> <ins> import { ITextEditorSelection, ITextResourceEditorInput } from 'vs/platform/editor/common/editor'; </ins> import { IFileService, IFileStatWithPartialMetadata } from 'vs/platform/files/common/files'; import { FileService } from 'vs/platform/files/common/fileService'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';

export interface ITerminalLinkActivationResult { source: 'editor' | 'search'; link: string; <ins> selection?: ITextEditorSelection; </ins> } class TestCommandDetectionCapability extends CommandDetectionCapability {

source: 'editor', link: editor.resource?.toString() }; <ins> // Only assert on selection if it's not the default value if (editor.options?.selection && (editor.options.selection.startColumn !== 1 || editor.options.selection.startLineNumber !== 1)) { activationResult.selection = editor.options.selection; } </ins> } } as Partial<IEditorService>); // /*editorServiceSpy = */instantiationService.spy(IEditorService, 'openEditor');

}); }); <ins> test('should extract line and column from links in a workspace containing spaces', async () => { localFileOpener = instantiationService.createInstance(TerminalLocalFileLinkOpener, OperatingSystem.Linux); const localFolderOpener = instantiationService.createInstance(TerminalLocalFolderInWorkspaceLinkOpener); opener = instantiationService.createInstance(TerminalSearchLinkOpener, capabilities, Promise.resolve('/space folder'), localFileOpener, localFolderOpener, OperatingSystem.Linux); fileService.setFiles([ URI.from({ scheme: Schemas.file, path: '/space folder/foo/bar.txt' }) ]); await opener.open({ text: './foo/bar.txt:10:5', bufferRange: { start: { x: 1, y: 1 }, end: { x: 8, y: 1 } }, type: TerminalBuiltinLinkType.Search }); deepStrictEqual(activationResult, { link: 'file:///space%20folder/foo/bar.txt', source: 'editor', selection: { startColumn: 5, startLineNumber: 10 }, }); }); </ins> suite('macOS/Linux', () => { setup(() => { localFileOpener = instantiationService.createInstance(TerminalLocalFileLinkOpener, OperatingSystem.Linux);