[Sublime Text 3] Arrows break indentation
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the issue in Sublime Text 3 with the shown keybinding and the Elixir examples, focusing on reindent when -> ends a line. Inspect the bundle's indentation rules and verify that each cond branch remains at the expected nesting level, then rerun reindent on both short and longer examples.
Written by the indexing model from the issue text.
Description
I have this .exs file
defmodule Bob do
import String
def hey(input) do
cond do
"" == trim(input) ->
"Fine. Be that way!"
ends_with?(input, "?") ->
"Sure."
input == upcase(input) && input != downcase(input) ->
"Whoa, chill out!"
true ->
"Whatever."
end
end
end
And in my keybindings I have
{"keys": ["ctrl+alt+/"], "command": "reindent", "args": {"single_line": false}},
But when I reident the file I get
defmodule Bob do
import String
def hey(input) do
cond do
"" == trim(input) ->
"Fine. Be that way!"
ends_with?(input, "?") ->
"Sure."
input == upcase(input) && input != downcase(input) ->
"Whoa, chill out!"
true ->
"Whatever."
end
end
end
This happens when the arrow -> is at the end of the line. If the statement is in the same line then the code formatting works fine.
defmodule Bob do
import String
def hey(input) do
cond do
"" == trim(input) -> "Fine. Be that way!"
ends_with?(input, "?") -> "Sure."
input == upcase(input) && input != downcase(input) -> "Whoa, chill out!"
true -> "Whatever."
end
end
end
And here is an example what happens with a longer file.
defmodule BinarySearch do
@spec search(tuple, integer) :: {:ok, integer} | :not_found
def search(numbers, key) do
high = tuple_size(numbers) - 1
_search(numbers, key, 0, high)
end
defp _search(numbers, key, low, high) do
midpoint = low + div((high - low), 2)
cond do
low > high ->
:not_found
elem(numbers, midpoint) == key ->
{:ok, midpoint}
elem(numbers, midpoint) > key ->
_search(numbers, key, low, midpoint - 1)
elem(numbers, midpoint) < key ->
_search(numbers, key, midpoint + 1, high)
end
end
end
- Dominant language
- Python
- Stars
- 262
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elixir-editors/elixir-tmbundle
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
elixir-editors/elixir-tmbundle#184 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
elixir-editors/elixir-tmbundle#183 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
elixir-editors/elixir-tmbundle#180 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in elixir-editors/elixir-tmbundle
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
huggingface/sentence-transformers#4186 ·
Maintainers usually reply within 5 days
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 92/100
QuantEcon/QuantEcon.py#988 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
fabriziosalmi/certmate#1247 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 Half a day Newbie friendliness 72/100
sujithputta02/Esapay#13 ·