diff --git a/lib/next_ls.ex b/lib/next_ls.ex index f4552b47..bcde85c6 100644 --- a/lib/next_ls.ex +++ b/lib/next_ls.ex @@ -115,8 +115,15 @@ defmodule NextLS do symbols = for %SymbolTable.Symbol{} = symbol <- SymbolTable.symbols(lsp.assigns.symbol_table), filter.(symbol.name) do + name = + if symbol.type != :defstruct do + "#{symbol.type} #{symbol.name}" + else + "#{symbol.name}" + end + %SymbolInformation{ - name: to_string(symbol.name), + name: name, kind: elixir_kind_to_lsp_kind(symbol.type), location: %Location{ uri: "file://#{symbol.file}", diff --git a/test/next_ls_test.exs b/test/next_ls_test.exs index e41c7c65..5a311797 100644 --- a/test/next_ls_test.exs +++ b/test/next_ls_test.exs @@ -342,7 +342,7 @@ defmodule NextLSTest do }, "uri" => "file://#{cwd}/lib/bar.ex" }, - "name" => "foo" + "name" => "def foo" } in symbols assert %{ @@ -360,7 +360,7 @@ defmodule NextLSTest do }, "uri" => "file://#{cwd}/lib/bar.ex" }, - "name" => "Bar" + "name" => "defmodule Bar" } in symbols assert %{ @@ -396,7 +396,7 @@ defmodule NextLSTest do }, "uri" => "file://#{cwd}/lib/code_action.ex" }, - "name" => "Foo.CodeAction.NestedMod" + "name" => "defmodule Foo.CodeAction.NestedMod" } in symbols end @@ -438,7 +438,7 @@ defmodule NextLSTest do }, "uri" => "file://#{cwd}/lib/bar.ex" }, - "name" => "foo" + "name" => "def foo" }, %{ "kind" => 12, @@ -455,7 +455,7 @@ defmodule NextLSTest do }, "uri" => "file://#{cwd}/lib/code_action.ex" }, - "name" => "foo" + "name" => "def foo" } ] == symbols end