File tree Expand file tree Collapse file tree 3 files changed +23
-15
lines changed
debug_adapter/lib/debug_adapter
language_server/lib/language_server/providers Expand file tree Collapse file tree 3 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -2059,17 +2059,26 @@ defmodule ElixirLS.DebugAdapter.Server do
2059
2059
2060
2060
for line <- lines do
2061
2061
env = ElixirSense.Core.Metadata . get_env ( metadata , { line |> elem ( 0 ) , 1 } )
2062
- metadata_modules = Enum . filter ( env . module_variants , & ( & 1 != Elixir ) )
2062
+ metadata_module = env . module
2063
2063
2064
2064
modules_to_break =
2065
- if metadata_modules != [ ] and
2066
- Enum . all? ( metadata_modules , & ( & 1 in loaded_modules_from_path ) ) do
2067
- # prefer metadata modules if valid and loaded
2068
- metadata_modules
2069
- else
2070
- # fall back to all loaded modules from file
2071
- # this may create breakpoints outside module line range
2072
- loaded_modules_from_path
2065
+ cond do
2066
+ metadata_module != nil and metadata_module in loaded_modules_from_path and
2067
+ env . protocol == nil ->
2068
+ # prefer metadata modules if valid and loaded
2069
+ [ metadata_module ]
2070
+
2071
+ env . protocol != nil ->
2072
+ { protocol , implementations } = env . protocol
2073
+
2074
+ for implementation <- implementations do
2075
+ Module . concat ( protocol , implementation )
2076
+ end
2077
+
2078
+ true ->
2079
+ # fall back to all loaded modules from file
2080
+ # this may create breakpoints outside module line range
2081
+ loaded_modules_from_path
2073
2082
end
2074
2083
2075
2084
set_breakpoint ( modules_to_break , path , line )
Original file line number Diff line number Diff line change @@ -159,9 +159,8 @@ defmodule ElixirLS.LanguageServer.Providers.Implementation.Locator do
159
159
metadata_implementations =
160
160
for { _ , env } <- metadata . lines_to_env ,
161
161
behaviour in env . behaviours ,
162
- module <- env . module_variants ,
163
162
uniq: true ,
164
- do: module
163
+ do: env . module
165
164
166
165
metadata_implementations_locations =
167
166
metadata_implementations
Original file line number Diff line number Diff line change @@ -34,13 +34,13 @@ defmodule ElixirLS.LanguageServer.Providers.References.Locator do
34
34
35
35
env =
36
36
% State.Env {
37
- module_variants: module_variants
37
+ module: module
38
38
} =
39
39
Metadata . get_env ( metadata , { line , column } )
40
40
|> Metadata . add_scope_vars ( metadata , { line , column } )
41
41
42
42
# find last env of current module
43
- attributes = get_attributes ( metadata , module_variants )
43
+ attributes = get_attributes ( metadata , module )
44
44
45
45
# one line can contain variables from many scopes
46
46
# if the cursor is over variable take variables from the scope as it will
@@ -72,9 +72,9 @@ defmodule ElixirLS.LanguageServer.Providers.References.Locator do
72
72
end
73
73
end
74
74
75
- defp get_attributes ( _metadata , [ ] ) , do: [ ]
75
+ defp get_attributes ( _metadata , nil ) , do: [ ]
76
76
77
- defp get_attributes ( metadata , [ module | _ ] ) do
77
+ defp get_attributes ( metadata , module ) do
78
78
% State.Env { attributes: attributes } = Metadata . get_last_module_env ( metadata , module )
79
79
80
80
attributes
You can’t perform that action at this time.
0 commit comments