Skip to content

Conversation

@vemv
Copy link
Member

@vemv vemv commented Jul 23, 2023

Fixes #30

The introduced logic is as follows:

  • If the 'operand' of a (-> ) (i.e. its first member) does not match js/* or js/*, then evaluation (side-effects) will shortcircuited.
  • For (. ,,,), (.. ,,,), (doto ,,,), evaluation will never be shortcircuited, because those macros are interop-oriented.

It's not perfect, but it seems to find a balance between shortcircuiting most pure clojurescript forms, and allow JS completions to still work for many cases.

In a future, logic may be refined by leveraging the cljs analyzer - we already do in cider-nrepl so it should be at hand.

Cheers - V

@vemv vemv requested review from bbatsov and rksm July 23, 2023 21:31
@bbatsov
Copy link
Member

bbatsov commented Jul 24, 2023

I'm fine with the changes, but they'll have to be reflected in the README, so the users don't have a hard time trying to figure out how the completion works.

@vemv
Copy link
Member Author

vemv commented Jul 24, 2023

Thanks!

The readme already happened to say:

This only applies to JavaSript interop code, i.e. JavaScript methods and properties. Pure ClojureScript is not inspected or evaluated.

@bbatsov
Copy link
Member

bbatsov commented Jul 24, 2023

I still think some more examples there won't hurt (e.g. here https://github.com/clojure-emacs/clj-suitable/#how-does-it-work), but I'll leave this up to you to decide if they are needed or not.

@vemv vemv force-pushed the 30--side-effects branch from df95932 to ea4a0d1 Compare July 24, 2023 08:31
@vemv
Copy link
Member Author

vemv commented Jul 24, 2023

Readme expanded - thanks!

@vemv vemv merged commit 45b754f into master Jul 24, 2023
@vemv vemv deleted the 30--side-effects branch July 24, 2023 08:39
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.

Suitable is running side-effects in -> chains for pure ClojureScript (non-interop)

3 participants