Skip to content

Typing assist: implement typing assist on delete/backspace inside records#324

Closed
seclerp wants to merge 4 commits intoJetBrains:net222from
seclerp:net213-typing-assist-records
Closed

Typing assist: implement typing assist on delete/backspace inside records#324
seclerp wants to merge 4 commits intoJetBrains:net222from
seclerp:net213-typing-assist-records

Conversation

@seclerp
Copy link
Member

@seclerp seclerp commented Nov 14, 2021

This PR implements delete/backspace assist for cases when the caret is inside record declaration/instance to help in deletion of redundant whitespace. The feature also works for anonymous records and records with attributes as well.

Examples:

Definition:

type SomeRecord =
   { field1: string
     field2: string
     {caret}field3: string }

Backspace:

type SomeRecord =
   { field1: string
     field2: string; field3: string }

Instance:

// Before
let someRecord =
   { field1 = "Quick"
     field2 = "Brown"{caret}
     field3 = "Fox" }

Delete:

let someRecord =
   { field1 = "Quick"
     field2 = "Brown"; field3 = "Fox" }

@seclerp seclerp changed the base branch from net213 to net221 November 15, 2021 14:22
@auduchinok
Copy link
Member

auduchinok commented Nov 25, 2021

@seclerp Could you pleas add tests for cases where the typing assist shouldn't do the additional formatting, please?

An example for Delete, there's a space after the caret:

{ A = 1 {caret} 
  B = 1
  ...

Please also consider how this should work next to comments and empty lines.

@seclerp
Copy link
Member Author

seclerp commented Nov 26, 2021

@auduchinok thanks for that catch, I added missing tests and also improved typing assist. Now when backspace is pressed before record field with preceding empty line (or line with only whitespace symbols) indentation is kept:

let record = {
  field1 = "Hello"

  {caret}field2 = "World"
}

Backspace:

let record = {
  field1 = "Hello"
  {caret}field2 = "World"
}

@seclerp seclerp changed the base branch from net221 to net222 April 10, 2022 00:43
@seclerp seclerp closed this by deleting the head repository Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments