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

[Backport 1.6] + added nimsuggest support for exception inlay hints (#23202) #23421

Open
wants to merge 2 commits into
base: version-1-6
Choose a base branch
from

Conversation

nickysn
Copy link
Contributor

@nickysn nickysn commented Mar 18, 2024

This adds nimsuggest support for displaying inlay hints for exceptions. An inlay hint is displayed around function calls, that can raise an exception, which isn't handled in the current subroutine (in other words, exceptions that can propagate back to the caller). On mouse hover on top of the hint, a list of exceptions that could propagate is shown.

The changes, required to support this are already commited to nimlangserver and the VS code extension. The extension and the server allow configuration for whether these new exception hints are enabled (they can be enabled or disabled independently from the type hints), as well as the inlay strings that are inserted before and after the name of the function, around the function call. Potentially, one of these strings can be empty, for example, the user can choose to add an inlay hint only before the name of the function, or only after the name of the function.

(cherry picked from commit 899ba01)

This adds nimsuggest support for displaying inlay hints for exceptions.
An inlay hint is displayed around function calls, that can raise an
exception, which isn't handled in the current subroutine (in other
words, exceptions that can propagate back to the caller). On mouse hover
on top of the hint, a list of exceptions that could propagate is shown.

The changes, required to support this are already commited to
nimlangserver and the VS code extension. The extension and the server
allow configuration for whether these new exception hints are enabled
(they can be enabled or disabled independently from the type hints), as
well as the inlay strings that are inserted before and after the name of
the function, around the function call. Potentially, one of these
strings can be empty, for example, the user can choose to add an inlay
hint only before the name of the function, or only after the name of the
function.

(cherry picked from commit 899ba01)
@nickysn nickysn closed this Mar 18, 2024
@nickysn nickysn reopened this Mar 18, 2024
@Araq
Copy link
Member

Araq commented Mar 19, 2024

Isn't this getting out of hand? Backporting massive new features like this has nothing to do with "semver". Ping @arnetheduck

@arnetheduck
Copy link
Contributor

Isn't this getting out of hand?

depends on how you look at it - the root of the problem here is the distribution model of nimsuggest (and its implementation as a when jungle on top of the compiler) which ties its release cycle to nim itself even though the change has nothing to do with the functionality added in newer nim versions - ie computing exception effects is not a new feature in nim - this PR is merely exposing a language feature that has existed for a long time.

We've not been able to migrate to 2.0 yet because tests still reveal significant problems so 1.6 continues to be the most viable target for production development - backporting here is a way to bring useful tooling improvements to a larger developer base without tying it to the nim bugfix schedule.

@SirOlaf
Copy link
Contributor

SirOlaf commented Mar 25, 2024

#23202 (comment)

Have you not run into this? It makes the feature borderline useless right now. Not something to spread everywhere.

@nickysn nickysn closed this May 16, 2024
@nickysn nickysn reopened this May 16, 2024
@nickysn nickysn closed this May 18, 2024
@nickysn nickysn reopened this May 18, 2024
@nickysn nickysn closed this May 18, 2024
@nickysn nickysn reopened this May 18, 2024
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.

None yet

4 participants