Skip to content

URIs from VS Code are not always round-tripped accurately #896

@urbanfly

Description

@urbanfly

When a new, untitled file is assigned to the Parametric Lang, the didOpen executes with params.getTextDocument().getUri() == "untitled:Untitled-1". A new TextDocumentState is created with a Java-side URI like |untitled:///:Untitled-1|.

When parse errors are reported back to VS Code, they appear in the Problems pane with a title like ":Untitled-1", but NOT as red squiggles in the open, untitled document. Clicking the problem opens a 2nd untitled document:

Image

To Reproduce

Steps to reproduce the behavior:

  1. Launch the 2nd-level VS Code
  2. Load the PICO language via REPL
  3. Open new untitled document
  4. Set the document language to Parametric Rascal LSP
  5. Any invalid program will generate parse errors in the Problems pane
    • An empty document is an invalid program
  6. Click the "problem" to navigate to the document
  7. A 2nd, blank "Plain Text" untitled document will open.

Expected behavior
Errors found in untitled documents (or other custom URI formats?) can be navigated to and cause red squiggles to appear.

Desktop:

Additional context
This appears to be related to special fallback logic in Locations.java toLoc(String uri) where the untitled:Untitled-1 URI fails with the "Opaque URI" message and is then converted to untitled:///:Untitled-1 (notice there are two colons).

I tried removing the 2nd colon, which I think is a mistake, but it doesn't solve the problem. I also tried using a single / instead of ///. None of these worked - probably because "untitlted:Untitled-1" <> "untitlted:/Untitled-1" within VS Code.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions