JetBrains / la-clojure

Clojure plugin for IntelliJ IDEA
Apache License 2.0
220 stars 49 forks source link

Introduce Variable Refactoring #64

Closed OsipovStas closed 11 years ago

OsipovStas commented 11 years ago

Support Introduce Variable refactoring for La Clojure plugin.

markmandel commented 11 years ago

This looks cool! Can't wait to try it out!

markmandel commented 11 years ago

I've been testing this out (merged in the entire https://github.com/OsipovStas/la-clojure) - one issue I found:

If I have (in a midje test):

(fact
    "Better constructor works"
    (let [test-user (new-user "Mark" "Mandel" "email" "password")]
        (:id test-user) => truthy
        (:firstname test-user) => "Mark"
        (:lastname test-user) => "Mandel"
        (:password test-user) => "password"
        (:email test-user) => "email"
        (:photo test-user) => nil
        (:last-logged-in test-user) => nil
        )
    )

If put my cursor in the middle of (:password test-user) and tell it to refactor the variable, I get back the following (where foo is the variable name I wrote)

(fact
    "Better constructor works"
    (let [test-user (new-user "Mark" "Mandel" "email" "password")
                foo (:password test-user)]
        nil)
    )

It's not exactly a common refactor, but I thought I would pass it on.

I'll keep testing with it, and see if I can find any more issues. Is here a good place to put them?

I'm liking this a lot though!

OsipovStas commented 11 years ago

Hi, Mark! Thank you for your report. I'll try to figure it out. You can put issues about this refactoring here: Introduce Variable issues For other La Clojure issues please use main issue tracker

markmandel commented 11 years ago

Thanks!

I made an issue. I will let you know if I find any more.