mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	fix(genvimvim): generate prefixed boolean options properly (#27487)
This commit is contained in:
		@@ -83,7 +83,7 @@ local vimopt_start = 'syn keyword vimOption contained '
 | 
			
		||||
w('\n\n' .. vimopt_start)
 | 
			
		||||
 | 
			
		||||
for _, opt_desc in ipairs(options.options) do
 | 
			
		||||
  if not opt_desc.varname or opt_desc.varname:sub(1, 7) ~= 'p_force' then
 | 
			
		||||
  if not opt_desc.immutable then
 | 
			
		||||
    if lld.line_length > 850 then
 | 
			
		||||
      w('\n' .. vimopt_start)
 | 
			
		||||
    end
 | 
			
		||||
@@ -91,7 +91,7 @@ for _, opt_desc in ipairs(options.options) do
 | 
			
		||||
    if opt_desc.abbreviation then
 | 
			
		||||
      w(' ' .. opt_desc.abbreviation)
 | 
			
		||||
    end
 | 
			
		||||
    if opt_desc.type == 'bool' then
 | 
			
		||||
    if opt_desc.type == 'boolean' then
 | 
			
		||||
      w(' inv' .. opt_desc.full_name)
 | 
			
		||||
      w(' no' .. opt_desc.full_name)
 | 
			
		||||
      if opt_desc.abbreviation then
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										40
									
								
								test/functional/plugin/vim_syntax_spec.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								test/functional/plugin/vim_syntax_spec.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
local helpers = require('test.functional.helpers')(after_each)
 | 
			
		||||
local Screen = require('test.functional.ui.screen')
 | 
			
		||||
local clear = helpers.clear
 | 
			
		||||
local exec = helpers.exec
 | 
			
		||||
local api = helpers.api
 | 
			
		||||
 | 
			
		||||
describe('Vimscript syntax highlighting', function()
 | 
			
		||||
  local screen
 | 
			
		||||
 | 
			
		||||
  before_each(function()
 | 
			
		||||
    clear()
 | 
			
		||||
    helpers.add_builddir_to_rtp()
 | 
			
		||||
    exec([[
 | 
			
		||||
      setfiletype vim
 | 
			
		||||
      syntax on
 | 
			
		||||
    ]])
 | 
			
		||||
    screen = Screen.new()
 | 
			
		||||
    screen:set_default_attr_ids({
 | 
			
		||||
      [0] = { foreground = Screen.colors.Blue, bold = true },
 | 
			
		||||
      [1] = { foreground = Screen.colors.Brown, bold = true },
 | 
			
		||||
      [2] = { foreground = tonumber('0x6a0dad') },
 | 
			
		||||
    })
 | 
			
		||||
    screen:attach()
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('prefixed boolean options are highlighted properly', function()
 | 
			
		||||
    api.nvim_buf_set_lines(0, 0, -1, true, {
 | 
			
		||||
      'set number incsearch hlsearch',
 | 
			
		||||
      'set nonumber noincsearch nohlsearch',
 | 
			
		||||
      'set invnumber invincsearch invhlsearch',
 | 
			
		||||
    })
 | 
			
		||||
    screen:expect([[
 | 
			
		||||
      {1:^set} {2:number} {2:incsearch} {2:hlsearch}                        |
 | 
			
		||||
      {1:set} {2:nonumber} {2:noincsearch} {2:nohlsearch}                  |
 | 
			
		||||
      {1:set} {2:invnumber} {2:invincsearch} {2:invhlsearch}               |
 | 
			
		||||
      {0:~                                                    }|*10
 | 
			
		||||
                                                           |
 | 
			
		||||
    ]])
 | 
			
		||||
  end)
 | 
			
		||||
end)
 | 
			
		||||
		Reference in New Issue
	
	Block a user