Comments (9)
@dgtized: the latest clj-refactor (3.5.6; will be available within a couple hours) / refactor-nrepl (3.5.5; released) include a draft of the new middleware, namely:
clojure-emacs/refactor-nrepl@8825e26
which you can try like this:
(thread-first "cljr-suggest-libspecs"
(cljr--create-msg "lib-prefix" "s"
"language-context" "cljc"
"preferred-aliases" (prin1-to-string cljr-magic-require-namespaces))
(cljr--call-middleware-sync "suggestions")
parseedn-read-str)
as you can check out in the commit, this draft is merely focused in getting the API right (input and output format). The strings to be produced are subject to (much) improvement. For now we just return essentially the same as the old op namespace-aliases
, with some basic context (language) awareness.
I hope this helps getting the ball rolling.
from clj-refactor.el.
Started working on this, and I have a decent implementation, but went back to add tests and realized the build is broken from your last two commits. Do you mind addressing that?
from clj-refactor.el.
Hi! Excited to hear that.
The build is failing for a random reason, back then I did verify that even re-triggering a build from the latest green commit now would fail.
Obviously it has to be addressed, but you can rest assured that nothing is broken.
from clj-refactor.el.
Unfortunately the pattern used in the tests that are failing is the same one I need to write tests to verify the new behavior. So, while the build may not actually be broken, I'm not sure if I can add tests without this being fixed?
I suspect this is related to jorgenschaefer/emacs-buttercup#222. Specifically because the failing tests are ones that are asserting the return value of a form with a macro, and are failing because the value incorporates the form and not the value. Ie:
(it "returns js for js alias in cljc file."
(expect (cljr--with-clojure-temp-file "foo.cljc"
(insert "(ns foo)")
(cljr--unresolved-alias-ref "js"))
:to-equal "js"))
fails but
(describe "cljr--language-context-at-point"
(it "returns clj in a clj file"
(cljr--with-clojure-temp-file "foo.clj"
(insert "(ns foo)")
(expect (cljr--language-context-at-point)
:to-equal '("clj" nil)))))
passes as a work-around. Anyway, I'll take a look again later.
from clj-refactor.el.
Anyway, I'll take a look again later.
Alright! Will be appreciated, I don't have enough capacity to dive into Elisp stuff these days.
However I can keep refining / actually implementing the new refactor-nrepl middleware upon your feedback.
Merging a PR of yours into clj-refactor.el
isn't a pre-requisite. If that saves you time, you can, for instance, open a Draft PR, even if red, and we refine both frontend and backend using that PR as a starting point.
from clj-refactor.el.
I believe this issue was resolved by #532 and #541. I know there is still work on the nrepl side to improve the new behavior around cljr-slash
, and at some point we need an issue for changing this behavior to be the default and deprecating the old approach, but I don't think there is anything else to do on the elisp side to support this feature?
from clj-refactor.el.
Surely!
I'll eye it again soon.
btw, last Saturday I worked substantially on clojure-emacs/refactor-nrepl#384 and have a few new test cases passing. The plan is to encode all examples (yours and mine) as cases.
New iteration soon, when it's ready I'll cut a release and ping you for code review.
from clj-refactor.el.
Cool, happy to review. I think the remaining issues on clojure-emacs/refactor-nrepl#384 is probably more related to #530 than this issue but happy to hold onto both if you see fit.
I suspect the bulk of the remaining changes in 384 are language-context specific which are discussed in that issue and in 530, but require mostly backend changes to support.
from clj-refactor.el.
Indeed, things are looking great by now.
from clj-refactor.el.
Related Issues (20)
- cljr-clean-ns erroneously removes :as-alias in clj namespaces HOT 1
- Document (or remove) pkg-info dependency HOT 6
- `cljr-sort-project-dependencies` drop :dependencies section when using managed-dependencies HOT 2
- cljr-slash magic require js/ behavior is determined by file type, not language context HOT 2
- cljr--ns-alias-at-point does not handle quasiquote, sharp-quote and dotted aliases HOT 1
- Combine cljs and clj namespace alias candidates for magic requires HOT 15
- Ability to specify context in `cljr-magic-require-namespaces` HOT 4
- `cljr--point-in-reader-conditional-branch-p` may block and is incorrect HOT 1
- Question: how to install `clj-refactor` via `use-package` declaration instead of imperative `package-install`? HOT 2
- Enhancement: trying to install and configure `clj-refactor` with the declarative `use-package` instead of imperative `package-install` HOT 1
- cljr-add-project-dependency throws `java.io.EOFException` HOT 6
- `cljr-rename-symbol` not working properly when narrowing is in effect HOT 2
- cljr-slash breaks whenever there's a Unicode character used as an alias in a codebase HOT 3
- cljr-add-project-dependency document support for deps.edn HOT 1
- Add Emacs 28, 29 to test matrix
- Add `eldev lint` to the CI
- Some refactorings are not working via TRAMP HOT 2
- Add support for updating :sha in :git/url dependencies HOT 3
- Error with suggest_libspecs HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clj-refactor.el.