summaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-03-04 09:15:44 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2019-03-04 09:15:44 +0100
commited677c34d55a0e025b7008f29419498a3989cde2 (patch)
tree62efef78ed05b2b4e61efb21e40a6b337359eb8e /autoload
parentc161994e9607399a7b365ab274592bfc4f100306 (diff)
downloadvim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.tar.gz
vim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.zip
Update
Diffstat (limited to 'autoload')
-rw-r--r--autoload/RstFold.vim14
-rw-r--r--autoload/elixir/indent.vim2
-rw-r--r--autoload/go/config.vim10
-rw-r--r--autoload/rubycomplete.vim66
-rw-r--r--autoload/rust.vim59
5 files changed, 112 insertions, 39 deletions
diff --git a/autoload/RstFold.vim b/autoload/RstFold.vim
index 558fe464..2d802842 100644
--- a/autoload/RstFold.vim
+++ b/autoload/RstFold.vim
@@ -2,9 +2,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
" Author: Antony Lee <anntzer.lee@gmail.com>
" Description: Helper functions for reStructuredText syntax folding
-" Last Modified: 2018-01-07
+" Last Modified: 2018-12-29
function s:CacheRstFold()
+ if !g:rst_fold_enabled
+ return
+ endif
+
let closure = {'header_types': {}, 'max_level': 0, 'levels': {}}
function closure.Process(match) dict
let curline = getcurpos()[1]
@@ -30,6 +34,10 @@ function s:CacheRstFold()
endfunction
function RstFold#GetRstFold()
+ if !g:rst_fold_enabled
+ return
+ endif
+
if !has_key(b:, 'RstFoldCache')
call s:CacheRstFold()
endif
@@ -41,6 +49,10 @@ function RstFold#GetRstFold()
endfunction
function RstFold#GetRstFoldText()
+ if !g:rst_fold_enabled
+ return
+ endif
+
if !has_key(b:, 'RstFoldCache')
call s:CacheRstFold()
endif
diff --git a/autoload/elixir/indent.vim b/autoload/elixir/indent.vim
index 20271ac5..4b5906e8 100644
--- a/autoload/elixir/indent.vim
+++ b/autoload/elixir/indent.vim
@@ -267,7 +267,7 @@ function! elixir#indent#handle_inside_block(context)
let config = {
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
- \'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after'), 'pattern_match_clauses': s:keyword('catch\|rescue')},
+ \'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after\|else'), 'pattern_match_clauses': s:keyword('catch\|rescue\|else')},
\'r': {'aligned_clauses': s:keyword('end\|after'), 'pattern_match_clauses': s:keyword('after')},
\'i': {'aligned_clauses': s:keyword('end\|else'), 'pattern_match_clauses': never_match},
\'[': {'aligned_clauses': ']', 'pattern_match_clauses': never_match},
diff --git a/autoload/go/config.vim b/autoload/go/config.vim
index 97cb3630..3020ee7e 100644
--- a/autoload/go/config.vim
+++ b/autoload/go/config.vim
@@ -390,8 +390,9 @@ function! go#config#HighlightFunctions() abort
return get(g:, 'go_highlight_functions', 0)
endfunction
-function! go#config#HighlightFunctionArguments() abort
- return get(g:, 'go_highlight_function_arguments', 0)
+function! go#config#HighlightFunctionParameters() abort
+ " fallback to highlight_function_arguments for backwards compatibility
+ return get(g:, 'go_highlight_function_parameters', get(g:, 'go_highlight_function_arguments', 0))
endfunction
function! go#config#HighlightFunctionCalls() abort
@@ -441,6 +442,11 @@ function! go#config#FoldEnable(...) abort
return get(g:, 'go_fold_enable', ['block', 'import', 'varconst', 'package_comment'])
endfunction
+function! go#config#EchoGoInfo() abort
+ return get(g:, "go_echo_go_info", 1)
+endfunction
+
+
" Set the default value. A value of "1" is a shortcut for this, for
" compatibility reasons.
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim
index 88dfaadd..a7f3fc19 100644
--- a/autoload/rubycomplete.vim
+++ b/autoload/rubycomplete.vim
@@ -1,11 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
" Vim completion script
-" Language: Ruby
-" Maintainer: Mark Guzman <segfault@hasno.info>
-" URL: https://github.com/vim-ruby/vim-ruby
-" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Maintainer Version: 0.8.1
+" Language: Ruby
+" Maintainer: Mark Guzman <segfault@hasno.info>
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" ----------------------------------------------------------------------------
"
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
@@ -55,6 +54,23 @@ if !exists("g:rubycomplete_include_objectspace")
endif
" }}} configuration failsafe initialization
+" {{{ regex patterns
+
+" Regex that defines the start-match for the 'end' keyword.
+let s:end_start_regex =
+ \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
+ \ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' .
+ \ '\|\%(\K\k*[!?]\?\s\+\)\=def\):\@!\>' .
+ \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
+
+" Regex that defines the middle-match for the 'end' keyword.
+let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
+
+" Regex that defines the end-match for the 'end' keyword.
+let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
+
+" }}} regex patterns
+
" {{{ vim-side support functions
let s:rubycomplete_debug = 0
@@ -105,7 +121,7 @@ function! s:GetBufferRubyEntity( name, type, ... )
endif
let curpos = getpos(".")
- let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'W' )
+ let [enum,ecol] = searchpairpos( s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'W' )
call cursor(lastpos[1], lastpos[2])
if lnum > enum
@@ -130,19 +146,28 @@ function! s:IsPosInClassDef(pos)
return ret
endfunction
+function! s:IsInComment(pos)
+ let stack = synstack(a:pos[0], a:pos[1])
+ if !empty(stack)
+ return synIDattr(stack[0], 'name') =~ 'ruby\%(.*Comment\|Documentation\)'
+ else
+ return 0
+ endif
+endfunction
+
function! s:GetRubyVarType(v)
let stopline = 1
let vtp = ''
- let pos = getpos('.')
+ let curpos = getpos('.')
let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$'
let [lnum,lcol] = searchpos(sstr,'nb',stopline)
if lnum != 0 && lcol != 0
- call setpos('.',pos)
+ call setpos('.',curpos)
let str = getline(lnum)
let vtp = substitute(str,sstr,'\1','')
return vtp
endif
- call setpos('.',pos)
+ call setpos('.',curpos)
let ctors = '\(now\|new\|open\|get_instance'
if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1
let ctors = ctors.'\|find\|create'
@@ -152,9 +177,13 @@ function! s:GetRubyVarType(v)
let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)'
let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr
- let [lnum,lcol] = searchpos(sstr,'nb',stopline)
- if lnum != 0 && lcol != 0
- let str = matchstr(getline(lnum),fstr,lcol)
+ let pos = searchpos(sstr,'bW')
+ while pos != [0,0] && s:IsInComment(pos)
+ let pos = searchpos(sstr,'bW')
+ endwhile
+ if pos != [0,0]
+ let [lnum, col] = pos
+ let str = matchstr(getline(lnum),fstr,col)
let str = substitute(str,'^=\s*','','')
call setpos('.',pos)
@@ -176,7 +205,7 @@ function! s:GetRubyVarType(v)
end
return ''
endif
- call setpos('.',pos)
+ call setpos('.',curpos)
return ''
endfunction
@@ -673,11 +702,10 @@ class VimRubyCompletion
methods.delete_if { |c| c.match( /'/ ) }
end
- when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods
+ when /^::([A-Z][^:\.\(]*)?$/ # Absolute Constant or class methods
dprint "const or cls"
receiver = $1
- methods = Object.constants
- methods.grep(/^#{receiver}/).collect{|e| "::" + e}
+ methods = Object.constants.collect{ |c| c.to_s }.grep(/^#{receiver}/)
when /^(((::)?[A-Z][^:.\(]*)+?)::?([^:.]*)$/ # Constant or class methods
receiver = $1
@@ -686,13 +714,13 @@ class VimRubyCompletion
load_buffer_class( receiver )
load_buffer_module( receiver )
begin
- classes = eval("#{receiver}.constants")
- #methods = eval("#{receiver}.methods")
+ constants = eval("#{receiver}.constants").collect{ |c| c.to_s }.grep(/^#{message}/)
+ methods = eval("#{receiver}.methods").collect{ |m| m.to_s }.grep(/^#{message}/)
rescue Exception
dprint "exception: %s" % $!
+ constants = []
methods = []
end
- methods.grep(/^#{message}/).collect{|e| receiver + "::" + e}
when /^(:[^:.]+)\.([^.]*)$/ # Symbol
dprint "symbol"
diff --git a/autoload/rust.vim b/autoload/rust.vim
index 81f8c635..d5a2e29f 100644
--- a/autoload/rust.vim
+++ b/autoload/rust.vim
@@ -5,23 +5,59 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Last Modified: May 27, 2014
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
-" Jump {{{1
-
-function! rust#Load()
+function! rust#Load()
" Utility call to get this script loaded, for debugging
endfunction
function! rust#GetConfigVar(name, default)
" Local buffer variable with same name takes predeence over global
- if has_key(b:, a:name)
+ if has_key(b:, a:name)
return get(b:, a:name)
endif
- if has_key(g:, a:name)
+ if has_key(g:, a:name)
return get(g:, a:name)
endif
return a:default
endfunction
+" Include expression {{{1
+
+function! rust#IncludeExpr(fname) abort
+ " Remove leading 'crate::' to deal with 2018 edition style 'use'
+ " statements
+ let l:fname = substitute(a:fname, '^crate::', '', '')
+
+ " Remove trailing colons arising from lines like
+ "
+ " use foo::{Bar, Baz};
+ let l:fname = substitute(l:fname, ':\+$', '', '')
+
+ " Replace '::' with '/'
+ let l:fname = substitute(l:fname, '::', '/', 'g')
+
+ " When we have
+ "
+ " use foo::bar::baz;
+ "
+ " we can't tell whether baz is a module or a function; and we can't tell
+ " which modules correspond to files.
+ "
+ " So we work our way up, trying
+ "
+ " foo/bar/baz.rs
+ " foo/bar.rs
+ " foo.rs
+ while l:fname !=# '.'
+ let l:path = findfile(l:fname)
+ if !empty(l:path)
+ return l:fname
+ endif
+ let l:fname = fnamemodify(l:fname, ':h')
+ endwhile
+ return l:fname
+endfunction
+
+" Jump {{{1
function! rust#Jump(mode, function) range
let cnt = v:count1
@@ -487,14 +523,6 @@ function! rust#Test(all, options) abort
return
endif
- let mod_name = expand('%:t:r')
- if mod_name ==# ''
- echohl ErrorMsg
- echo 'Cannot extract a module name from file name. Please add ! to command if you want to run all tests'
- echohl None
- return
- endif
-
let saved = getpos('.')
try
let func_name = s:SearchTestFunctionNameUnderCursor()
@@ -504,11 +532,10 @@ function! rust#Test(all, options) abort
echohl None
return
endif
- let spec = mod_name . '::' . func_name
if a:options ==# ''
- execute cmd . 'cargo test --manifest-path' manifest spec
+ execute cmd . 'cargo test --manifest-path' manifest func_name
else
- execute cmd . 'cargo test --manifest-path' manifest spec a:options
+ execute cmd . 'cargo test --manifest-path' manifest func_name a:options
endif
return
finally