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

[Fixes #3170] Skip ensure of repl available on xref functions #3171

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

ericdallo
Copy link
Contributor

Fixes #3170 adding a extra arg to skip the ensure for xref functions.


Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • All code passes the linter (eldev lint) which is based on elisp-lint and includes
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the user manual (if adding/changing user-visible functionality)

Thanks!

Copy link
Member

@vemv vemv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it would work!

Did you get to try it? (Of course, without any other workaround in place)

@ericdallo ericdallo force-pushed the skip-ensure-on-xref branch from cc6f5d9 to 65bede2 Compare March 24, 2022 01:12
@ericdallo
Copy link
Contributor Author

Yes @vemv, I called that function and it did return nil instead of throwing a error :)

@vemv vemv changed the title [Fixes #3170] Skip ensure of repl avaiable on xref functions [Fixes #3170] Skip ensure of repl available on xref functions Mar 24, 2022
@vemv vemv merged commit 41840db into clojure-emacs:master Mar 24, 2022
@ericdallo ericdallo deleted the skip-ensure-on-xref branch March 24, 2022 01:18
@ericdallo
Copy link
Contributor Author

Thank you!

@vemv
Copy link
Member

vemv commented Mar 24, 2022

🍻!

Feel free to propose bumping the commit in the Doom repo

@ericdallo
Copy link
Contributor Author

that's what I just did! 😄

@vemv
Copy link
Member

vemv commented Mar 24, 2022

Just in case, I meant upstream e.g. doomemacs/doomemacs#6183

@ericdallo
Copy link
Contributor Author

yes, I was talking with Henrik on Doom's discord, he said will bump cider soon with this fix :)

@vemv
Copy link
Member

vemv commented Mar 24, 2022

awesome!

@@ -234,7 +234,7 @@ thing at point."
"Used for xref integration."
;; Check if `cider-nrepl` middleware is loaded. Allows fallback to other xref
;; backends, if cider-nrepl is not loaded.
(when (cider-nrepl-op-supported-p "ns-path")
(when (cider-nrepl-op-supported-p "ns-path" 'skip-ensure)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change had an oversight fixed in 3627780

@bbatsov
Copy link
Member

bbatsov commented Mar 24, 2022

I'm not sure this was the right approach to solving the problem, but you merged it before I saw the PR. Not that big of deal in general, but I was thinking that actually the predicate function should always return t/nil and there would be a cider-ensure-op-supported matching it for the cases where the other behavior is needed.

@bbatsov
Copy link
Member

bbatsov commented Mar 24, 2022

(likely the behavior you're trying to fix is somewhat accidental, given where it's coming from)

@ericdallo
Copy link
Contributor Author

Yeah, I like precicate functions without side-effects, your idea sounds better indeed, but probably will require a little bit more refactor I think

@bbatsov
Copy link
Member

bbatsov commented Mar 24, 2022

We can always simply check if the test suite works fine if we make this the default behavior (suppressing the exception from cider-current-repl). I think this function didn't exists back when cider-nrepl-op-supported-p was written and its introduction altered the API. I assume that code that actually care about getting an exception is using cider-ensure-connected directly.

@vemv
Copy link
Member

vemv commented Mar 24, 2022

I'm not sure this was the right approach to solving the problem, but you merged it before I saw the PR.

Yeah that wasn't ideal, sorry, I guess I wanted to leave it bug-free for Doom/lsp users asap.

Given this 'api' has not been shared as a tagged release, I'd be happy for the solution to be changed if that's better.

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.

Sideeffect checking cider--xref-backend
3 participants