File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
extension-test/unit/cursor-doc Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Changes to Calva.
77- Fix: [ Connecting a REPL sequence disconnects the previous prematurely] ( https://github.com/BetterThanTomorrow/calva/issues/3065 )
88- Fix: [ Toggle Line Comment produces incorrect output for multi-line selections] ( https://github.com/BetterThanTomorrow/calva/issues/3066 )
99- Fix: [ Toggle Line Comment loses the selection when you run the command] ( https://github.com/BetterThanTomorrow/calva/issues/3067 )
10+ - Fix: [ Insert Semicolon does not work correctly in the first line of a file] ( https://github.com/BetterThanTomorrow/calva/issues/3072 )
1011
1112## [ 2.0.554] - 2026-02-17
1213
Original file line number Diff line number Diff line change @@ -2617,7 +2617,7 @@ export function _semiColonWouldBreakStructureWhere(
26172617
26182618export async function insertSemiColon ( doc : EditableDocument , p = doc . selections [ 0 ] . active ) {
26192619 const wouldBreakWhere = _semiColonWouldBreakStructureWhere ( doc , p ) ;
2620- if ( wouldBreakWhere ) {
2620+ if ( wouldBreakWhere !== false ) {
26212621 const cursor = doc . getTokenCursor ( p ) ;
26222622 const lineText = doc . model . getLineText ( cursor . line ) ;
26232623 const indent = lineText . match ( / ^ \s * / ) [ 0 ] ;
Original file line number Diff line number Diff line change @@ -3326,6 +3326,12 @@ describe('paredit util', () => {
33263326 await paredit . insertSemiColon ( a ) ;
33273327 expect ( textAndSelection ( a ) ) . toEqual ( textAndSelection ( b ) ) ;
33283328 } ) ;
3329+ it ( 'inserts a newline to preserve structure at offset 0' , async ( ) => {
3330+ const a = docFromTextNotation ( '|(defn hi []• (prn "hi"))' ) ;
3331+ const b = docFromTextNotation ( ';|•(defn hi []• (prn "hi"))' ) ;
3332+ await paredit . insertSemiColon ( a ) ;
3333+ expect ( textAndSelection ( a ) ) . toEqual ( textAndSelection ( b ) ) ;
3334+ } ) ;
33293335 } ) ;
33303336
33313337 describe ( '_semiColonWouldBreakStructureWhere' , ( ) => {
@@ -3412,5 +3418,12 @@ describe('paredit util', () => {
34123418 paredit . _semiColonWouldBreakStructureWhere ( docFromTextNotation ( '|a (b {•} c•) d ' ) )
34133419 ) . toBe ( 2 ) ;
34143420 } ) ;
3421+ it ( 'returns 0 when a multi-line form starts at offset 0' , ( ) => {
3422+ expect (
3423+ paredit . _semiColonWouldBreakStructureWhere (
3424+ docFromTextNotation ( '|(defn hi []• (prn "hi"))' )
3425+ )
3426+ ) . toBe ( 0 ) ;
3427+ } ) ;
34153428 } ) ;
34163429} ) ;
You can’t perform that action at this time.
0 commit comments