From c299b5da60071b02258c2e5e342b2b76688c5b9e Mon Sep 17 00:00:00 2001 From: Lukasz Samson Date: Thu, 2 Nov 2023 14:29:15 +0100 Subject: [PATCH] check against dev version quite a lot of people run on unreleased versions --- lib/elixir_sense/core/introspection.ex | 2 +- lib/elixir_sense/core/metadata_builder.ex | 2 +- .../core/normalized/code/cursor_context.ex | 2 +- .../providers/suggestion/complete.ex | 24 ++++++++++++++++--- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/elixir_sense/core/introspection.ex b/lib/elixir_sense/core/introspection.ex index 3ddb95c4..7f32ae53 100644 --- a/lib/elixir_sense/core/introspection.ex +++ b/lib/elixir_sense/core/introspection.ex @@ -1201,7 +1201,7 @@ defmodule ElixirSense.Core.Introspection do true {:behaviour_info, {1, :function}} -> - if Version.match?(System.version(), ">= 1.15.0") do + if Version.match?(System.version(), ">= 1.15.0-dev") do true else # elixir < 1.15 imports behaviour_info from erlang behaviours diff --git a/lib/elixir_sense/core/metadata_builder.ex b/lib/elixir_sense/core/metadata_builder.ex index b0f18d2b..1f8128dc 100644 --- a/lib/elixir_sense/core/metadata_builder.ex +++ b/lib/elixir_sense/core/metadata_builder.ex @@ -1076,7 +1076,7 @@ defmodule ElixirSense.Core.MetadataBuilder do # it's only legal inside typespecs # credo:disable-for-next-line if not Keyword.get(meta, :no_call, false) and - (Version.match?(System.version(), "< 1.15.0") or + (Version.match?(System.version(), "< 1.15.0-dev") or match?([[{:typespec, _, _} | _] | _], state.scopes)) do add_call_to_line(state, {nil, var_or_call, 0}, {line, column}) else diff --git a/lib/elixir_sense/core/normalized/code/cursor_context.ex b/lib/elixir_sense/core/normalized/code/cursor_context.ex index d81f3dee..d117337c 100644 --- a/lib/elixir_sense/core/normalized/code/cursor_context.ex +++ b/lib/elixir_sense/core/normalized/code/cursor_context.ex @@ -6,7 +6,7 @@ defmodule ElixirSense.Core.Normalized.Code.CursorContext do # credo:disable-for-lines:10 def cursor_context(binary, opts) do cond do - Version.match?(System.version(), ">= 1.13.0") -> + Version.match?(System.version(), ">= 1.13.0-dev") -> apply(Code.Fragment, :cursor_context, [binary, opts]) true -> diff --git a/lib/elixir_sense/providers/suggestion/complete.ex b/lib/elixir_sense/providers/suggestion/complete.ex index 6dbc5df7..2cecc084 100644 --- a/lib/elixir_sense/providers/suggestion/complete.ex +++ b/lib/elixir_sense/providers/suggestion/complete.ex @@ -91,10 +91,28 @@ defmodule ElixirSense.Providers.Suggestion.Complete do expand_erlang_modules(List.to_string(unquoted_atom), env, metadata) {:dot, path, hint} -> - expand_dot(path, List.to_string(hint), false, env, metadata, cursor_position, only_structs, opts) + expand_dot( + path, + List.to_string(hint), + false, + env, + metadata, + cursor_position, + only_structs, + opts + ) {:dot_arity, path, hint} -> - expand_dot(path, List.to_string(hint), true, env, metadata, cursor_position, only_structs, opts) + expand_dot( + path, + List.to_string(hint), + true, + env, + metadata, + cursor_position, + only_structs, + opts + ) {:dot_call, _path, _hint} -> # no need to expand signatures here, we have signatures provider @@ -730,7 +748,7 @@ defmodule ElixirSense.Providers.Suggestion.Complete do # Conversion to atom is not a problem because # it is only called with existing modules names. # credo:disable-for-lines:7 - if Version.match?(System.version(), ">= 1.14.0") do + if Version.match?(System.version(), ">= 1.14.0-dev") do apply(Macro, :classify_atom, [String.to_atom(name)]) in [:identifier, :unquoted] and not String.starts_with?(name, "Elixir.") else