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.
What is commonalities in samples in following Objective section?
For multiline parameter's function
funcStartRow is not ended by { , that multi-line param function!
funcEndRow is ended by {, then body is fold starting from this row.
next row of funcEndRow is ended by { is fold starting from this row.
Still vmp function text object greatly depends on fold info.
Objective
PHP: OK
<?php
class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
}
Python: OK
## WONT support
class Rectangle(Blob):
def __init__(self, width, height,
color='black', emphasis=None, highlight=0):
## will support
class Rectangle(Blob):
def __init__(
self, width, height,
color='black', emphasis=None, highlight=0
):
# body
c: OK
int
get_beval_info(
BalloonEval *beval,
int getword,
win_T **winp,
linenr_T *lnump,
char_u **textp,
int *colp)
{
win_T *wp;
int row, col;
char_u *lbuf;
linenr_T lnum;
}
coffee: SKIP BECAUSE COST NOT PAY FOR ME
f1 = (a, b) ->
console.log a, b
f2 = (
a,
b
) ->
console.log a, b
js: OK
function f1(a1, a2) {
console.log(a1, a2)
}
function f2(
a1,
a2
) {
console.log(a1, a2)
}
rust: OK
fn f1(arg1: i64, arg2: u64, arg3: String) -> i64 {
let sum = 1 + 1;
sum + 2
}
fn f2(
arg1: i64,
arg2: u64,
arg3: String,
) -> i64 {
let sum = 1 + 1;
sum + 2
}
983
https://github.com/t9md/atom-vim-mode-plus/issues/819#issuecomment-318629360
Heuristically find function range.
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.
What is commonalities in samples in following
Objective
section?{
, that multi-line param function!{
, then body is fold starting from this row.{
is fold starting from this row.Still vmp function text object greatly depends on
fold
info.Objective
PHP: OK
Python: OK
c: OK
coffee: SKIP BECAUSE COST NOT PAY FOR ME
js: OK
rust: OK