Open jeffreysbrother opened 6 years ago
@jeffreysbrother
You are right, and what you pointed out behaviors are both I already recognized.
a f
, i f
cannot select arrow functionOnce it's possible, but I excluded it, because
I understand that it's inconsistent.
But to select arrow function, you can use fold text object as long as it's foldable arrow function.
By such as y z
(short hand of y a z
), y a z
, y i z
etc..
a f
, i f
should be able to select function regardless of how it's indented.I agree, but currently vmp find function range from fold, fold is created based on indent. I have no plan to change this for now.
Following are what I wrote in recent TextObject Function improvement PR. #984
I won't try to be perfectly detect function body by parsing. I will try to improve coverage of detection by supporting common multi-func-patterns used in different function. I want keep language specific handling as minimum as possible. So I will still get hint from indentation.
Create vmp-plugin package.
The command
cif
(as well as other related actions such asvaf
anddaf
) does not recognize the following function (presumably because it utilizes an ES6 arrow function):If the arrow function is replaced with a standard (pre-ES6) anonymous function, the issue does not arise. However, even if no anonymous function is used, it will still fail if the body of the function is not indented.
I believe the presence/absence of whitespace should not effect functionality because it is quite common to encounter source code that does not adhere to common coding conventions.
vim-mode-plus: 1.22.0 Atom: 1.22.1 Electron: 1.6.15 Chrome: 56.0.2924.87 Node: 7.4.0 MacOS: 10.12.6