Cursive 1.7.0

232 views
Skip to first unread message

Cursive

unread,
Jun 4, 2018, 9:15:11 PM6/4/18
to cur...@googlegroups.com

Hi everyone,

Cursive 1.7.0 is out! The main new feature is one that many of you have been waiting for, the new Parinfer integration!

There are two main changes to the integration. The first is that it now implements Parinfer v3, which implements “Smart mode”. One of the issues with Parinfer was always that you had to switch between Paren and Indent modes, and that was confusing for new users. I was convinced that it should be possible to create a hybrid mode, so I never actually exposed paren mode to Cursive users. This made Parinfer quirky in Cursive, and of course I never actually got around to developing a hybrid mode. However Ryan De La Torre and (in particular) Shaun LeBron have done some really amazing work, and Smart mode is now more or less what I always envisioned Parinfer should be. So Cursive continues to have a single Parinfer mode, which is now Smart mode.

Briefly, what Smart mode does is adjust the indentation of forms which begin on the line that you’re editing and continue onto subsequent lines, so that their nesting remains correct. However I’m hopeful that users won’t have to care what Parinfer is doing any more, and it should just do what you would intuitively expect. If that’s not the case, Shaun and I would love to know about it.

The second change is in how Parinfer is integrated into Cursive. One issue with Parinfer has always been that Indent mode requires files to be indented according to its invariants in order to work correctly. In order to ensure this, the Cursive integration (and others) would re-indent files using Paren mode when they were opened, which would make the minimal changes required to ensure that the file could be correctly processed using Indent mode. This often resulted in numerous indentation changes to working code, which was unacceptable to a lot of users in a work environment. Cursive had an additional problem in that it turns out that this cannot be done reliably in IntelliJ (see here for some really gory details if you’re interested). This meant that very occasionally Cursive would not re-indent a file when opened, and then Indent mode would break it.

The new integration no longer tries to do this. Instead, it highlights in the file where it is incorrectly indented, and doesn’t run Parinfer at all until the user has corrected the indentation manually. This means that files will no longer be re-indented just by looking at them, which is a big improvement. However if you do need to edit the file, currently you’ll need to fix the indentation everywhere in the file in order to be able to edit with Parinfer working. I’m going to try to make another improvement which would run Parinfer per top-level form, which would then mean that you would only need to correct the indentation locally in the part of the file you’re actually working on. I had hoped to get that into this release, but it didn’t make it. I’ll add that to a later release.

This release also adds support for new substitutions in the REPL commands. This is actually not documented, but for a while now when entering a REPL command it’s been possible to use ~selection to have the current value of the selection spliced into the command text before it’s sent. #1694 expands the list of substitutions available:

~selection - the current selection
~selected-form - the currently selected form if the selection is a single valid form
~file-name - the name of the current file
~file-path - the full path of the current file
~file-namespace - the namespace of the current file, if any, as a symbol
~form-before-caret - the text of the form immediately before the caret
~top-level-form - the text of the top-level form under the caret
~current-var - the FQN of the current var under the caret
~current-test-var - the FQN of the current var under the caret, if it represents a test
~current-function - the FQN of the current var under the caret, if it represents a function

These allow a much wider range of commands to be created, including some which emulate built-in commands. The commands will only be available when the substitutions they require are valid, for example a REPL command with ~selection in its text will not be available if there is no current selection.

This release also adds support for the new 2018.2 EAP, and removes the anonymous statistics reporting. I added the statistics sending ages ago before I started selling Cursive, with the idea of being able to estimate how many people were actually using it. However I never ended up using the data, so I’ve removed this functionality as part of updating my privacy policy for the GDPR (although the data was totally anonymous).

And, of course, there are lots of bug fixes.

2018.1 has been final for a while now, so in keeping with my policy of actively supporting the last two years’ worth of IntelliJ versions, 1.7.0 will be the last release to receive updates for 2016.1.

Here are the issues:

When creating a new vanilla Clojure project, spec jars are not added #1970
Exception when autocompleting in body of defrecord method #1961
Saving all files when switching to REPL should be configurable #1960
Parinfer does not preserve indentation or mode unclear #1950
Choosing var by name for customising symbol resolution doesn’t allow var FQN #1941
parinfer smartmode #1937
Wrong number of args (0) passed… Error? #1823
Add additional substitutions for REPL commands #1694
Structural editing toggle broke all my code #1669
parinfer mode bug, rearranges parens when it should not #1404
Parinfer error with ignore token reader macro #1327

Cheers,
Colin

Reply all
Reply to author
Forward
0 new messages