Skip to content

Resources linked with "uid://" scheme does not correctly link to the correct files. #840

Open
@anthonyme00

Description

@anthonyme00

Godot version

v4.4.1.stable.official [49a5bc7b6]

VS Code version

1.98.2

Godot Tools VS Code extension version

2.5.1

System information

Windows 11

Issue description

Currently, Godot's LSP does not return the correct file path for uid:// resource scheme when the textDocument/documentLink command is called.

This results in the following error when trying to follow a reference to a uid:// resource.

Image

This also means that the hover preview does not work for uid:// preloads.

Working
Image

Not Working
Image

To fix this, i have created a fork with a proof of concept fix. This currently only works for GDScripts resource type since they have an easily distinguishable accompanying *.uid file, linked below:

https://github.com/godotengine/godot-vscode-plugin/compare/master...anthonyme00:godot-vscode-plugin:uid_script_shortcut?expand=1

With the changes on this fork, hovers over uid:// strings on supported files works as expected (only for GDScript resources). ctrl+clicking uid:// strings also now works as expected.

Image

This fix works by overriding the return from textDocument/documentLink calls and stripping target links that starts with uid://, and instead relying on the internal DocumentLinkProvider implementation instead.

Steps to reproduce

  1. Open any project that contains uid:// resource references
  2. Hover or attempt ctrl+click on those resources
  3. Be greeted with the following error message:
    Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglanguage serverIssue is not originating from this extension, but from the LSP instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions