godotengine / godotengine/godot-vscode-plugin

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

Open
#840 11 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.1k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

### 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](https://github.com/user-attachments/assets/f60e0e6b-6010-4e3a-8637-d12d0afdb020)

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

**Working**
![Image](https://github.com/user-attachments/assets/ed6f591d-a8f7-4846-8bf9-0ab01dbc923c)

**Not Working**
![Image](https://github.com/user-attachments/assets/b1965df8-d63c-47a0-9a3e-02b40f614285)

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](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+click`ing `uid://` strings also now works as expected.

![Image](https://github.com/user-attachments/assets/c1a552e2-a0cf-432e-a26a-05c735983863)

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](https://github.com/user-attachments/assets/18146ee6-94d5-43bf-abfb-0ca0e8f47492)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.