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

Fix URI format for res scheme #2432

Merged
merged 2 commits into from
Mar 16, 2024
Merged

Fix URI format for res scheme #2432

merged 2 commits into from
Mar 16, 2024

Conversation

jwortmann
Copy link
Member

@jwortmann jwortmann commented Mar 15, 2024

With a recent Pyright version, some features don't work (i.e. error in console or error dialog) for package ressource files (View Package File from the command palette).

This is because we use Packages as the authority name in res: URIs, and the authority is converted to lowercase by vscode-uri library in the server responses. Instead, we should move Packages to be part of the path component of the URI and leave authority empty.

See: microsoft/pyright#7495


The only case where I can find res:// being used in the Sublime Text API is in minihtml for the <img> element, see https://www.sublimetext.com/docs/minihtml.html#tags:

<img> — supports PNG, JPG and GIF images from file://, res:// and data: URLs.

For example with Terminus installed (as .sublime-package from Package Control), try in the console:

  • works:
    view.show_popup('<img src="res://Packages/Terminus/images/link.png"/>')
  • doesn't work:
    view.show_popup('<img src="res:/Packages/Terminus/images/link.png"/>')

But I consider this a bug or bad design in ST, they also should better support/use a single slash in res URIs.

Edit: The builtin run_macro_file command also supports res:// URIs for its command argument.

@rwols rwols merged commit d4538fa into sublimelsp:main Mar 16, 2024
8 checks passed
@jwortmann jwortmann deleted the res-uri branch March 16, 2024 10:40
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