mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	Merge #9145 'CI, nodejs fixes'
This commit is contained in:
		@@ -18,6 +18,7 @@ build_script:
 | 
				
			|||||||
- powershell ci\build.ps1
 | 
					- powershell ci\build.ps1
 | 
				
			||||||
cache:
 | 
					cache:
 | 
				
			||||||
- C:\msys64\var\cache\pacman\pkg -> ci\build.ps1
 | 
					- C:\msys64\var\cache\pacman\pkg -> ci\build.ps1
 | 
				
			||||||
 | 
					- .deps -> ci\build.ps1
 | 
				
			||||||
- .deps -> third-party\**
 | 
					- .deps -> third-party\**
 | 
				
			||||||
artifacts:
 | 
					artifacts:
 | 
				
			||||||
- path: build/Neovim.zip
 | 
					- path: build/Neovim.zip
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,7 +103,7 @@ $failed = $false
 | 
				
			|||||||
Set-PSDebug -Off
 | 
					Set-PSDebug -Off
 | 
				
			||||||
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
 | 
					cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
 | 
				
			||||||
  foreach { $failed = $failed -or
 | 
					  foreach { $failed = $failed -or
 | 
				
			||||||
    $_ -match 'Running functional tests failed with error'; $_ }
 | 
					    $_ -match 'functional tests failed with error'; $_ }
 | 
				
			||||||
Set-PSDebug -Trace 1
 | 
					Set-PSDebug -Trace 1
 | 
				
			||||||
if ($failed) {
 | 
					if ($failed) {
 | 
				
			||||||
  exit $LastExitCode
 | 
					  exit $LastExitCode
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,24 +22,14 @@ function! s:is_minimum_version(version, min_major, min_minor) abort
 | 
				
			|||||||
    \         && str2nr(v_list[1]) >= str2nr(a:min_minor)))
 | 
					    \         && str2nr(v_list[1]) >= str2nr(a:min_minor)))
 | 
				
			||||||
endfunction
 | 
					endfunction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let s:NodeHandler = {}
 | 
					let s:NodeHandler = {
 | 
				
			||||||
 | 
					\ 'stdout_buffered': v:true,
 | 
				
			||||||
 | 
					\ 'result': ''
 | 
				
			||||||
 | 
					\ }
 | 
				
			||||||
function! s:NodeHandler.on_exit(job_id, data, event)
 | 
					function! s:NodeHandler.on_exit(job_id, data, event)
 | 
				
			||||||
  let bin_dir = join(self.stdout, '')
 | 
					  let bin_dir = join(self.stdout, '')
 | 
				
			||||||
  let entry_point = bin_dir . self.entry_point
 | 
					  let entry_point = bin_dir . self.entry_point
 | 
				
			||||||
    if filereadable(entry_point)
 | 
					  let self.result = filereadable(entry_point) ? entry_point : ''
 | 
				
			||||||
        let self.result = entry_point
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        let self.result = ''
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
endfunction
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function! s:NodeHandler.new()
 | 
					 | 
				
			||||||
    let obj = copy(s:NodeHandler)
 | 
					 | 
				
			||||||
    let obj.stdout_buffered = v:true
 | 
					 | 
				
			||||||
    let obj.result = ''
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return obj
 | 
					 | 
				
			||||||
endfunction
 | 
					endfunction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" Support for --inspect-brk requires node 6.12+ or 7.6+ or 8+
 | 
					" Support for --inspect-brk requires node 6.12+ or 7.6+ or 8+
 | 
				
			||||||
