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

Form selection fails on things like '(1) #418

Closed
PEZ opened this issue Oct 20, 2019 · 0 comments
Closed

Form selection fails on things like '(1) #418

PEZ opened this issue Oct 20, 2019 · 0 comments
Labels
bug Something isn't working evaluation

Comments

@PEZ
Copy link
Collaborator

PEZ commented Oct 20, 2019

So, this is an old quirk, that I don't think have been reported yet. Calva's methods for selecting the current form, and the top level form, do not account for syntax with characters in front of lists and maps (and vectors, even if that is less problematic, I think).

Some examples are '(:foo), @foo, #?(:cljs :foo :clj :bar), #{:foo :foo}

The user should be able to place the cursor adjacent to these forms to be able to evaluate them with a command. And if they are top level forms, the cursors could be placed anywhere adjacent, or inside them, for the top level eval command to work as well. Instead:

(comment
  '(1)|
   ;; => Execution error (ClassCastException) at nrepl-pprint-datomic.core/eval9432 (form-init7429449344366744362.clj:12).
   ;;    class java.lang.Long cannot be cast to class clojure.lang.IFn (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IFn is in unnamed module of loader 'app')

  '|(1)
   ;; => Execution error (ClassCastException) at nrepl-pprint-datomic.core/eval9440 (form-init7429449344366744362.clj:16).
   ;;    class java.lang.Long cannot be cast to class clojure.lang.IFn (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IFn is in unnamed module of loader 'app')

  |'(1)
  ;; => Syntax error reading source at (REPL:20:1).
  ;;    EOF while reading

  @foo|
   ;; => Syntax error compiling at (core.cljc:1:8100).
   ;;    Unable to resolve symbol: foo in this context

  |@foo
  ;; => Syntax error reading source at (REPL:28:1).
  ;;    EOF while reading

  #?(:cljs :foo :clj :bar)|
    ;; => Execution error (IllegalArgumentException) at nrepl-pprint-datomic.core/eval7999 (form-init7514181033060422158.clj:32).
    ;;    Wrong number of args passed to keyword: :cljs

  |#?(:cljs :foo :clj :bar)
  ;; => Syntax error reading source at (REPL:36:1).
  ;;    EOF while reading character

  #{:foo :foo}|
   ;; => {:foo :foo}

  |#{:foo :foo}
  ;; => Syntax error reading source at (REPL:43:1).
  ;;    EOF while reading character
)

(| marks the cursor position).

Top level evals all behave like the examples with the cursor adjacent to the right of the forms.

PEZ added a commit that referenced this issue Oct 20, 2019
@PEZ PEZ added bug Something isn't working evaluation labels Oct 20, 2019
@PEZ PEZ closed this as completed in 199e15b Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working evaluation
Projects
None yet
Development

No branches or pull requests

1 participant