Should also make it easier to support/update new syntaxes, by editing only 2 variables, BLOCKS
:
const BLOCKS: list<list<string>> = [ ['if', 'el\%[se]', 'elseif\=', 'en\%[dif]'], ['for', 'endfor\='], ['wh\%[ile]', 'endw\%[hile]'], ['try', 'cat\%[ch]', 'fina\|finally\=', 'endt\%[ry]'], ['def', 'enddef'], ['fu\%[nction](\@!', 'endf\%[unction]'], ['class', 'endclass'], ['interface', 'endinterface'], ['enum', 'endenum'], ['aug\%[roup]\%(\s\+[eE][nN][dD]\)\@!\s\+\S\+', 'aug\%[roup]\s\+[eE][nN][dD]'], ]
And MODIFIERS
:
const MODIFIERS: dict<string> = { def: ['export', 'static'], class: ['export', 'abstract', 'export abstract'], interface: ['export'], }
Also fixes a bug.
Expected:
vim9script if ( true) && true echo endif
Actual:
vim9script if ( true) && true echo endif
https://github.com/vim/vim/pull/11928
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@lacygoill pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
Merging #11928 (da2fc75) into master (fadc02a) will increase coverage by
0.32%
.
The diff coverage isn/a
.
@@ Coverage Diff @@ ## master #11928 +/- ## ========================================== + Coverage 81.94% 82.27% +0.32% ========================================== Files 160 150 -10 Lines 192331 182981 -9350 Branches 43306 41370 -1936 ========================================== - Hits 157613 150554 -7059 + Misses 21858 19872 -1986 + Partials 12860 12555 -305
Flag | Coverage Δ | |
---|---|---|
huge-clang-none | 82.62% <ø> (+0.02%) |
⬆️ |
huge-gcc-testgui | 51.58% <ø> (?) |
|
linux | 82.27% <ø> (-0.33%) |
⬇️ |
mingw-x64-HUGE | ? |
|
mingw-x86-HUGE | ? |
|
windows | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
src/regexp_bt.c | 78.52% <0.00%> (-9.09%) |
⬇️ |
src/typval.c | 83.19% <0.00%> (-7.19%) |
⬇️ |
src/if_perl.xs | 76.41% <0.00%> (-5.79%) |
⬇️ |
src/json.c | 77.84% <0.00%> (-5.59%) |
⬇️ |
src/regexp_nfa.c | 84.95% <0.00%> (-5.22%) |
⬇️ |
src/libvterm/src/parser.c | 55.18% <0.00%> (-4.90%) |
⬇️ |
src/edit.c | 82.81% <0.00%> (-3.73%) |
⬇️ |
src/if_tcl.c | 81.63% <0.00%> (-3.61%) |
⬇️ |
src/gui.c | 69.59% <0.00%> (-3.47%) |
⬇️ |
src/libvterm/src/state.c | 33.59% <0.00%> (-3.31%) |
⬇️ |
... and 134 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I have included this, thanks.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #11928.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Using v9.0.1274, which seems to have this in it, if I open new file aa.vim and enter
vim9script
def F1
enddef
class C1
endclass
Note that endclass
is not dedented automatically while typing; but enddef
was. I don't know if this is considered a bug.
BTW, if it matters, locally I've got (which points to an up to date repo of github.com/lacygoill/vim9-syntax.git
)
err@harmony:~/.vim
$ ls -l import/ syntax/
import/:
total 0M
lrwxrwxrwx 1 err err 46 Sep 7 19:17 vim9Language.vim -> /ref/tools/vim9-syntax/import/vim9Language.vim
lrwxrwxrwx 1 err err 48 Feb 1 08:03 vim9SyntaxUtil.vim -> /ref/tools/vim9-syntax/import/vim9SyntaxUtil.vim
syntax/:
total 0M
lrwxrwxrwx 1 err err 37 May 5 2022 vim.vim -> /ref/tools/vim9-syntax/syntax/vim.vim
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
There is more work to properly support Vim9 (b:match_words
, gf
& friends via custom mappings or maybe 'includeexpr'
).
In any case, this should fix the issue:
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 2cb32372d..f390ad5c2 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -16,7 +16,7 @@ b:undo_indent = 'setlocal indentkeys< indentexpr<' import autoload '../autoload/dist/vimindent.vim' setlocal indentexpr=vimindent.Expr() -setlocal indentkeys+==endif,=enddef,=endfu,=endfor,=endwh,=endtry,=},=else,=cat,=finall,=END,0\\ +setlocal indentkeys+==endif,=enddef,=endfu,=endfor,=endwh,=endtry,=endclass,=endinterface,=endenum,=},=else,=cat,=finall,=END,0\\ execute('setlocal indentkeys+=0=\"\\\ ,0=#\\\ ') setlocal indentkeys-=0# setlocal indentkeys-=:
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks, that does it.
There is more work to properly support Vim9
Yeah, I get it. Since class extends
is close to being usable, and this PR is about indent, I thought this might have fallen through the cracks. But I see now that the fix is in vim.vim
and not vimindent.vim
. Thanks again.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I've done the following locally, since begin/end is so handy. I'm not sure this is how you'd want to do it for release. I was wondering if for class you'd want to visit constructors.
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -102,6 +102,7 @@ \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+\s*(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' . \ '\<\(wh\%[ile]\|for\)\>:\%(\%(^\||\)\s*\)\@<=\<brea\%[k]\>:\%(\%(^\||\)\s*\)\@<=\<con\%[tinue]\>:\%(\%(^\||\)\s*\)\@<=\<end\(w\%[hile]\|fo\%[r]\)\>,' . \ '\<if\>:\%(\%(^\||\)\s*\)\@<=\<el\%[seif]\>:\%(\%(^\||\)\s*\)\@<=\<en\%[dif]\>,' . + \ '\<\(class\|interface\|enum\)\>:\<\(endclass\|endinterface\|endenum\)\>,' . \ '{:},' . \ '\<try\>:\%(\%(^\||\)\s*\)\@<=\<cat\%[ch]\>:\%(\%(^\||\)\s*\)\@<=\<fina\%[lly]\>:\%(\%(^\||\)\s*\)\@<=\<endt\%[ry]\>,' . \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,'
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I would not like "%" to stop at constructors, just jumping from "class" to "endclass" is what I expect.
I also don't like much that it stops at "return" statements when used on "function", but that's a personal preference.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I would not like "%" to stop at constructors, just jumping from "class" to "endclass" is what I expect.
I also don't like much that it stops at "return" statements when used on "function", but that's a personal preference.
That's my personal preference as well. I mention it because I've assumed there are some that like it.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.