JetBrains / la-clojure

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

Partial fix for CLJ-198 - Auto-import in the REPL inserts broken code #54

Closed cjkent closed 10 years ago

cjkent commented 11 years ago

I'm not sure if this is the right approach but it fixes the problem in the REPL and doesn't seem to break auto-imports in regular files. There are some problems or things I'm unsure about:

donnerpeter commented 11 years ago

isPhysical is certainly not the right method to determine if it's REPL. There might be quite many non-physical files created for different purposes. I'd suggest to create a special user data Key and put it either to the Document created for REPL, and then check if it's present. Maybe wrap with some more beautifully-looking static isReplFile() method.

What do you mean by "kept breaking the document"?

And what do you mean by the current namespace in REPL? Do you mean the one defined in previous evaluations? Then maybe it's easier to just track it on the side of the REPL, analysing the PSI as soon as it's being sent to the evaluation and remembering it somewhere.

Alefas commented 10 years ago

I left the link in CLJ-198 issue to this pull request, so when we will start to fix this issue, we will take a look here. Or you have fix it earlier by another pull request (we can't merge this pull request, because it's not complete yet).