Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim.vim: confusion for function return types starting on another line #14442

Open
zzzyxwvut opened this issue Apr 8, 2024 · 4 comments
Open
Assignees
Labels
bug runtime vim9script Vim9 script related issues

Comments

@zzzyxwvut
Copy link
Contributor

Steps to reproduce

When the function signature is long and its return type is
started on another line, highlighting for the type and the
function body is gone.

There is also some premature recognition of vimReturnType
for dict<...> in TestC*. TestD* are fine.

vim9script

def TestA______________________________________________________________():
    \ void
enddef

def TestB____(result: dict<list<number>>, fs: list<func(number): number>):
    \ void
enddef

def TestC____(maybe: bool, F: func(): dict<func(number): number>): func():
	\ void
    return () => {
    }
enddef

def TestD____(fs: list<func(): dict<func(number): bool>>): func(): func():
	\ void
    return () => () => {
    }
enddef

class Tests
    def TestA__________________________________________________________():
	\ void
    enddef

    def TestB(result: dict<list<number>>, fs: list<func(number): number>):
	\ void
    enddef

    def TestC(maybe: bool, F: func(): dict<func(number): number>): func():
	    \ void
	return () => {
	}
    enddef

    def TestD(fs: list<func(): dict<func(number): bool>>): func(): func():
	    \ void
	return () => () => {
	}
    enddef
endclass

defcompile

Expected behaviour

Syntax highlighting should allow for function return types
starting on the next line.

Version of Vim

v9.1.0274

Environment

GNU/Linux Debian (testing/trixie)

Logs and stack traces

No response

@zzzyxwvut zzzyxwvut added the bug label Apr 8, 2024
@zzzyxwvut
Copy link
Contributor Author

Ping @dkearns.

@dkearns dkearns self-assigned this Apr 8, 2024
@dkearns dkearns added the runtime label Apr 8, 2024
@dkearns
Copy link
Contributor

dkearns commented Apr 13, 2024

I can fix this particular issue, but it's a game of whack-o-mole. We really need a syn-skip-group as line continuations and line-continuation comments can appear anywhere.

I was bit surprised to see that Vim can't parse the return type without a line continuation. @yegappan does that seem right to you?

I've noted the type highlighting as well, thanks.

@yegappan
Copy link
Member

I was bit surprised to see that Vim can't parse the return type without a line continuation. @yegappan does that seem right to you?

No. This is a bug. Requiring a line continuation after a ":" for the return type doesn't seem correct.

@zzzyxwvut
Copy link
Contributor Author

Note that you can't help but escape each type when hard put
to it.

@yegappan yegappan added the vim9script Vim9 script related issues label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug runtime vim9script Vim9 script related issues
Projects
None yet
Development

No branches or pull requests

3 participants