Fork me on GitHub
#cursive
<
2018-06-21
>
danielcompton00:06:22

Is there a way to make Cursive not fully open a file when you are just browsing files?

danielcompton00:06:48

In VS Code, Atom, and Sublime (probably others too), clicking on a file doesn't fully open it, it opens it in a tab but with an italicised filename

danielcompton00:06:00

If you edit the file then the file is 'fully opened'

danielcompton00:06:16

But if you click on a different file, then that file is closed and replaced with the new file

danielcompton00:06:29

It means that if you're scanning through a bunch of files, you don't end up with tons of editor tabs

cfleming00:06:31

@danielcompton Not that I know of, no

cfleming00:06:42

But I don’t actually use tabs myself

danielcompton00:06:50

Do you just hide the tab bar?

justinlee00:06:19

yea i miss that feature almost as much as Cmd-D

danielcompton00:06:34

What does Cmd-D do?

justinlee00:06:39

it’s the multi-select feature of atom

danielcompton00:06:30

IntelliJ can do multi-select with the mouse?

danielcompton00:06:32

Or is that different

danielcompton00:06:42

Option + Click/drag

justinlee00:06:11

if you do Cmd-F in intellij and then click on “Select All Occurences” that’s basically what it does, except that it is iterative. each time you hit Cmd-D in atom/sublime/vscode it selects one more instance

justinlee00:06:21

and it opens up multiple cursors

justinlee00:06:00

hitting it once selects the word under the current cursor. and it’s purely text based, so it can help you fix strings and whatnot.

manutter5101:06:34

IntelliJ has "Edit->Find->Add Selection for Next Occurrence" (which I have mapped to ^G), works the same as Cmd-D in Sublime.

justinlee02:06:24

hot damn!! Thanks! who on earth named that command lol

justinlee00:06:52

@cfleming slightly off-topic question: i somehow stumbled upon your talk about using parsers in macros and then i watched two other talks about the same topic instead of working. but now i’m curious: did this work go anywhere? i was looking around for libraries but couldn’t find any. it seems like such a great idea.

cfleming00:06:24

@lee.justin.m Yeah, Cursive uses it internally

cfleming00:06:16

I never got around to exposing the error marking in the editor, since it seemed after my talk like there might have been a solution coming in core. But I’m now planning once more to do that.

cfleming00:06:59

I actually re-implemented the parser recently, it’s way faster and has some other nice features like the ability to mark multiple errors in a single form.

justinlee00:06:13

I remember reading in one of the complain-o-ramas somewhere something like “all we wanted were better error messages in macros and instead we got spec”

cfleming00:06:29

Certainly it was all I wanted.

justinlee00:06:12

cool. well I certainly wouldn’t expect you to necessarily be releasing something that is important for your livelihood, but I thought I would ask to see where all that went.

cfleming00:06:10

I did open source part of it, but it wasn’t very useful since it was in an experimental stage, and I now consider that approach a failed experiment: https://github.com/cursive-ide/error-test

cfleming00:06:21

That was basically what I demoed in my talk.

cfleming00:06:30

My new parser uses regexps rather than PEGs, so the semantics match spec’s better. But I don’t use the derivative parsing technique that spec does, I use a VM approach similar to https://github.com/cgrand/seqexp

justinlee00:06:01

that’s very interesting. i would have thought the PEG approach would have been much more robust

cfleming00:06:56

Interestingly, it’s way faster than spec, 7-14x in the tests I did: https://gist.github.com/cursive-ide/d7e490bd875d575ff485518195aa1e19

cfleming00:06:15

(which aren’t very comprehensive, just parsing some big ns forms)

cfleming00:06:39

Well, Clojure forms are pretty simple.

cfleming00:06:18

And since presumably macros will be developed using spec at some point, they’re likely to match those semantics well.

cfleming00:06:38

That whole series of Russ Cox articles are awesome, BTW - well worth your time.

cfleming00:06:48

The main blocker on actually integrating the new work is that I’m going to have to fix up all the extensions I have currently to make them robust to partial parses. Currently the parser either parses the whole form, or fails, so the extensions can rely on all the data being there when they get called. With partial parses that’s not true, so it will be an NPE city until I fix them up using generative testing.

cfleming00:06:23

But once that works, it will allow things like context-specific completions even when the form has errors, which will be awesome.

justinlee00:06:47

well thanks. a lot to chew here.

cfleming00:06:29

No worries, let me know if you have more questions.

danm09:06:53

@cfleming It's really handy in Cursive how some forms (e.g (testing "...." don't follow the normal pattern of indenting args at the same level, so the actual test itself is only indented 2 chars instead of in line with the description string. Is that extensible in any way?

danm09:06:03

We've written a (with-mocks [......] (do stuff macro and at the moment Cursive auto-indents it as

(with-mocks [...
             ...]
            (do stuff))
whereas we'd prefer it to be treated like defn or whatever and be
(with-mocks [...
             ...]
  (do stuff))

cfleming10:06:09

@carr0t Check out the doc here: https://cursive-ide.com/userguide/formatting.html#customisation. You can achieve the effect you want by configuring the indentation setting to 1.

cfleming10:06:03

It’s not explained in the doc (I need to do that) but 1 is the number of forms which are considered special and aligned (usually parameters) before the body forms start, which are just indented two spaces

cfleming10:06:36

In your case, the vector is the parameter, and the (do stuff) part is where the body starts.

cfleming10:06:17

It’s also not shown in the doc since it went in fairly recently, but if you want to share that customisation with all your team members, you can go to Settings-&gt;Editor-&gt;Code Style-&gt;Clojure, and set the Scheme to “Project”. That will mean that your indentation customisations will be stored in the project files and can be checked in and shared.

danm10:06:30

Cool, ta