-
Notifications
You must be signed in to change notification settings - Fork 184
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
Attempt to open file as fallback for URIs without scheme #2527
Conversation
This function takes a When does this error happen? For example for links in a hover popup there is a fallback to open it in a browser if the link doesn't have a scheme: Lines 369 to 372 in d71e11a
|
it happens when {'uri': '/run/media/ryuukk/E0C0C01FC0BFFA3C/dev/kdom/better_d/rt/time.d', 'range': {'start': {'line': 149, 'character': 16}, 'end': {'line': 149, 'character': 16}}} i have fixed my server since then, but i still believe either a fallback or a proper message is better than returning None and giving a generic error message |
The URI spec says the following:
Ref: https://datatracker.ietf.org/doc/html/rfc3986#section-3.1 That said, this PR introduces a behavior that is not spec
When I saw the issue, I immediately knew that the error was due to a wrong document URI, I deduced that by the generic error message. So I'm fine withe the error message. if you have a suggestion on how the error message could be improved, do tell. |
Well, if URI is not empty, and scheme is required and missing, the error message should be:
I have wasted valuable time wondering what was wrong |
True, the error message could can be improved. That would require a few regexes to be written. Not sure if the effort is worth the gain. You could save time if you use AI, just to see different pints of views, if you are not sure what the error is. ChatGPT spotted the issue, with the error message description that you provided. ChatGPT:
By addressing these areas, you should be able to identify why the file cannot be opened. |
Feel free to submit a PR that improves the error message. But note that there is an infinite amount of non-compliant cases (not only for this case but in general) that the server could trigger and it's not very reasonable to expect that the client will handle every one of those in a way that provides detailed and very relevant response. |
I kept getting
error: Unable to open URI
, i didn't know whyTurns out the plugin requires the path to have a scheme
file://
I think it's fine to still try to open it as a fallback