Fork me on GitHub
#spacemacs
<
2019-12-27
>
practicalli_john15:12:32

Pull request now merged

drewverlee16:12:22

Maybe the right idea is to not alias namespaces or use :refer as i find the clojure(script) tooling ecosystem often fails to be able to create an explorable link for you. E.g There doesn't seem a reliable way to find usages for a function so i end up doing text based searches. If thats the case, maybe it would be better to have the tooling auto shorten the names and always use the full namespace.

practicalli_john21:12:25

did you post this to the right channel? sounds interesting, but seems to be responding to something that is not present here 🙂

drewverlee21:12:39

Your right, im not responding to anything. I was just pointing an idea out there. I meant to post it here. The core issue is that i haven't found a consitant way to progmattical navigate clojure(script) projects. Whats the command to show all the places a function gets used in an arbitrary clojure(script) project? I have worked with 3 teams so far and not seen a solution nor heard of one talked about. Oh sure, lots of half solutions: grep, clj-refactor, etc.. But they all have cavets. In the end, I spend a lot of manual time on these issues.

drewverlee21:12:31

Our code is data, but not data we seem to be able to query effectively.

drewverlee21:12:39

happy to be proven wrong on this one!

practicalli_john23:12:09

I am assuming you want all the locations to refactor the name of a function, as you mentioned refactor. I use helm and iedit for this when it's across the whole project. Start with a project search, SPC / and use C-c C-e in the helm results to edit the results in another buffer. Then you can use iedit or multiple cursors to create simultaneous edits. When done editing, then C-c C-c saves all changes across the project. If just changing within a namespace, I hide helm-swoop SPC s s and C-c C-e to edit the swoop results

practicalli_john23:12:43

I don't really understand what is meant by doing this programmatically.

didibus07:12:08

Do you mean specifically for ClojureScript?

didibus07:12:22

Cause clj-refactor works for me in Clojure

drewverlee01:01:24

I do mean specifically clojurescript. But I feel I have run up against times when clj refactor doesn't work in clj.

didibus01:01:26

You just have to make sure that your code compiles properly before using clj-refactor

didibus01:01:33

To make the refactor

drewverlee04:01:15

I don't feel that's what I have experienced. I feel I have tried to use it and in multiple cases it has errored out on code that complies. But it's lazy of me to say that without providing examples.

practicalli_john15:01:30

Since learning how to use the built in tools that Spacemacs provides my use of clj-refactor has plummeted. In fact I just removed it several months ago and haven't missed it at all. I think cycling parens was the last thing I used, then I realised I could just do it in Evil with the same number of keys. If using Holy mode with Spacemacs, then I assume there is a some small benefit to clj-refactor.

didibus19:01:06

You can use all the same commands from Holy.

didibus19:01:53

But Emacs commands aren't as language aware as a code analyzing refactoring tool.

didibus19:01:10

Though I'd have to agree that clj-refactor isn't that great, and I too end up just using good old project search and replace most of the time. Just faster, plus it let's me find comments and documentation as well and rename those too

practicalli_john19:01:57

@U0K064KQV I am aware that you can access all commands in Holy Mode, but I don't believe you can use Vim style editing in Holy Mode. That was what I was referred too when I said Evil replaced many Clojure specific refactoring for me. Sorry for the confusion. For example s c ( [ to change a list to a vector. Yes, things like helm-ag, iedit, buffer narrowing are ubiquitous for Holy and Evil. I use them and Vim style editing and clever-parens and a little bit of lisp state for the majority of my workflow. Combined, these tools allow me to use the same set of keybindings across multiple languages, lowering my cognitive load for using Emacs (the main reason I move from Holy to Evil) The only thing that actually analyses my Clojure code, I think, is clj-kondo and the REPL of course :)

drewverlee14:01:18

This is an example of the type programatic solution that I don't think it's reachable with text. https://github.com/borkdude/carve

drewverlee16:12:13

so instead of (:require [some.app.foo :as foo]) just use some.app.foo/function and have the editor shorten based on a universal preference... say the last two dots.