Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct vscode open links #761

Closed
wants to merge 1 commit into from

Conversation

andrewnicols
Copy link
Contributor

The format of links for vscode is currently set to:

vscode://file/{$file}:{$line}

This leads to URIs such as:

vscode://file//Users/example/git/example.php

However vscode expects URIs in the format:

vscode://file/Users/example/git/example.php

That is to say that the URI should be immediately after the file.

The correct URI format is:

vscode://file{$file}:{$line}

See microsoft/vscode#197319 for more information.

The format of links for vscode is currently set to:

    vscode://file/{$file}:{$line}

This leads to URIs such as:

    vscode://file//Users/example/git/example.php

However vscode expects URIs in the format:

    vscode://file/Users/example/git/example.php

That is to say that the URI should be immediately after the `file`.

The correct URI format is:

    vscode://file{$file}:{$line}

See microsoft/vscode#197319 for more
information.
Copy link
Collaborator

@denis-sokolov denis-sokolov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for quickly fixing this.

I do agree with your comment on the linked issue, I think this is a bug and a breking change in VS Code. The syntax looks wonky without the separator between the literal word “file” and the path to the file.

Let’s wait for a bit to see if that decision gets reverted. I have made a PR in an attempt to force the issue. If it ends up being merged, then that’ll be the official confirmation that the new syntax is canonical.

@@ -118,7 +118,7 @@ class PrettyPageHandler extends Handler
"macvim" => "mvim://open/?url=file://%file&line=%line",
"phpstorm" => "phpstorm://open?file=%file&line=%line",
"idea" => "idea://open?file=%file&line=%line",
"vscode" => "vscode://file/%file:%line",
"vscode" => "vscode://file%file:%line",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems possibly not correct. The new format is like this only on non-Windows. On Windows we still need a leading slash in the format. (Possible update to VS Code docs)

We would need to introduce additional processing here: a conditional, or at least a str_replace. This is inconvenient. :-(

@denis-sokolov
Copy link
Collaborator

It seems like this change is not needed after all: microsoft/vscode#198509 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants