Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Erlang.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3765,7 +3765,7 @@
<key>type-directive</key>
<dict>
<key>begin</key>
<string>^\s*+(-)\s*+(type|opaque|spec|callback)(?![a-zA-Z\d@_])\s*+(\(?)</string>
<string>^\s*+(-)\s*+(type|opaque|nominal|spec|callback)(?![a-zA-Z\d@_])\s*+(\(?)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
Expand All @@ -3787,7 +3787,7 @@
<key>comment</key>
<string>Directive carrying types; meta.type.erlang marks the region where the function type rule is injected</string>
<key>end</key>
<string>(\)?)\s*+(\.)</string>
<string>(\)?)\s*+(\.)(?=\s|%|$)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
Expand Down
26 changes: 26 additions & 0 deletions tests/fun_expression.erl
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,29 @@ h() -> fun ((X)) -> X end.

-callback cb() -> fun((a) -> b).
% ^^^ source.erlang meta.directive.erlang meta.type.erlang entity.name.function.erlang

%% A range at the top level of a type does not end the type region: only a dot
%% followed by whitespace, a comment or the end of the line ends the form.
-type ranged_fun() :: 1..10 | fun(() -> ok).
% ^^^ source.erlang meta.directive.erlang meta.type.erlang entity.name.function.erlang
% ^ source.erlang meta.directive.erlang meta.type.erlang punctuation.section.directive.end.erlang

-spec ranged_spec(X, Y) -> ok when X :: 0..255, Y :: fun(() -> ok).
% ^^^ source.erlang meta.directive.erlang meta.type.erlang entity.name.function.erlang
ranged_spec(_, _) -> ok.
%<----------- source.erlang meta.function.erlang entity.name.function.definition.erlang

-type ranged_fun_commented() :: 1..10 | fun(() -> ok).% comment
% ^^^ source.erlang meta.directive.erlang meta.type.erlang entity.name.function.erlang
% ^ source.erlang meta.directive.erlang meta.type.erlang punctuation.section.directive.end.erlang

k() -> ok.
%<- source.erlang meta.function.erlang entity.name.function.definition.erlang

%% Nominal types (OTP 28) carry types too.
-nominal nominal_fun() :: fun(() -> ok).
%^^^^^^^ source.erlang meta.directive.erlang meta.type.erlang keyword.control.directive.erlang
% ^^^ source.erlang meta.directive.erlang meta.type.erlang entity.name.function.erlang

l() -> ok.
%<- source.erlang meta.function.erlang entity.name.function.definition.erlang
Loading