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

Allow inspecting a class that is used as a ^TypeTag #3679

Open
alexander-yakushev opened this issue May 24, 2024 · 5 comments
Open

Allow inspecting a class that is used as a ^TypeTag #3679

alexander-yakushev opened this issue May 24, 2024 · 5 comments

Comments

@alexander-yakushev
Copy link
Member

Quite often I want to inspect a class that is written with ^ in the source file. To inspect it with the regular inspect-last-expr, I have to remove the ^ first. I noticed that C-c C-d C-d handles type tags fine. Can we have something like that for the inspector too?

This can be handled on the orchard.inspect side but I don't think it's the best place to do that.

@vemv
Copy link
Member

vemv commented May 24, 2024

Interesting

What's the current behavior if you don't manually remove ^?

What's C-c C-d C-d?

@alexander-yakushev
Copy link
Member Author

C-c C-d C-d is cider-doc. The current behavior for cider-inspect is to read and inspect the next form after the type tag

@vemv
Copy link
Member

vemv commented May 24, 2024

I'd say that this would be a harmless/DWIM 'breaking' change to do - I'd fail to imagine people intentionally hovering over T in ^T x and expecting the inspector to go over x.

Most likely it's a byproduct of whatever the original impl was

@alexander-yakushev
Copy link
Member Author

I also think so.Most of the code type hints local variables anyway which can't be inspected.

@alexander-yakushev
Copy link
Member Author

alexander-yakushev commented Jun 2, 2024

I've fixed this for myself using this hack:

(defun cider-inspect-last-sexp ()
  (interactive)
  (if-let (type-tag (cider-symbol-at-point))
    (cider-inspect-expr type-tag (cider-current-ns))
    (cider-inspect-expr (cider-last-sexp) (cider-current-ns))))

I check if (cider-symbol-at-point) returns something meaningful. If so, I inspect that, otherwise I inspect (cider-last-sexp). cider-symbol-at-point is what cider-doc uses to strip ^ symbol from the classname.

But I'm not so sure if I'm comfortable pushing this to other people, and I don't know all implications yet.

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

No branches or pull requests

2 participants