CKolkey / ts-node-action

Neovim Plugin for running functions on nodes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] "Complete Statement" like Intellij IDEs

comiluv opened this issue · comments

  1. In Intellij IDEA, when the user presses <C-S-Enter> 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, <C-S-Enter> 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 <C-S-Enter> 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/

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

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