mirror of
https://github.com/amix/vimrc
synced 2025-06-17 19:35:00 +08:00
Added and updated some plugins
Added: vim-ruby, typescript-vim, vim-javascript Updated: rust-vim
This commit is contained in:
17
sources_non_forked/vim-ruby/spec/syntax/blocks_spec.rb
Normal file
17
sources_non_forked/vim-ruby/spec/syntax/blocks_spec.rb
Normal file
@ -0,0 +1,17 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "block parameters" do
|
||||
assert_correct_highlighting <<~'EOF', 'bar', 'rubySymbol'
|
||||
foo { |bar:| 42 }
|
||||
EOF
|
||||
assert_correct_highlighting <<~'EOF', %w[bar\ze: baz\ze:], 'rubySymbol'
|
||||
foo { |bar: 'bar', baz: 'baz'| 42 }
|
||||
EOF
|
||||
end
|
||||
specify "block parameters with default values including '|'" do
|
||||
assert_correct_highlighting <<~'EOF', %w[|\zebar qux)\zs|], 'rubyBlockParameterList'
|
||||
foo { |bar=(baz|qux)| 42 }
|
||||
EOF
|
||||
end
|
||||
end
|
BIN
sources_non_forked/vim-ruby/spec/syntax/characters_spec.rb
Normal file
BIN
sources_non_forked/vim-ruby/spec/syntax/characters_spec.rb
Normal file
Binary file not shown.
54
sources_non_forked/vim-ruby/spec/syntax/comments_spec.rb
Normal file
54
sources_non_forked/vim-ruby/spec/syntax/comments_spec.rb
Normal file
@ -0,0 +1,54 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "single line comments" do
|
||||
assert_correct_highlighting <<~'EOF', '#.*', 'rubyComment'
|
||||
# comment line
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "end of line comments" do
|
||||
assert_correct_highlighting <<~'EOF', '#.*', 'rubyComment'
|
||||
foo = 42 # comment
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "multiline comments" do
|
||||
assert_correct_highlighting <<~'EOF', ['#.*line 1', '#.*line 2'], 'rubyComment'
|
||||
# comment line 1
|
||||
# comment line 2
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "embedded documentation" do
|
||||
assert_correct_highlighting <<~'EOF', 'documentation.*', 'rubyDocumentation'
|
||||
=begin
|
||||
documentation line
|
||||
=end
|
||||
EOF
|
||||
# See issue #3
|
||||
assert_correct_highlighting <<~'EOF', 'documentation.*', 'rubyDocumentation'
|
||||
=begin rdoc
|
||||
documentation line
|
||||
=end rdoc
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "magic comments" do
|
||||
assert_correct_highlighting <<~'EOF', 'frozen_string_literal', 'rubyMagicComment'
|
||||
# frozen_string_literal: true
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "TODO comments" do
|
||||
assert_correct_highlighting <<~'EOF', 'TODO', 'rubyTodo'
|
||||
# TODO: turn off the oven
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "shebang comments" do
|
||||
assert_correct_highlighting <<~'EOF', '#.*', 'rubySharpBang'
|
||||
#!/bin/ruby
|
||||
EOF
|
||||
end
|
||||
end
|
@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "useless line continuations" do
|
||||
str = <<~'EOF'
|
||||
foo = \
|
||||
if true
|
||||
42
|
||||
end
|
||||
EOF
|
||||
assert_correct_highlighting str, '\\', 'rubyUselessLineContinuation'
|
||||
assert_correct_highlighting str, 'if', 'rubyConditional'
|
||||
end
|
||||
|
||||
specify "line continuations" do
|
||||
str = <<~'EOF'
|
||||
foo = 42 \
|
||||
if true
|
||||
EOF
|
||||
assert_correct_highlighting str, '\\', 'rubyLineContinuation'
|
||||
assert_correct_highlighting str, 'if', 'rubyConditionalModifier'
|
||||
end
|
||||
end
|
36
sources_non_forked/vim-ruby/spec/syntax/methods_spec.rb
Normal file
36
sources_non_forked/vim-ruby/spec/syntax/methods_spec.rb
Normal file
@ -0,0 +1,36 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "method definitions" do
|
||||
str = <<~'EOF'
|
||||
def foo bar
|
||||
end
|
||||
EOF
|
||||
assert_correct_highlighting str, %w[def end], 'rubyDefine'
|
||||
assert_correct_highlighting str, 'foo', 'rubyMethodName'
|
||||
end
|
||||
|
||||
specify "method definitions named 'end'" do
|
||||
assert_correct_highlighting <<~'EOF', 'end', 'rubyMethodName'
|
||||
def end end
|
||||
EOF
|
||||
assert_correct_highlighting <<~'EOF', 'end', 'rubyMethodName'
|
||||
def
|
||||
end
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "method parameters with symbol default values" do
|
||||
assert_correct_highlighting <<~'EOF', ':baz', 'rubySymbol'
|
||||
def foo bar=:baz
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "unparenthesised method parameters with a required trailing keyword then semicolon" do
|
||||
assert_correct_highlighting <<~'EOF', 'bar', 'rubySymbol'
|
||||
def foo bar:; end
|
||||
EOF
|
||||
end
|
||||
end
|
204
sources_non_forked/vim-ruby/spec/syntax/operators_spec.rb
Normal file
204
sources_non_forked/vim-ruby/spec/syntax/operators_spec.rb
Normal file
@ -0,0 +1,204 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
before :each do
|
||||
vim.command 'let g:ruby_operators = 1'
|
||||
end
|
||||
after :each do
|
||||
vim.command 'unlet g:ruby_operators'
|
||||
end
|
||||
|
||||
specify "defined? operator" do
|
||||
assert_correct_highlighting 'defined? foo', 'defined?', 'rubyDefinedOperator'
|
||||
end
|
||||
|
||||
specify "English boolean operators" do
|
||||
assert_correct_highlighting <<~'EOF', %w[not and or], 'rubyEnglishBooleanOperator'
|
||||
not true
|
||||
true and false
|
||||
true or false
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "modulo-assignment operators" do
|
||||
assert_correct_highlighting <<~'EOF', '%=', 'rubyAssignmentOperator'
|
||||
foo %= bar
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "ternary operators" do
|
||||
assert_correct_highlighting <<~'EOF', %w[? :], 'rubyTernaryOperator'
|
||||
foo = bar ? 4 : 2
|
||||
EOF
|
||||
end
|
||||
|
||||
context "bracket operators" do
|
||||
specify "after a plain identifier" do
|
||||
assert_correct_highlighting <<~'EOF', '\\[..]', 'rubyOperator'
|
||||
foo[42]
|
||||
EOF
|
||||
end
|
||||
specify "after a ?!-named bare method call" do
|
||||
assert_correct_highlighting <<~'EOF', '\\[..]', 'rubyOperator'
|
||||
foo?[42]
|
||||
EOF
|
||||
end
|
||||
specify "after a closing parenthesis" do
|
||||
assert_correct_highlighting <<~'EOF', '\\[..]', 'rubyOperator'
|
||||
(foo)[42]
|
||||
EOF
|
||||
end
|
||||
specify "after a literal hash" do
|
||||
assert_correct_highlighting <<~'EOF', '\\[...]', 'rubyOperator'
|
||||
{ foo: bar }[foo]
|
||||
EOF
|
||||
end
|
||||
specify "after a block arg method call" do
|
||||
assert_correct_highlighting <<~'EOF', '\\[..]', 'rubyOperator'
|
||||
foo { bar }[42]
|
||||
EOF
|
||||
end
|
||||
end
|
||||
|
||||
specify "exponentiation operators" do
|
||||
[
|
||||
'foo**bar',
|
||||
'foo ** bar',
|
||||
'foo** bar',
|
||||
].each do |str|
|
||||
assert_correct_highlighting str, '\*\*', 'rubyArithmeticOperator'
|
||||
end
|
||||
end
|
||||
|
||||
context "double splat operators" do
|
||||
specify "in method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*\*', 'rubyDoubleSplatOperator'
|
||||
def foo(**bar)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in multiline parameter list method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*\*', 'rubyDoubleSplatOperator'
|
||||
def foo(bar,
|
||||
**baz)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "as an anonymous parameter in method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*\*', 'rubyDoubleSplatOperator'
|
||||
def foo(**)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in unparenthesised method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*\*', 'rubyDoubleSplatOperator'
|
||||
def foo **bar
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in unparenthesised method calls" do
|
||||
assert_correct_highlighting <<~'EOF', '\*\*', 'rubyDoubleSplatOperator'
|
||||
foo **bar
|
||||
EOF
|
||||
end
|
||||
specify "in block parameter lists" do
|
||||
assert_correct_highlighting <<~'EOF', '\*\*', 'rubyDoubleSplatOperator'
|
||||
foo { |**bar| 42 }
|
||||
EOF
|
||||
end
|
||||
end
|
||||
|
||||
specify "multiplication operators" do
|
||||
[
|
||||
'foo*bar',
|
||||
'foo * bar',
|
||||
'foo* bar',
|
||||
].each do |str|
|
||||
assert_correct_highlighting str, '\*', 'rubyArithmeticOperator'
|
||||
end
|
||||
end
|
||||
|
||||
context "splat operators" do
|
||||
specify "in method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*', 'rubySplatOperator'
|
||||
def foo(*bar)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in multiline parameter list method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*', 'rubySplatOperator'
|
||||
def foo(bar,
|
||||
*baz)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "as an anonymous parameter in method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*', 'rubySplatOperator'
|
||||
def foo(*)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in unparenthesised method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '\*', 'rubySplatOperator'
|
||||
def foo *bar
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in unparenthesised method calls" do
|
||||
assert_correct_highlighting <<~'EOF', '\*', 'rubySplatOperator'
|
||||
foo *bar
|
||||
EOF
|
||||
end
|
||||
specify "in block parameter lists" do
|
||||
assert_correct_highlighting <<~'EOF', '\*', 'rubySplatOperator'
|
||||
foo { |*bar| 42 }
|
||||
EOF
|
||||
end
|
||||
end
|
||||
|
||||
context "proc operators" do
|
||||
specify "in method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '&', 'rubyProcOperator'
|
||||
def foo(&bar)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in multiline parameter list method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '&', 'rubyProcOperator'
|
||||
def foo(bar,
|
||||
&baz)
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in unparenthesised method definitions" do
|
||||
assert_correct_highlighting <<~'EOF', '&', 'rubyProcOperator'
|
||||
def foo &bar
|
||||
end
|
||||
EOF
|
||||
end
|
||||
specify "in unparenthesised method calls" do
|
||||
assert_correct_highlighting <<~'EOF', '&', 'rubyProcOperator'
|
||||
foo &bar
|
||||
EOF
|
||||
end
|
||||
specify "before literal lambdas" do
|
||||
assert_correct_highlighting <<~'EOF', '&', 'rubyProcOperator'
|
||||
foo &->{}
|
||||
EOF
|
||||
end
|
||||
end
|
||||
|
||||
specify "eigenclass operators" do
|
||||
assert_correct_highlighting <<~'EOF', '<<', 'rubyEigenClassOperator'
|
||||
class << self
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "superclass operators" do
|
||||
assert_correct_highlighting <<~'EOF', '<', 'rubySuperClassOperator'
|
||||
class Foo < Bar
|
||||
end
|
||||
EOF
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
# See issue #171
|
||||
specify "ambiguous / at end of line is not a regexp" do
|
||||
vim.command 'let g:ruby_operators = 1'
|
||||
assert_correct_highlighting <<~'EOF', '/', 'rubyArithmeticOperator'
|
||||
a = calculate(90).and_some_long_expression /
|
||||
and_long_expression_here
|
||||
puts a
|
||||
EOF
|
||||
vim.command 'unlet g:ruby_operators'
|
||||
end
|
||||
|
||||
# See issue #63
|
||||
specify "interpolated regexp in a host regexp" do
|
||||
assert_correct_highlighting <<~'EOF', '/$', 'rubyRegexpDelimiter'
|
||||
/#{foo.sub(/bar/, 'baz')}/
|
||||
EOF
|
||||
end
|
||||
end
|
@ -0,0 +1,31 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "only modifiers can appear after regexp literals" do
|
||||
# See issue #254
|
||||
assert_correct_highlighting <<~'EOF', 'if', 'rubyConditionalModifier'
|
||||
def get_regex
|
||||
/some regex/ if false
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "only modifiers can appear after unparenthesised no-arg method calls" do
|
||||
[
|
||||
"foo if true",
|
||||
"foo? if true",
|
||||
"foo! if true",
|
||||
"foo_ if true",
|
||||
"foo_? if true",
|
||||
"foo_! if true",
|
||||
"foo42 if true",
|
||||
"foo42? if true",
|
||||
"foo42! if true",
|
||||
"Foo if true",
|
||||
"Foo? if true",
|
||||
"Foo! if true"
|
||||
].each do |str|
|
||||
assert_correct_highlighting str, 'if', 'rubyConditionalModifier'
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,26 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "heredocs starting after parenthesised method definitions" do
|
||||
# See issue #356
|
||||
assert_correct_highlighting <<~'EOF', 'HTML', 'rubyHeredocDelimiter'
|
||||
def youtube_video(token, width = 360, height = 215)
|
||||
<<-HTML if token
|
||||
<iframe width="#{width}" height="#{height}" src="http://www.youtube.com/embed/#{token}" frameborder="0" allowfullscreen></iframe>
|
||||
HTML
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "heredocs do not start after string literals" do
|
||||
assert_correct_highlighting <<~'EOF', 'FOO', 'rubyConstant'
|
||||
"abc" <<FOO
|
||||
EOF
|
||||
assert_correct_highlighting <<~'EOF', 'FOO', 'rubyConstant'
|
||||
'abc' <<FOO
|
||||
EOF
|
||||
assert_correct_highlighting <<~'EOF', 'FOO', 'rubyConstant'
|
||||
`abc` <<FOO
|
||||
EOF
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "invalid interpolated predefined global variables are literal text" do
|
||||
assert_correct_highlighting <<~'EOF', '#\$', 'rubyString'
|
||||
"abc(#$)def"
|
||||
EOF
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
specify "percent strings with a modulo-assignment operator look-alike delimiter" do
|
||||
assert_correct_highlighting <<~'EOF', '%=', 'rubyPercentStringDelimiter'
|
||||
foo = %= bar =
|
||||
EOF
|
||||
end
|
||||
end
|
45
sources_non_forked/vim-ruby/spec/syntax/symbols_spec.rb
Normal file
45
sources_non_forked/vim-ruby/spec/syntax/symbols_spec.rb
Normal file
@ -0,0 +1,45 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Syntax highlighting" do
|
||||
# See issue #356
|
||||
specify "hashes with symbol keys and values on different lines" do
|
||||
assert_correct_highlighting <<~'EOF', 'x', 'rubySymbol'
|
||||
h = {
|
||||
x:
|
||||
really_long_method_name,
|
||||
y: 5,
|
||||
}
|
||||
EOF
|
||||
end
|
||||
|
||||
# See issue #44
|
||||
specify "1.9 style hash keys with keyword names" do
|
||||
assert_correct_highlighting <<~EOF, %w[class if def include case end], 'rubySymbol'
|
||||
{ class: "hello", if: "world", def: "i am", include: "foo", case: "bar", end: "baz" }
|
||||
EOF
|
||||
|
||||
assert_correct_highlighting <<~'EOF', 'end', 'rubyDefine'
|
||||
def hello
|
||||
{ if: "world" }
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
# See issue #144
|
||||
specify "1.9 style hash keys with keyword names in parameter lists" do
|
||||
assert_correct_highlighting <<~'EOF', 'prepend', 'rubySymbol'
|
||||
{prepend: true}
|
||||
EOF
|
||||
assert_correct_highlighting <<~'EOF', 'for', 'rubySymbol'
|
||||
Subscription.generate(for: topic,
|
||||
to: subscriber)
|
||||
EOF
|
||||
end
|
||||
|
||||
# See issue #12
|
||||
specify "1.9 style hash keys with keyword names in argument lists" do
|
||||
assert_correct_highlighting <<~EOF, %w[:\zsgender in\ze: if\ze: :\zsgender_required?], 'rubySymbol'
|
||||
validates_inclusion_of :gender, in: %w(male female), if: :gender_required?
|
||||
EOF
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user