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

Support vimscript null coalescing operator (aka falsy operator) #23033

Closed
mraveloarinjaka opened this issue Apr 11, 2023 · 7 comments
Closed
Labels
enhancement feature request has:vim-patch issue is fixed in vim and patch needs to be ported

Comments

@mraveloarinjaka
Copy link

mraveloarinjaka commented Apr 11, 2023

Problem

The null coalescing operator is not supported in vimscript.
The expression :echo ('test' ?? 'default') returns E15: Invalid expression: ? 'default').
Will you be open to amend the vimL parser to support that operator?

Expected behavior

The expression :echo ('test' ?? 'default') returns 'test'.

@mraveloarinjaka mraveloarinjaka added the enhancement feature request label Apr 11, 2023
@mraveloarinjaka
Copy link
Author

If you are ok to update the parser I can try to devise a patch of https://github.com/neovim/neovim/blob/master/src/nvim/viml/parser/expressions.c

@bfredl
Copy link
Member

bfredl commented Apr 11, 2023

https://github.com/neovim/neovim/blob/master/src/nvim/viml/parser/expressions.c is not relevant for this. What is needed is porting vim-patch 8.2.1794.

@bfredl
Copy link
Member

bfredl commented Apr 11, 2023

ok it is needed for i<c-r>=(foo ?? bar) highlighting, but for actual execution (which would be the first step), we need the patch.

@mraveloarinjaka
Copy link
Author

Sorry in advance if my question sounds dumb: I am not familiar with neovim codeline.
What do you mean by vim-patch 8.2.1794? Is it a specific tag I should look up in the vim repository? Is it a patch available somewhere in the neovim repository that could not be merged?

@mraveloarinjaka
Copy link
Author

never mind I just saw https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim
I should have read the doc

@zeertzjq zeertzjq added the has:vim-patch issue is fixed in vim and patch needs to be ported label Apr 12, 2023
@zeertzjq
Copy link
Member

The patch has been merged. However it seems that the command line highlighter doesn't currently support any of the following:

  • Blobs
  • Method call
  • Falsy coalescing operator

@zeertzjq
Copy link
Member

I think this can be closed as the original request has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request has:vim-patch issue is fixed in vim and patch needs to be ported
Projects
None yet
Development

No branches or pull requests

3 participants