Skip to content

Commit

Permalink
Add language fences around markdown code blocks
Browse files Browse the repository at this point in the history
Partially fixes elixir-lsp/elixir-ls#694
  • Loading branch information
lukaszsamson committed Oct 3, 2023
1 parent 4fad8fa commit c47f948
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions lib/elixir_sense/core/introspection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ defmodule ElixirSense.Core.Introspection do
spec_text =
if info.specs != [] do
joined = Enum.join(info.specs, "\n")
"### Specs\n\n```\n#{joined}\n```\n\n"
"### Specs\n\n```elixir\n#{joined}\n```\n\n"
else
""
end
Expand Down Expand Up @@ -688,7 +688,7 @@ defmodule ElixirSense.Core.Introspection do
end

defp format_type_docs(info) do
formatted_spec = "```\n#{info.spec}\n```"
formatted_spec = "```elixir\n#{info.spec}\n```"

mod_formatted =
case info.module do
Expand Down
2 changes: 1 addition & 1 deletion test/elixir_sense/core/introspection_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ defmodule ElixirSense.Core.IntrospectionTest do
### Definition
```
```elixir
@type some_type() :: integer()
```
Expand Down
74 changes: 37 additions & 37 deletions test/elixir_sense/docs_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(deep_list) :: list() when deep_list: [any() | deep_list]
```
Expand Down Expand Up @@ -123,7 +123,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -159,7 +159,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -206,7 +206,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -248,7 +248,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback go(t) :: integer()
```
"""
Expand Down Expand Up @@ -361,7 +361,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@macrocallback flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -405,7 +405,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -448,7 +448,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback init(args :: term()) ::\
"""

Expand Down Expand Up @@ -494,7 +494,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@macrocallback bar(integer()) :: Macro.t()
```
Expand Down Expand Up @@ -530,7 +530,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -569,7 +569,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -627,7 +627,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(list()) :: list()
```
"""
Expand Down Expand Up @@ -655,7 +655,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(deep_list) :: list() when deep_list: [any() | deep_list]
```
Expand Down Expand Up @@ -684,7 +684,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(deepList) :: list when deepList: [term() | deepList], list: [term()]
```
"""
Expand Down Expand Up @@ -718,7 +718,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec boolean() or boolean() :: boolean()
```
Expand Down Expand Up @@ -758,7 +758,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec some(integer()) :: Macro.t()
@spec some(b) :: Macro.t() when b: float()
```
Expand Down Expand Up @@ -809,7 +809,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(deep_list) :: list() when deep_list: [any() | deep_list]
```
Expand Down Expand Up @@ -1065,7 +1065,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type remote_t() :: atom()
```
Expand Down Expand Up @@ -1099,7 +1099,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type some(a) :: {a}
```
Expand Down Expand Up @@ -1133,7 +1133,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@typep some(a) :: {a}
```
Expand Down Expand Up @@ -1200,7 +1200,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@opaque some(a)
```
Expand Down Expand Up @@ -1235,7 +1235,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type some(a) :: {a}
```
Expand Down Expand Up @@ -1268,7 +1268,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@opaque t(x)
```
Expand Down Expand Up @@ -1298,7 +1298,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type time_unit() ::
pos_integer()
| :second
Expand Down Expand Up @@ -1342,7 +1342,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type keyword() :: [{atom(), any()}]
```
Expand All @@ -1363,7 +1363,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type keyword(t) :: [{atom(), t}]
```
Expand Down Expand Up @@ -1393,7 +1393,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type integer()
```
Expand Down Expand Up @@ -1425,7 +1425,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type list() :: [any()]
```
Expand All @@ -1446,7 +1446,7 @@ defmodule ElixirSense.DocsTest do
### Definition
```
```elixir
@type list(t)
```
Expand Down Expand Up @@ -1480,7 +1480,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec module_info :: [{:module | :attributes | :compile | :exports | :md5 | :native, term}]
```
Expand All @@ -1497,7 +1497,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec module_info(:module) :: atom
@spec module_info(:attributes | :compile) :: [{atom, term}]
@spec module_info(:md5) :: binary
Expand Down Expand Up @@ -1564,7 +1564,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback foo() :: :ok
```
Expand Down Expand Up @@ -1595,7 +1595,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback baz(integer()) :: :ok
```
Expand Down Expand Up @@ -1626,7 +1626,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@macrocallback bar(integer()) :: Macro.t()
```
Expand Down Expand Up @@ -1655,7 +1655,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback init(args :: term()) ::
"""

Expand Down Expand Up @@ -1689,7 +1689,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@callback init(args :: term()) :: init_result(state())
```
"""
Expand Down Expand Up @@ -1721,7 +1721,7 @@ defmodule ElixirSense.DocsTest do
### Specs
```
```elixir
@spec flatten(deep_list) :: list() when deep_list: [any() | deep_list]
```
Expand Down

0 comments on commit c47f948

Please sign in to comment.