A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/elixir-lsp/elixir-ls/commit/3a94455f90927601d0d3bb46f837a4f3944c5ab9 below:

Fix callback suggestions (#359) · elixir-lsp/elixir-ls@3a94455 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+26

-23

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+26

-23

lines changed Original file line number Diff line number Diff line change

@@ -272,8 +272,8 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do

272 272

defp from_completion_item(

273 273

%{

274 274

type: :callback,

275 +

subtype: subtype,

275 276

args: args,

276 -

spec: spec,

277 277

name: name,

278 278

summary: summary,

279 279

arity: arity,

@@ -283,13 +283,13 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do

283 283

context,

284 284

options

285 285

) do

286 -

if (context[:def_before] == :def && String.starts_with?(spec, "@macrocallback")) ||

287 -

(context[:def_before] == :defmacro && String.starts_with?(spec, "@callback")) do

286 +

if (context[:def_before] == :def && subtype == :macrocallback) ||

287 +

(context[:def_before] == :defmacro && subtype == :callback) do

288 288

nil

289 289

else

290 290

def_str =

291 291

if context[:def_before] == nil do

292 -

if String.starts_with?(spec, "@macrocallback") do

292 +

if subtype == :macrocallback do

293 293

"defmacro "

294 294

else

295 295

"def "

@@ -310,7 +310,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do

310 310

%__MODULE__{

311 311

label: label,

312 312

kind: :interface,

313 -

detail: "#{origin} callback",

313 +

detail: "#{origin} #{subtype}",

314 314

documentation: summary,

315 315

insert_text: insert_text,

316 316

priority: 12,

@@ -334,21 +334,24 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do

334 334

context,

335 335

options

336 336

) do

337 -

def_str = if(context[:def_before] == nil, do: "def ")

337 +

unless context[:def_before] == :defmacro do

338 +

def_str = if(context[:def_before] == nil, do: "def ")

338 339 339 -

insert_text = def_snippet(def_str, name, args, arity, options)

340 -

label = "#{def_str}#{name}/#{arity}"

340 +

opts = Keyword.put(options, :with_parens?, true)

341 +

insert_text = def_snippet(def_str, name, args, arity, opts)

342 +

label = "#{def_str}#{name}/#{arity}"

341 343 342 -

%__MODULE__{

343 -

label: label,

344 -

kind: :interface,

345 -

detail: "#{origin} protocol function",

346 -

documentation: summary,

347 -

insert_text: insert_text,

348 -

priority: 12,

349 -

filter_text: name,

350 -

tags: metadata_to_tags(metadata)

351 -

}

344 +

%__MODULE__{

345 +

label: label,

346 +

kind: :interface,

347 +

detail: "#{origin} protocol function",

348 +

documentation: summary,

349 +

insert_text: insert_text,

350 +

priority: 12,

351 +

filter_text: name,

352 +

tags: metadata_to_tags(metadata)

353 +

}

354 +

end

352 355

end

353 356 354 357

defp from_completion_item(

Original file line number Diff line number Diff line change

@@ -21,15 +21,15 @@ defmodule ElixirLS.LanguageServer.Providers.ReferencesTest do

21 21

[

22 22

%{

23 23

"range" => %{

24 -

"start" => %{"line" => 3, "character" => 4},

25 -

"end" => %{"line" => 3, "character" => 12}

24 +

"start" => %{"line" => 2, "character" => 4},

25 +

"end" => %{"line" => 2, "character" => 12}

26 26

},

27 27

"uri" => uri

28 28

},

29 29

%{

30 30

"range" => %{

31 -

"start" => %{"line" => 5, "character" => 12},

32 -

"end" => %{"line" => 5, "character" => 20}

31 +

"start" => %{"line" => 4, "character" => 12},

32 +

"end" => %{"line" => 4, "character" => 20}

33 33

},

34 34

"uri" => uri

35 35

}

Original file line number Diff line number Diff line change

@@ -1,7 +1,7 @@

1 1

%{

2 2

"dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"},

3 3

"docsh": {:hex, :docsh, "0.7.2", "f893d5317a0e14269dd7fe79cf95fb6b9ba23513da0480ec6e77c73221cae4f2", [:rebar3], [{:providers, "1.8.1", [hex: :providers, repo: "hexpm", optional: false]}], "hexpm", "4e7db461bb07540d2bc3d366b8513f0197712d0495bb85744f367d3815076134"},

4 -

"elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "36484b2b5fd25278086fd3e88f84565011a616fc", []},

4 +

"elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "8c82bc726f6f0e33680287ead72390fe4a8a74dd", []},

5 5

"erl2ex": {:git, "https://github.com/dazuma/erl2ex.git", "244c2d9ed5805ef4855a491d8616b8842fef7ca4", []},

6 6

"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},

7 7

"forms": {:hex, :forms, "0.0.1", "45f3b10b6f859f95f2c2c1a1de244d63855296d55ed8e93eb0dd116b3e86c4a6", [:rebar3], [], "hexpm", "530f63ed8ed5a171f744fc75bd69cb2e36496899d19dbef48101b4636b795868"},

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4