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

Warn about missing scheme in the uri #2530

Closed
wants to merge 1 commit into from
Closed

Conversation

ryuukk
Copy link
Contributor

@ryuukk ryuukk commented Oct 15, 2024

More context: #2527

@jwortmann
Copy link
Member

Sorry but I would say we don't really need this print statement. With the latest update we already print to the console, but only if debug logging is enabled:

msg = f"Unable to open URI {uri}"
debug(msg)

Also the "perhaps the scheme is missing?" is so generic that it isn't useful; it could also be that perhaps the file doesn't exist, or whatever...

And since a missing URI scheme is a bug in the language server, I'm unsure whether it's really necessary to handle it here. If so, I would say that it should be a proper implementation where parse_uri would raise a

LSP/plugin/core/views.py

Lines 84 to 89 in a6b17a4

class InvalidUriSchemeException(Exception):
def __init__(self, uri: str) -> None:
self.uri = uri
def __str__(self) -> str:
return f"invalid URI scheme: {self.uri}"

and then it should catch this exception for example in

LSP/plugin/hover.py

Lines 369 to 370 in a6b17a4

elif parse_uri(href)[0].lower() in ("", "http", "https"):
open_in_browser(href)

(and it would need to be checked if there are other places in the code where it must be handled too)

@ryuukk
Copy link
Contributor Author

ryuukk commented Oct 18, 2024

I understand you don't want to improve anything

Therefore, you are right, you don't need this helpful error message, since you don't understand the context

I'm closing this

@ryuukk ryuukk closed this Oct 18, 2024
@ryuukk
Copy link
Contributor Author

ryuukk commented Oct 18, 2024

You have to do better than the competition if you want to attract people

Just sayin

@predragnikolic
Copy link
Member

@ryuukk's your response to constructive criticism was defensive. @jwortmann offered thoughtful feedback, suggesting a more scalable and structured way of handling URI errors. Instead of engaging in a productive discussion, it looks like you seemed to take it personally, as reflected in comments like, "you don't need this helpful error message, since you don't understand the context."

It seems like you are misinterpreting @jwortmann’s feedback. This statement in my eyes is not true "I understand you don't want to improve anything". This might be a misreading of the situation. The feedback was more about proposing a more systematic solution rather than rejecting the idea of improving the error handling.

Rather than assuming that the feedback is dismissive, it is helpful to assume positive intent and engage in a constructive discussion. Asking for clarification or further discussing why a specific improvement was suggested could have fostered a better conversation.

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.

3 participants