vim-patch:d08059ab48b8

runtime(ruby): Update ftplugin and omni-complete (vim/vim#13805)

d08059ab48

Co-authored-by: dkearns <dougkearns@gmail.com>
This commit is contained in:
Christian Clason 2024-01-01 19:33:16 +01:00
parent 3299797150
commit 99f1530a4f
2 changed files with 25 additions and 26 deletions

View File

@ -2,8 +2,7 @@
" Language: Ruby " Language: Ruby
" Maintainer: Mark Guzman <segfault@hasno.info> " Maintainer: Mark Guzman <segfault@hasno.info>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Last Change: 2023 Dec 31
" Last Change: 2020 Apr 12
" ---------------------------------------------------------------------------- " ----------------------------------------------------------------------------
" "
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
@ -490,7 +489,7 @@ class VimRubyCompletion
trail = "%s%s" % [ dir, sub ] trail = "%s%s" % [ dir, sub ]
tcfg = "%sconfig" % trail tcfg = "%sconfig" % trail
if File.exists?( tcfg ) if File.exist?( tcfg )
rails_base = trail rails_base = trail
break break
end end
@ -503,7 +502,7 @@ class VimRubyCompletion
bootfile = rails_base + "config/boot.rb" bootfile = rails_base + "config/boot.rb"
envfile = rails_base + "config/environment.rb" envfile = rails_base + "config/environment.rb"
if File.exists?( bootfile ) && File.exists?( envfile ) if File.exist?( bootfile ) && File.exist?( envfile )
begin begin
require bootfile require bootfile
require envfile require envfile

View File

@ -2,8 +2,7 @@
" Language: Ruby " Language: Ruby
" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Last Change: 2023 Dec 31
" Last Change: 2023 Sep 1st
if (exists("b:did_ftplugin")) if (exists("b:did_ftplugin"))
finish finish
@ -60,35 +59,38 @@ if !exists('g:ruby_version_paths')
let g:ruby_version_paths = {} let g:ruby_version_paths = {}
endif endif
let s:path_split = has('win32') ? ';' : ':'
function! s:query_path(root) abort function! s:query_path(root) abort
" Disabled by default for security reasons. " Disabled by default for security reasons.
if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) || empty(a:root)
return [] return map(split($RUBYLIB, s:path_split), 'v:val ==# "." ? "" : v:val')
endif endif
let code = "print $:.join %q{,}" let code = "print $:.join %q{,}"
if &shell =~# 'sh' && empty(&shellxquote)
let prefix = 'env PATH='.shellescape($PATH).' '
else
let prefix = ''
endif
if &shellxquote == "'" if &shellxquote == "'"
let path_check = prefix.'ruby --disable-gems -e "' . code . '"' let args = ' --disable-gems -e "' . code . '"'
else else
let path_check = prefix."ruby --disable-gems -e '" . code . "'" let args = " --disable-gems -e '" . code . "'"
endif endif
let cd = haslocaldir() ? 'lcd' : 'cd' let cd = haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd'
let cwd = fnameescape(getcwd()) let cwd = fnameescape(getcwd())
try try
exe cd fnameescape(a:root) exe cd fnameescape(a:root)
let s:tmp_cwd = getcwd() for dir in split($PATH, s:path_split)
if (fnamemodify(exepath('ruby'), ':p:h') ==# cwd if dir !=# '.' && executable(dir . '/ruby') == 1
\ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.')) let exepath = dir . '/ruby'
let path = [] break
endif
endfor
if exists('l:exepath')
let path = split(system(exepath . args),',')
if v:shell_error
let path = []
endif
else else
let path = split(system(path_check),',') let path = []
endif endif
unlet! s:tmp_cwd
exe cd cwd exe cd cwd
return path return path
finally finally
@ -129,10 +131,8 @@ else
if !exists('g:ruby_default_path') if !exists('g:ruby_default_path')
if has("ruby") && has("win32") if has("ruby") && has("win32")
ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) ) ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) )
elseif executable('ruby') && !empty($HOME)
let g:ruby_default_path = s:query_path($HOME)
else else
let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val') let g:ruby_default_path = s:query_path($HOME)
endif endif
endif endif
let s:ruby_paths = g:ruby_default_path let s:ruby_paths = g:ruby_default_path