@@ -65,32 +55,43 @@ function! provider#node#Detect() abort
 | 
				
			|||||||
    return ''
 | 
					    return ''
 | 
				
			||||||
  endif
 | 
					  endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let yarn_subpath = '/node_modules/neovim/bin/cli.js'
 | 
					  let npm_opts = {}
 | 
				
			||||||
  let npm_subpath = '/neovim/bin/cli.js'
 | 
					  if executable('npm')
 | 
				
			||||||
 | 
					    let npm_opts = deepcopy(s:NodeHandler)
 | 
				
			||||||
 | 
					    let npm_opts.entry_point = '/neovim/bin/cli.js'
 | 
				
			||||||
 | 
					    let npm_opts.job_id = jobstart('npm --loglevel silent root -g', npm_opts)
 | 
				
			||||||
 | 
					  endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  let yarn_opts = {}
 | 
				
			||||||
 | 
					  if executable('yarn')
 | 
				
			||||||
 | 
					    let yarn_opts = deepcopy(s:NodeHandler)
 | 
				
			||||||
 | 
					    let yarn_opts.entry_point = '/node_modules/neovim/bin/cli.js'
 | 
				
			||||||
    " `yarn global dir` is slow (> 250ms), try the default path first
 | 
					    " `yarn global dir` is slow (> 250ms), try the default path first
 | 
				
			||||||
  if filereadable('$HOME/.config/yarn/global' . yarn_subpath)
 | 
					    " XXX: The following code is not portable
 | 
				
			||||||
      return '$HOME/.config/yarn/global' . yarn_subpath
 | 
					    " https://github.com/yarnpkg/yarn/issues/2049#issuecomment-263183768
 | 
				
			||||||
  end
 | 
					    if has('unix')
 | 
				
			||||||
 | 
					      let yarn_default_path = $HOME . '/.config/yarn/global/' . yarn_opts.entry_point
 | 
				
			||||||
  " try both npm and yarn simultaneously
 | 
					      if filereadable(yarn_default_path)
 | 
				
			||||||
  let yarn_opts = s:NodeHandler.new()
 | 
					        return yarn_default_path
 | 
				
			||||||
  let yarn_opts.entry_point = yarn_subpath
 | 
					      endif
 | 
				
			||||||
  let yarn_opts.job_id = jobstart(['yarn', 'global', 'dir'], yarn_opts)
 | 
					    endif
 | 
				
			||||||
  let npm_opts = s:NodeHandler.new()
 | 
					    let yarn_opts.job_id = jobstart('yarn global dir', yarn_opts)
 | 
				
			||||||
  let npm_opts.entry_point = npm_subpath
 | 
					  endif
 | 
				
			||||||
  let npm_opts.job_id = jobstart(['npm', '--loglevel', 'silent', 'root', '-g'], npm_opts)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  " npm returns the directory faster, so let's check that first
 | 
					  " npm returns the directory faster, so let's check that first
 | 
				
			||||||
 | 
					  if !empty(npm_opts)
 | 
				
			||||||
    let result = jobwait([npm_opts.job_id])
 | 
					    let result = jobwait([npm_opts.job_id])
 | 
				
			||||||
    if result[0] == 0 && npm_opts.result != ''
 | 
					    if result[0] == 0 && npm_opts.result != ''
 | 
				
			||||||
      return npm_opts.result
 | 
					      return npm_opts.result
 | 
				
			||||||
    endif
 | 
					    endif
 | 
				
			||||||
 | 
					  endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if !empty(yarn_opts)
 | 
				
			||||||
    let result = jobwait([yarn_opts.job_id])
 | 
					    let result = jobwait([yarn_opts.job_id])
 | 
				
			||||||
    if result[0] == 0 && yarn_opts.result != ''
 | 
					    if result[0] == 0 && yarn_opts.result != ''
 | 
				
			||||||
      return yarn_opts.result
 | 
					      return yarn_opts.result
 | 
				
			||||||
    endif
 | 
					    endif
 | 
				
			||||||
 | 
					  endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return ''
 | 
					  return ''
 | 
				
			||||||
endfunction
 | 
					endfunction
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,7 +85,7 @@ local vimau_start = 'syn keyword vimAutoEvent contained '
 | 
				
			|||||||
w('\n\n' .. vimau_start)
 | 
					w('\n\n' .. vimau_start)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for _, au in ipairs(auevents.events) do
 | 
					for _, au in ipairs(auevents.events) do
 | 
				
			||||||
  if not auevents.neovim_specific[au] then
 | 
					  if not auevents.nvim_specific[au] then
 | 
				
			||||||
    if lld.line_length > 850 then
 | 
					    if lld.line_length > 850 then
 | 
				
			||||||
      w('\n' .. vimau_start)
 | 
					      w('\n' .. vimau_start)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -93,7 +93,7 @@ for _, au in ipairs(auevents.events) do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
