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

Monaco uri parse wrongly parses URL #1375

Closed
mkapiczy opened this issue Mar 18, 2019 · 1 comment
Closed

Monaco uri parse wrongly parses URL #1375

mkapiczy opened this issue Mar 18, 2019 · 1 comment

Comments

@mkapiczy
Copy link

I can't reopen my old issue #1097, that's why I create a new one because I encountered the same problem once again.

So, monaco.Uri.parse wrongly parses URL, escaping the / character.

This is my url:
http://localhost:8081/#/applications/app/82bb8afa-0401-4562-aca2-2eb1ff2eb06a/field/fe5ba7a9-689d-4cc2-89ae-fc076c6473cc

The parse method turns it into:

http://localhost:8081/#/%2Fapplications%2Fapp%2F82bb8afa-0401-4562-aca2-2eb1ff2eb06a%2Ffield%2Ffe5ba7a9-689d-4cc2-89ae-fc076c6473cc

When I remove the # sign it works, but that is a valid URL, so I would expect it to be handled by the parser.

The problem appears when I register a custom definition provider:

monaco.languages.registerDefinitionProvider('javascript', {
        provideDefinition: (model, position, cancellationToken) => {
          /**
          * Get the uri to redirect to
           */
          const uri = getTheUriSomehowInStringFormat()
              return {
                uri: monaco.Uri.parse(uri),
                range: new monaco.Range(3, 1, 3, 1)
              }
            })
    }

And now I am redirected to the uri with escaped / character. If that's just a toString method, as suggested in previous issue, then I guess it's monaco internal call of toString somewhere?

@alexdima
Copy link
Member

I believe you are correct, but it appears that the Uri from VS Code is generally accepted to be a broken implementation, but unfortunately it will not be changed anymore because of breaking existing VS Code extensions.

See microsoft/vscode#86043

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants