Visitar URL original
Is it possible to click on the URL shown in the error overlay · Issue #1965 · SublimeLinter/SublimeLinter · GitHub
Skip to content

Is it possible to click on the URL shown in the error overlay #1965

Open

Description

@pierresh

Hello,

I maintain the Sublime Linter plugin for PHPStan. Errors reported by PHPStan include sometimes a URL to the PHPStan documentation related to the error, like in this example

Image

I wonder if it is possible to make such links clickable so that it would be much easier to open them

Thanks

Activity

  1. kaste commented on Jan 31, 2025

    @kaste
    Member

    It is currently not possible in the tooltips. You can right click on such a link in the error/diagnostics panel if I'm not mistaken.

    We had this: #1480 but that never evolved.

    In your example, the url is also part of the message text (which is needed for the right click in the panel) but to parse that from a message and turn it into a link, was not planned. The idea was that linters would yield optionally an url per error, and then we would e.g. make the rule name clickable in the tooltip. Looks like this error here doesn't have a rule name.

    The design looked like:

    Image

  2. pierresh commented on Feb 1, 2025

    @pierresh
    Author

    Thanks a lot for your prompt reply.

    I could extract the URL from the error message if needed and provide it to lint.LintMatch() through a new key.

    PHPStan does have an "error identifier" but so far I do not display it because I think it is a bit long and confusing with the main error message as their colors are the same. If I display it, currently it would look like this:

    Image

    As a suggestion, I believe such info/click would be better beside the copy button.

  3. kaste commented on Feb 2, 2025

    @kaste
    Member

    Yes, the look of the popup changed since then. E.g.

    Image

    However, we can have multiple errors which looks like this:

    Image

    In such a case, "Copy" really copies the whole textual content of the popup. E.g.

    codespell: warning
    annnotations ==> annotations
    
    ruff: error
    F407 - Future feature `annnotations` is not defined
    
    ruff-lsp: warning
    F407 - Future feature `annnotations` is not defined
    

    If we had urls, we still had them per error I guess. I may still think that just underlining the rule name to indicate that it is clickable, is the design I like most. I still don't like the link symbol. At least neither this:

    Image

    Nor this:

    Image

    is very convincing. (Don't know why the link UTF symbol is grey and not blue.) I don't like the light bulb in your picture as well. It is too big and, I think, should be in text color, t.i. monochrome.

    So a) it is still a design problem, and then b) we would still need to extend LintMatch but that might be rather trivial.

    PS: IMO you should extract and provide the error code (aka rule name) as that drives other features of SublimeLinter. Namely, users can apply different styles per rule.

  4. pierresh commented on Feb 2, 2025

    @pierresh
    Author

    The 💡 is actually from the output of PHPStan in CLI :) The output has two parts: error_message, and tips (which begins with 💡 in CLI but strangely not in JSON output, so I reproduce the same behavior). I concatenate both with "\n".

    My point was that the URL could be clicked at the bottom of the overlay (for Sublime Linter, there is already the copy button) similar to this:
    Image

    Also, I suggest not having a strong bond between the error code and the URL, but rather letting the plugin populate the URLs in its code.

    In my example, I could have 2 links actually:

    I might extract the first one from the error message, and build the second one thanks to the error code/identifier.
    The name of the button would be dynamic, so that it could be used to display some info, ie. the error code.

    yield lint.LintMatch(
        ...,
        urls: [
            {
                "title": "Tips",
                "url": extracted_url
            },
            {
                "title": "Error " + error['identifier'],
                "url": "https://phpstan.org/error-identifiers/" + error['identifier']
            }
        ]
    )
  5. kaste commented on Feb 3, 2025

    @kaste
    Member

    It is just that Sublime renders the emojis (💡) strange. They tend to be too
    big and with odd spacing.

    These popups show multiple errors. Right now, the Copy link in the footer
    addresses all shown errors. (It is one link for all errors as shown above.)

    • We would need examples of linters, but typically there is a link which
      explains the rule. That's where the linkage between url and error code comes
      from. (And you have it too in your example.)

    • Now, although such links are then part of an error description, these tend to
      be boring and repetitive. They (usually) explain the linter rules or in general
      how the linter configuration works (e.g. for missing imports, how to tell the
      linter where third party library can be found). With that in mind, they often
      are not part of this concrete instance of an error, but more of the linter
      documentation and help system.

      Maybe there is no need to show these urls very prominently. For one error,
      we could say "Explain F407", in the footer. For multiple errors, we likely
      run out of space, and maybe need to aggregate.

      If we say, these are actually just documentation, we maybe need to think
      around the corners. Like: a "?" annotation on the right side of the view,
      which expands to links on hover.

      We also now only talk about the tooltip, which is by its nature -- how Sublime
      handles them -- more a second class feature. E.g. you can't select text they
      show, there is no right click (AFAIK)... Do we need to change the error panel
      as well?

    • In case of "urls", you propose the underlying data structure to be a map
      (title) => url. Basically this reflects that urls are unreadable and long,
      so we need shorter names ("titles") for them.

      However, we could just have urls in the error message, parse for them and make
      them clickable. Or -- title to url is just like markdown -- allow links in the
      form [title](url) within the message. Parse for them, and transform them
      to clickable links.

      (The latter is likely hard to solve, because we need to compute the layout, the word
      wrapping, in Python, and that is way harder if the content contains markup code.)

  6. ratijas commented on Jun 18, 2026

    @ratijas

    I'm wondering the same, i.e. how to render a URL, or at least select text and copy URL manually in a Sublime Linter popup.

    I made a simple plugin which runs Clazy (Clang based Qt-specific C++ analyzer), and I wanted to show the -Wclazy-something warnings as links to their README.

    So far it sort of works: developer can select and copy the URL from the Ctrl+K, A panel. But the popup looks rather barebones, and without markup support I don't see any way to customize it.

    Image

    Note that I added "Doc: <url>" manually via string replacement.

    I can't even get the popup to be wider or force horizontal scrolling. This gets unreadable pretty fast:

    Image

    It's not even ^~~~ pointing at the right thing anymore

  7. kaste commented on Jun 18, 2026

    @kaste
    Member

    I can't even get the popup to be wider or force horizontal scrolling.

    What does that mean? You tried to solve this but couldn't get Sublime to show scrollbars?
    We likely handle the available width in both, the error panel (K,A) and the tooltip, and auto wrap. Maybe we're doing this smarter in the panel? What was your experience here?

  8. ratijas commented on Jun 18, 2026

    @ratijas

    The Ctrl+K, A panel is kinda fine. It can scroll horizontally, and in fact pointlessly does so -- only by a few pixels only, without any visible need for it. Maybe it generates a bit too many whitespaces to right-align those orange "warning" labels?

    SublimeLinter-panel-needless-horizontal-scroll.mp4

    But I was talking about the in-editor popup. I couldn't find a way to change its size or to make it scrollable.

    Personally I've never used panels much (except maybe in IntelliJ IDEs); but I'd love to have some nice in-editor stuff right where my cursor is. Maybe it's a matter of habits, or the fact that panels in ST lack discoverability and feel a bit too magic. Either that, or my skill issue (:

  9. kaste commented on Jun 19, 2026

    @kaste
    Member

    I couldn't find a way to change its size or to make it scrollable.

    If we format the output to match the popup size (like we do obviously in the panel), then there are no scroll bars. I think Sublime Text can show scrollbar in such popups, it is that we decided against it and reformat the text to fit. That is how I remember it.

    I don't think you can do anything with popups just as a user. You can't select text or resize a popup just with your mouse. Everything has to be implemented on the plugin side.

  10. ratijas commented on Jun 19, 2026

    @ratijas

    I think Sublime Text can show scrollbar in such popups

    It that even true? I can't recall those popups ever having scrollable areas.

    it is that we decided against it and reformat the text to fit. That is how I remember it.

    ughh, I'm confused? AFAICT nobody's reformatting the text, except for the (table-like?) leading indentation. I didn't look into SublimeLinter's internals though.

    I don't think you can do anything with popups just as a user

    oh well ¯\_(ツ)_/¯

  11. kaste commented on Jun 20, 2026

    @kaste
    Member

    ughh, I'm confused? AFAICT nobody's reformatting the text

    He? Simple search reveals,

    tooltip_message, quick_actions = join_msgs(errors, show_count=line_report, width=80, pt=point)
    that function takes a width=80, and then uses that

                    textwrap.wrap(
                        msg_line,
                        width=width,
    ...
    

    in some way.

    The 80(chars) is hard-coded but below we allow a max-width of 1000(px). Not entirely sure if that matches. Typical code is usually max_chars=(viewport_width / em_width) - MAGIC_NUMBER.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions