mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
fix(statusline): don't require'vim.diagnostic' unless already used
This workarounds a bug likely in nvim__get_runtime, and fixes #35124 Though I'd argue it is more correct anyway as the point of vim.SUBMODULE lazy loading is "only pay for what you use". If no one has require'vim.diagnostic' yet in LSP or otherwise, there cannot be any diagostics available and loading the lua module is wasteful.
This commit is contained in:
2
runtime/lua/vim/_meta/options.lua
generated
2
runtime/lua/vim/_meta/options.lua
generated
@@ -6909,7 +6909,7 @@ vim.wo.stc = vim.wo.statuscolumn
|
||||
---
|
||||
---
|
||||
--- @type string
|
||||
vim.o.statusline = "%<%f %h%w%m%r %=%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}%{% &busy > 0 ? '◐ ' : '' %}%(%{luaeval('(pcall(require, ''vim.diagnostic'') and vim.diagnostic.status()) or '''' ')} %)%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}"
|
||||
vim.o.statusline = "%<%f %h%w%m%r %=%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}%{% &busy > 0 ? '◐ ' : '' %}%(%{luaeval('(package.loaded[''vim.diagnostic''] and vim.diagnostic.status()) or '''' ')} %)%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}"
|
||||
vim.o.stl = vim.o.statusline
|
||||
vim.wo.statusline = vim.o.statusline
|
||||
vim.wo.stl = vim.wo.statusline
|
||||
|
@@ -8714,7 +8714,7 @@ local options = {
|
||||
"%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}",
|
||||
"%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}",
|
||||
"%{% &busy > 0 ? '◐ ' : '' %}",
|
||||
"%(%{luaeval('(pcall(require, ''vim.diagnostic'') and vim.diagnostic.status()) or '''' ')} %)",
|
||||
"%(%{luaeval('(package.loaded[''vim.diagnostic''] and vim.diagnostic.status()) or '''' ')} %)",
|
||||
"%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}",
|
||||
}),
|
||||
doc = 'is very long',
|
||||
|
@@ -792,7 +792,7 @@ describe('default statusline', function()
|
||||
"%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}",
|
||||
"%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}",
|
||||
"%{% &busy > 0 ? '◐ ' : '' %}",
|
||||
"%(%{luaeval('(pcall(require, ''vim.diagnostic'') and vim.diagnostic.status()) or '''' ')} %)",
|
||||
"%(%{luaeval('(package.loaded[''vim.diagnostic''] and vim.diagnostic.status()) or '''' ')} %)",
|
||||
"%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}",
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user