mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	feat(runtime): Allow lua to be used in syntax
This commit is contained in:
		@@ -56,6 +56,7 @@ fun! s:SynSet()
 | 
			
		||||
    for name in split(s, '\.')
 | 
			
		||||
      if !empty(name)
 | 
			
		||||
        exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim"
 | 
			
		||||
        exe "runtime! syntax/" . name . ".lua syntax/" . name . "/*.lua"
 | 
			
		||||
      endif
 | 
			
		||||
    endfor
 | 
			
		||||
  endif
 | 
			
		||||
 
 | 
			
		||||
@@ -172,5 +172,35 @@ describe('runtime:', function()
 | 
			
		||||
    end)
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  describe('syntax', function()
 | 
			
		||||
    local syntax_folder = table.concat({xconfig, 'nvim', 'syntax'}, pathsep)
 | 
			
		||||
 | 
			
		||||
    before_each(clear)
 | 
			
		||||
 | 
			
		||||
    it('loads lua syntaxes on filetype change', function()
 | 
			
		||||
      local syntax_file = table.concat({syntax_folder , 'my-lang.lua'}, pathsep)
 | 
			
		||||
      mkdir_p(syntax_folder)
 | 
			
		||||
      write_file(syntax_file , [[vim.g.lua_syntax = 1]])
 | 
			
		||||
 | 
			
		||||
      clear{ args_rm={'-u' }, env={ XDG_CONFIG_HOME=xconfig, VIMRUNTIME='runtime/' }}
 | 
			
		||||
 | 
			
		||||
      exec('set filetype=my-lang')
 | 
			
		||||
      eq(1, eval('g:lua_syntax'))
 | 
			
		||||
      rmdir(syntax_folder)
 | 
			
		||||
    end)
 | 
			
		||||
 | 
			
		||||
    it('loads lua syntaxes on syntax change', function()
 | 
			
		||||
      local syntax_file = table.concat({syntax_folder , 'my-lang.lua'}, pathsep)
 | 
			
		||||
      mkdir_p(syntax_folder)
 | 
			
		||||
      write_file(syntax_file , [[vim.g.lua_syntax = 5]])
 | 
			
		||||
 | 
			
		||||
      clear{ args_rm={'-u' }, env={ XDG_CONFIG_HOME=xconfig, VIMRUNTIME='runtime/' }}
 | 
			
		||||
 | 
			
		||||
      exec('set syntax=my-lang')
 | 
			
		||||
      eq(5, eval('g:lua_syntax'))
 | 
			
		||||
      rmdir(syntax_folder)
 | 
			
		||||
    end)
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user