for au, _ in pairs(auevents.aliases) do
 | 
					for au, _ in pairs(auevents.aliases) do
 | 
				
			||||||
  if not auevents.neovim_specific[au] then
 | 
					  if not auevents.nvim_specific[au] then
 | 
				
			||||||
    if lld.line_length > 850 then
 | 
					    if lld.line_length > 850 then
 | 
				
			||||||
      w('\n' .. vimau_start)
 | 
					      w('\n' .. vimau_start)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -104,7 +104,7 @@ end
 | 
				
			|||||||
local nvimau_start = 'syn keyword nvimAutoEvent contained '
 | 
					local nvimau_start = 'syn keyword nvimAutoEvent contained '
 | 
				
			||||||
w('\n\n' .. nvimau_start)
 | 
					w('\n\n' .. nvimau_start)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for au, _ in pairs(auevents.neovim_specific) do
 | 
					for au, _ in pairs(auevents.nvim_specific) do
 | 
				
			||||||
  if lld.line_length > 850 then
 | 
					  if lld.line_length > 850 then
 | 
				
			||||||
    w('\n' .. nvimau_start)
 | 
					    w('\n' .. nvimau_start)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,8 +19,8 @@ return {
 | 
				
			|||||||
    'BufWriteCmd',            -- write buffer using command
 | 
					    'BufWriteCmd',            -- write buffer using command
 | 
				
			||||||
    'BufWritePost',           -- after writing a buffer
 | 
					    'BufWritePost',           -- after writing a buffer
 | 
				
			||||||
    'BufWritePre',            -- before writing a buffer
 | 
					    'BufWritePre',            -- before writing a buffer
 | 
				
			||||||
    'ChanOpen',               -- channel was opened
 | 
					 | 
				
			||||||
    'ChanInfo',               -- info was received about channel
 | 
					    'ChanInfo',               -- info was received about channel
 | 
				
			||||||
 | 
					    'ChanOpen',               -- channel was opened
 | 
				
			||||||
    'CmdLineEnter',           -- after entering cmdline mode
 | 
					    'CmdLineEnter',           -- after entering cmdline mode
 | 
				
			||||||
    'CmdLineLeave',           -- before leaving cmdline mode
 | 
					    'CmdLineLeave',           -- before leaving cmdline mode
 | 
				
			||||||
    'CmdUndefined',           -- command undefined
 | 
					    'CmdUndefined',           -- command undefined
 | 
				
			||||||
@@ -99,9 +99,9 @@ return {
 | 
				
			|||||||
    'VimResized',             -- after Vim window was resized
 | 
					    'VimResized',             -- after Vim window was resized
 | 
				
			||||||
    'VimResume',              -- after Nvim is resumed
 | 
					    'VimResume',              -- after Nvim is resumed
 | 
				
			||||||
    'VimSuspend',             -- before Nvim is suspended
 | 
					    'VimSuspend',             -- before Nvim is suspended
 | 
				
			||||||
    'WinNew',                 -- when entering a new window
 | 
					 | 
				
			||||||
    'WinEnter',               -- after entering a window
 | 
					    'WinEnter',               -- after entering a window
 | 
				
			||||||
    'WinLeave',               -- before leaving a window
 | 
					    'WinLeave',               -- before leaving a window
 | 
				
			||||||
 | 
					    'WinNew',                 -- when entering a new window
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  aliases = {
 | 
					  aliases = {
 | 
				
			||||||
    BufCreate = 'BufAdd',
 | 
					    BufCreate = 'BufAdd',
 | 
				
			||||||
@@ -109,9 +109,9 @@ return {
 | 
				
			|||||||
    BufWrite = 'BufWritePre',
 | 
					    BufWrite = 'BufWritePre',
 | 
				
			||||||
    FileEncoding = 'EncodingChanged',
 | 
					    FileEncoding = 'EncodingChanged',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  -- List of neovim-specific events or aliases for the purpose of generating 
 | 
					  -- List of nvim-specific events or aliases for the purpose of generating
 | 
				
			||||||
  -- syntax file
 | 
					  -- syntax file
 | 
				
			||||||
  neovim_specific = {
 | 
					  nvim_specific = {
 | 
				
			||||||
    DirChanged=true,
 | 
					    DirChanged=true,
 | 
				
			||||||
    TabClosed=true,
 | 
					    TabClosed=true,
 | 
				
			||||||
    TabNew=true,
 | 
					    TabNew=true,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -396,15 +396,14 @@ describe("'scrollback' option", function()
 | 
				
			|||||||
  it('set to 0 behaves as 1', function()
 | 
					  it('set to 0 behaves as 1', function()
 | 
				
			||||||
    local screen
 | 
					    local screen
 | 
				
			||||||
    if iswin() then
 | 
					    if iswin() then
 | 
				
			||||||
      screen = thelpers.screen_setup(nil,
 | 
					      screen = thelpers.screen_setup(nil, "['cmd.exe']", 30)
 | 
				
			||||||
      "['powershell.exe', '-NoLogo', '-NoProfile', '-NoExit', '-Command', 'function global:prompt {return "..'"$"'.."}']", 30)
 | 
					 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      screen = thelpers.screen_setup(nil, "['sh']", 30)
 | 
					      screen = thelpers.screen_setup(nil, "['sh']", 30)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    curbufmeths.set_option('scrollback', 0)
 | 
					    curbufmeths.set_option('scrollback', 0)
 | 
				
			||||||
    if iswin() then
 | 
					    if iswin() then
 | 
				
			||||||
      feed_data('for($i=1;$i -le 30;$i++){Write-Host \"line$i\"}\r')
 | 
					      feed_data('for /L %I in (1,1,30) do @(echo line%I)\r')
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
 | 
					      feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -417,8 +416,8 @@ describe("'scrollback' option", function()
 | 
				
			|||||||
  it('deletes lines (only) if necessary', function()
 | 
					  it('deletes lines (only) if necessary', function()
 | 
				
			||||||
    local screen
 | 
					    local screen
 | 
				
			||||||
    if iswin() then
 | 
					    if iswin() then
 | 
				
			||||||
      screen = thelpers.screen_setup(nil,
 | 
					      command([[let $PROMPT='$$']])
 | 
				
			||||||
      "['powershell.exe', '-NoLogo', '-NoProfile', '-NoExit', '-Command', 'function global:prompt {return "..'"$"'.."}']", 30)
 | 
					      screen = thelpers.screen_setup(nil, "['cmd.exe']", 30)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      screen = thelpers.screen_setup(nil, "['sh']", 30)
 | 
					      screen = thelpers.screen_setup(nil, "['sh']", 30)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -429,7 +428,7 @@ describe("'scrollback' option", function()
 | 
				
			|||||||
    screen:expect{any='%$'}
 | 
					    screen:expect{any='%$'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if iswin() then
 | 
					    if iswin() then
 | 
				
			||||||
      feed_data('for($i=1;$i -le 30;$i++){Write-Host \"line$i\"}\r')
 | 
					      feed_data('for /L %I in (1,1,30) do @(echo line%I)\r')
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
 | 
					      feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -446,7 +445,7 @@ describe("'scrollback' option", function()
 | 
				
			|||||||
    -- 'scrollback' option is synchronized with the internal sb_buffer.
 | 
					    -- 'scrollback' option is synchronized with the internal sb_buffer.
 | 
				
			||||||
    command('sleep 100m')
 | 
					    command('sleep 100m')
 | 
				
			||||||
    if iswin() then
 | 
					    if iswin() then
 | 
				
			||||||
      feed_data('for($i=1;$i -le 40;$i++){Write-Host \"line$i\"}\r')
 | 
					      feed_data('for /L %I in (1,1,40) do @(echo line%I)\r')
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      feed_data('for i in $(seq 1 40); do echo "line$i"; done\n')
 | 
					      feed_data('for i in $(seq 1 40); do echo "line$i"; done\n')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -455,8 +454,8 @@ describe("'scrollback' option", function()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    retry(nil, nil, function() expect_lines(58) end)
 | 
					    retry(nil, nil, function() expect_lines(58) end)
 | 
				
			||||||
    -- Verify off-screen state
 | 
					    -- Verify off-screen state
 | 
				
			||||||
    eq('line35', eval("getline(line('w0') - 1)"))
 | 
					    eq((iswin() and 'line36' or 'line35'), eval("getline(line('w0') - 1)"))
 | 
				
			||||||
    eq('line26', eval("getline(line('w0') - 10)"))
 | 
					    eq((iswin() and 'line27' or 'line26'), eval("getline(line('w0') - 10)"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    screen:detach()
 | 
					    screen:detach()
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user