Skip to content

Commit aa8bca6

Browse files
committed
label operator completions
do not label all kernel macros as keywords
1 parent 530e58c commit aa8bca6

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

apps/language_server/lib/language_server/providers/completion.ex

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,29 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
8787
"ExUnit.Assertions"
8888
])
8989

90+
@operators ~w(
91+
@
92+
.
93+
+ - ! ^ not
94+
**
95+
* /
96+
+ -
97+
++ -- +++ --- .. <>
98+
in not in
99+
|> <<< >>> <<~ ~>> <~ ~> <~>
100+
< > <= >=
101+
== != =~ === !==
102+
&& &&& and
103+
|| ||| or
104+
=
105+
&
106+
=>
107+
|
108+
::
109+
when
110+
<- \\\\
111+
)
112+
90113
def trigger_characters do
91114
# VS Code's 24x7 autocompletion triggers automatically on alphanumeric characters. We add these
92115
# for "SomeModule." calls, @module_attrs, function capture, variable pinning, erlang module calls,
@@ -831,8 +854,8 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
831854
completion = function_completion(item, context, options)
832855

833856
completion =
834-
if origin == "Kernel" || origin == "Kernel.SpecialForms" do
835-
%__MODULE__{completion | kind: :keyword, priority: 18}
857+
if name in @operators do
858+
%__MODULE__{completion | kind: :operator}
836859
else
837860
completion
838861
end

0 commit comments

Comments
 (0)