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