CKolkey / ts-node-action

Neovim Plugin for running functions on nodes.
359 stars 20 forks source link

[Feature Request] "Complete Statement" like Intellij IDEs #43

Closed comiluv closed 1 year ago

comiluv commented 1 year ago
  1. In Intellij IDEA, when the user presses \ when the cursor is positioned on a line of the code where the line can be finished by adding a ; at the end of the line, the editor would add a semicolon to finish the statement.

  2. If the cursor is positioned on a function declaration or a function definition, \ would add parentheses and brackets for the function parameters and the function body where it's appropriate, and also moves the cursor to where it's appropriate.

  3. When calling a function, IDE would add parentheses when the user presses \ on the function identifier.

There may be some more use cases what IntelliJ "complete statement" action does that I'm not aware of, but if above functionalities can be implemented it would be great additions to coding experience with Neovim.

If anyone is unfamiliar with what the "complete statement action" is in IntelliJ, see https://www.jetbrains.com/idea/guide/tips/complete-statement/

CKolkey commented 1 year ago

Not sure this would work - if your language requires parens then the buffer/tree would be in an invalid state, so doing transformations on it might be unpredictable. But if you want to try and implement it, I'd be happy to offer advice

comiluv commented 1 year ago

I'll reopen the issue or open another one when I have it