Skip to content

Commit eb06df6

Browse files
William Sanchesjbodah
William Sanches
authored andcommitted
Fix highlight for atoms containing @ character
1 parent e9d495b commit eb06df6

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Diff for: spec/syntax/atom_spec.rb

+15
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,19 @@ def project do
8888
end
8989
EOF
9090
end
91+
92+
it 'detects atoms containing @ in it' do
93+
expect(<<~EOF).to include_elixir_syntax('elixirAtom', '@somewhere')
94+
:atom@somewhere
95+
EOF
96+
expect(<<~EOF).to include_elixir_syntax('elixirAtom', '@somewhere')
97+
[atom@somewhere: nil]
98+
EOF
99+
end
100+
101+
it 'detects atoms containing Unicode letters in it' do
102+
expect(<<~EOF).to include_elixir_syntax('elixirAtom', 'ó')
103+
:atóm
104+
EOF
105+
end
91106
end

Diff for: syntax/elixir.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ syn match elixirOperator '\\\\\|::\|\*\|/\|\~\~\~\|@'
4141

4242
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*'
4343

44-
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
44+
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\%(\w\|@\|\P\)*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
4545
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
46-
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
46+
syn match elixirAtom "\%([a-zA-Z_]\%(\w\|@\|\P\)*[?!]\?\):\(:\)\@!"
4747

4848
syn keyword elixirBoolean true false nil
4949

0 commit comments

Comments
 (0)