-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite indentation code #31
base: master
Are you sure you want to change the base?
Commits on Apr 21, 2023
-
Begin rewrite of indentation code
The objectives are: 1. Simplify the indentation code; previous implementation has become so complex it is impossible to maintain, 2. Significantly improve performance; previous indentation code was painfully slow, (see issue #6) 3. Maximum configurability; should be configured similarly to cljfmt and make previously impossible things possible (e.g. issue #21). As of this commit, objectives 1 and 2 have been met, but work on objective 3 has not yet begun. There will continue to be further improvements, particularly around performance and the "what if syntax highlighting is disabled?" scenario. These changes will unfortunately be backwards incompatible, but hopefully the improved performance and API will make up for it.
Configuration menu - View commit details
-
Copy full SHA for 7d6bdd7 - Browse repository at this point
Copy the full SHA 7d6bdd7View commit details -
Double (or better) indent performance!
By utilising some ugly mutable state, this change more than doubles the performance of the indentation code. You can expect even further benefits in larger code blocks. This should completely eliminate any need for the `clojure_maxlines` configuration option.
Configuration menu - View commit details
-
Copy full SHA for 5706ea3 - Browse repository at this point
Copy the full SHA 5706ea3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f083ff - Browse repository at this point
Copy the full SHA 5f083ffView commit details -
Check for maps before vectors for further performance enhancement
Since maps are far more likely to across multiple lines than vectors (and when they are they tend to be much larger, e.g. EDN files!), we can further optimise indentation by checking if the line is inside a map *before* checking it is inside a vector. (This happens because of the performance improvement made with the addition of the optimised `CheckPair` function.)
Configuration menu - View commit details
-
Copy full SHA for f4e0689 - Browse repository at this point
Copy the full SHA f4e0689View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2627e1c - Browse repository at this point
Copy the full SHA 2627e1cView commit details
Commits on Apr 26, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 4a3cab7 - Browse repository at this point
Copy the full SHA 4a3cab7View commit details
Commits on Apr 27, 2023
-
Configuration menu - View commit details
-
Copy full SHA for d1ec02c - Browse repository at this point
Copy the full SHA d1ec02cView commit details -
Mimic multi-line string/regex indent behaviour of VS Code and Emacs
The `=` operator will no longer alter the indent of lines within a Clojure multi-line string or regular expression. The previous behaviour was annoying for writing detailed doc-strings, as it made reformatting the file with `gg=G` not possible as it would screw up the indentation within the doc-strings. Now the behaviour matches that of VS Code and Emacs.
Configuration menu - View commit details
-
Copy full SHA for c3047be - Browse repository at this point
Copy the full SHA c3047beView commit details -
When
clojure_align_multiline_strings
is-1
, no indentationBy setting the `clojure_align_multiline_strings` option to `-1` it will switch to traditional Lisp multi-line string indentation, of no indent.
Configuration menu - View commit details
-
Copy full SHA for eb0463e - Browse repository at this point
Copy the full SHA eb0463eView commit details -
Configuration menu - View commit details
-
Copy full SHA for d69008f - Browse repository at this point
Copy the full SHA d69008fView commit details -
Configuration menu - View commit details
-
Copy full SHA for d73e408 - Browse repository at this point
Copy the full SHA d73e408View commit details -
Configuration menu - View commit details
-
Copy full SHA for d177b3b - Browse repository at this point
Copy the full SHA d177b3bView commit details
Commits on Apr 28, 2023
-
Fix false positive multi-line string detection
Sometimes it seems that when `=`ing over a block, Vim will sometimes not re-highlight strings correctly until we have already ran `searchpairpos`. In this case, we implement a hacky workaround which detects the false-positive and recovers from it.
Configuration menu - View commit details
-
Copy full SHA for 51e6a43 - Browse repository at this point
Copy the full SHA 51e6a43View commit details -
Configuration menu - View commit details
-
Copy full SHA for e573da7 - Browse repository at this point
Copy the full SHA e573da7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 242dc9d - Browse repository at this point
Copy the full SHA 242dc9dView commit details -
Initial work on list indentation
Still lots to do here, this is just the initial work.
Configuration menu - View commit details
-
Copy full SHA for 342f35f - Browse repository at this point
Copy the full SHA 342f35fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 51f5dcb - Browse repository at this point
Copy the full SHA 51f5dcbView commit details
Commits on Apr 30, 2023
-
Start of a small Clojure reader for indentation w/o syntax highlighting
Not complete yet, but getting there.
Configuration menu - View commit details
-
Copy full SHA for cc9cda7 - Browse repository at this point
Copy the full SHA cc9cda7View commit details
Commits on May 1, 2023
-
Completed the mini Clojure reader as the core of the indentation system
Some refactoring should be possible here and further optimisations. Once all optimisations I can think of have been implemented, I'll try writing an alternate Vim9 script version. (The syntax highlight group checks used in previous implementations of the indentation code was the core bottleneck, so a Vim9 script version would not have been much faster.)
Configuration menu - View commit details
-
Copy full SHA for ee2acc2 - Browse repository at this point
Copy the full SHA ee2acc2View commit details -
Reader indent algorithm perf has surpassed the prev syntax highlight one
The performance of the new reader-like indentation algorithm has now surpassed the performance of my previous syntax highlighting approach with better accuracy and no hacky code required.
Configuration menu - View commit details
-
Copy full SHA for bdbc281 - Browse repository at this point
Copy the full SHA bdbc281View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ee73c5 - Browse repository at this point
Copy the full SHA 8ee73c5View commit details
Commits on May 29, 2023
-
Configuration menu - View commit details
-
Copy full SHA for a4beb52 - Browse repository at this point
Copy the full SHA a4beb52View commit details
Commits on Jun 10, 2023
-
Fix accidental detection of backslashes as tokens
Previously backslashes were accidentally detected as tokens by the indentation tokeniser. This meant that character literals, would break indentation of everything after them.
Configuration menu - View commit details
-
Copy full SHA for 3d8197e - Browse repository at this point
Copy the full SHA 3d8197eView commit details
Commits on Jun 26, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 101c9a4 - Browse repository at this point
Copy the full SHA 101c9a4View commit details -
Add basic function parameter alignment indentation
This likely still needs a lot of improvements.
Configuration menu - View commit details
-
Copy full SHA for 35e0234 - Browse repository at this point
Copy the full SHA 35e0234View commit details -
Configuration menu - View commit details
-
Copy full SHA for 787e1e8 - Browse repository at this point
Copy the full SHA 787e1e8View commit details -
Configuration menu - View commit details
-
Copy full SHA for bfce724 - Browse repository at this point
Copy the full SHA bfce724View commit details -
Configuration menu - View commit details
-
Copy full SHA for a2ffcba - Browse repository at this point
Copy the full SHA a2ffcbaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 09720fe - Browse repository at this point
Copy the full SHA 09720feView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2728db2 - Browse repository at this point
Copy the full SHA 2728db2View commit details
Commits on Aug 12, 2023
-
Configuration menu - View commit details
-
Copy full SHA for d51154a - Browse repository at this point
Copy the full SHA d51154aView commit details
Commits on Aug 13, 2023
-
Configuration menu - View commit details
-
Copy full SHA for f3d889f - Browse repository at this point
Copy the full SHA f3d889fView commit details -
Configuration menu - View commit details
-
Copy full SHA for bf4cf3d - Browse repository at this point
Copy the full SHA bf4cf3dView commit details -
Configuration menu - View commit details
-
Copy full SHA for caef0c5 - Browse repository at this point
Copy the full SHA caef0c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3dbc6dd - Browse repository at this point
Copy the full SHA 3dbc6ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5550111 - Browse repository at this point
Copy the full SHA 5550111View commit details
Commits on Dec 23, 2023
-
Neovim has added the
state()
function; use it if availableSee: neovim/neovim#23576 Unintentional multiline string indentation will no longer occur in future Neovim versions.
Configuration menu - View commit details
-
Copy full SHA for b8aef1b - Browse repository at this point
Copy the full SHA b8aef1bView commit details -
Fix application of inline comments during indentation
Previously indenting code containing inline comments like this: {:foo 1 ; Hello [ :bar 2} Would have resulted in this incorrect indentation: {:foo 1 ; Hello [ :bar 2}
Configuration menu - View commit details
-
Copy full SHA for b2c392d - Browse repository at this point
Copy the full SHA b2c392dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4edeef0 - Browse repository at this point
Copy the full SHA 4edeef0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0388414 - Browse repository at this point
Copy the full SHA 0388414View commit details -
Configuration menu - View commit details
-
Copy full SHA for 41a45d4 - Browse repository at this point
Copy the full SHA 41a45d4View commit details
Commits on Dec 25, 2023
-
Improve accuracy of function operand indenting
In the original indent script, code like this: ((foo) 1 3) Would be indented as this: ((foo) 1 3) Now it is *correctly* indented as this: ((foo) 1 3)
Configuration menu - View commit details
-
Copy full SHA for 68999ca - Browse repository at this point
Copy the full SHA 68999caView commit details
Commits on Dec 26, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 8f38c11 - Browse repository at this point
Copy the full SHA 8f38c11View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7e90f09 - Browse repository at this point
Copy the full SHA 7e90f09View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b388ae - Browse repository at this point
Copy the full SHA 0b388aeView commit details
Commits on Mar 9, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 289352d - Browse repository at this point
Copy the full SHA 289352dView commit details
Commits on Mar 10, 2024
-
Configuration menu - View commit details
-
Copy full SHA for cefb7bc - Browse repository at this point
Copy the full SHA cefb7bcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 16026f7 - Browse repository at this point
Copy the full SHA 16026f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for d87f254 - Browse repository at this point
Copy the full SHA d87f254View commit details
Commits on Sep 22, 2024
-
Don't use fn arg alignment indent when a keyword is in function position
Fixes indentation of reader conditional macros. May choose to remove this if function argument indentation is generally preferred by programmers when a keyword is in function position.
Configuration menu - View commit details
-
Copy full SHA for 6a3d2d3 - Browse repository at this point
Copy the full SHA 6a3d2d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 083f554 - Browse repository at this point
Copy the full SHA 083f554View commit details -
Configuration menu - View commit details
-
Copy full SHA for f271dca - Browse repository at this point
Copy the full SHA f271dcaView commit details
Commits on Oct 4, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b86a4c0 - Browse repository at this point
Copy the full SHA b86a4c0View commit details -
Vim script is infuriating sometimes! Turns out that the indentation tests locally passed with the previous code, but failed in CI and real life.
Configuration menu - View commit details
-
Copy full SHA for 01edfec - Browse repository at this point
Copy the full SHA 01edfecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b5e42c - Browse repository at this point
Copy the full SHA 9b5e42cView commit details
Commits on Oct 5, 2024
-
Improve indentation in "uniform" style and undo reader conditional work
When the "uniform" indent style is selected, we no longer apply other list indentation rules/analysis. Unfortunately the reader conditional changes broke indentation for the following: (ns my-ns (:require [clojure.string :as str] [clojure.spec.alpha :as s])) Indenting it as this: (ns my-ns (:require [clojure.string :as str] [clojure.spec.alpha :as s])) Which is incorrect.
Configuration menu - View commit details
-
Copy full SHA for a41fa1b - Browse repository at this point
Copy the full SHA a41fa1bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3487e07 - Browse repository at this point
Copy the full SHA 3487e07View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c5258c - Browse repository at this point
Copy the full SHA 3c5258cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b4dad8 - Browse repository at this point
Copy the full SHA 3b4dad8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 117b082 - Browse repository at this point
Copy the full SHA 117b082View commit details -
Configuration menu - View commit details
-
Copy full SHA for b26db95 - Browse repository at this point
Copy the full SHA b26db95View commit details -
Configuration menu - View commit details
-
Copy full SHA for c4a25c5 - Browse repository at this point
Copy the full SHA c4a25c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1742549 - Browse repository at this point
Copy the full SHA 1742549View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9800368 - Browse repository at this point
Copy the full SHA 9800368View commit details -
Configuration menu - View commit details
-
Copy full SHA for 69a0b6f - Browse repository at this point
Copy the full SHA 69a0b6fView commit details
Commits on Oct 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 058b4a7 - Browse repository at this point
Copy the full SHA 058b4a7View commit details -
Update indent regular expressions to set the required 'magic' mode
Makes indentation more robust against users toggling the `'magic'` option.
Configuration menu - View commit details
-
Copy full SHA for 0a835d8 - Browse repository at this point
Copy the full SHA 0a835d8View commit details
Commits on Oct 7, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0d865c5 - Browse repository at this point
Copy the full SHA 0d865c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 052a498 - Browse repository at this point
Copy the full SHA 052a498View commit details
Commits on Oct 13, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 55543c4 - Browse repository at this point
Copy the full SHA 55543c4View commit details