-
Notifications
You must be signed in to change notification settings - Fork 155
Add syntax highlight to function calls #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
30bd139
9f5b45b
1ec533d
1dea960
304b4d7
46d028e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
describe 'function syntax' do | ||
it 'doesnt treat underscored functions like unsued variables' do | ||
expect(<<~EOF).to include_elixir_syntax('elixirId', '__ensure_defimpl__') | ||
expect(<<~EOF).to include_elixir_syntax('elixirFunctionCall', '__ensure_defimpl__') | ||
defp derive(protocol, for, struct, opts, env) do | ||
# ... code ... | ||
__ensure_defimpl__(protocol, for, env) | ||
|
@@ -17,4 +17,102 @@ | |
__ensure_defimpl__(protocol, for, env) | ||
EOF | ||
end | ||
|
||
it 'detects higher order function calls' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func.() | ||
EOF | ||
end | ||
|
||
it 'detects function calls with parenthesis' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func() | ||
EOF | ||
end | ||
|
||
it 'detects function calls with bangs' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func!') | ||
func!() | ||
EOF | ||
end | ||
|
||
it 'detects function calls with question marks' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func?') | ||
func?() | ||
EOF | ||
end | ||
|
||
it 'detects function calls appended by module with parenthesis' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
Mod.func() | ||
EOF | ||
end | ||
|
||
it 'detects function calls appended by atom with parenthesis' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
:mod.func() | ||
EOF | ||
end | ||
|
||
it 'detects function calls appended by module without parenthesis' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
Mod.func | ||
EOF | ||
end | ||
|
||
it 'detects function calls appended by atom without parenthesis' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
:mod.func | ||
EOF | ||
end | ||
|
||
it 'detects function calls without parenthesis that contain paramenters' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func 1 | ||
EOF | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func [1] | ||
EOF | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func :atom | ||
EOF | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func "string" | ||
EOF | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func 'a' | ||
EOF | ||
end | ||
|
||
it 'does not highlight function calls without parenthesis that does not contain paramenters' do | ||
expect(<<~'EOF').not_to include_elixir_syntax('elixirFunctionCall', 'func') | ||
func | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to confess I completely forgot we could use atoms as module names. Just pushed a commit to fix that. Also, while at it I realised |
||
EOF | ||
end | ||
|
||
it 'does not detect calls to function with invalid names' do | ||
expect(<<~'EOF').not_to include_elixir_syntax('elixirFunctionCall', '2fast2func') | ||
2fast2func() | ||
EOF | ||
end | ||
|
||
it 'ignores spacing between module and function names' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
Module . func | ||
EOF | ||
end | ||
|
||
it 'detects piped functions with parenthesis' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
one_func() | ||
|> func() | ||
EOF | ||
end | ||
|
||
it 'detects piped functions without parenthesis' do | ||
expect(<<~'EOF').to include_elixir_syntax('elixirFunctionCall', 'func') | ||
one_func() | ||
|> func | ||
EOF | ||
end | ||
end |
Uh oh!
There was an error while loading. Please reload this page.