diff --git a/run_vimtest b/run_vimtest new file mode 100755 index 0000000..f4bb5a7 --- /dev/null +++ b/run_vimtest @@ -0,0 +1,3 @@ +#! /usr/bin/env sh +set +xe +vim -c ":so test.vim" diff --git a/test.vim b/test.vim new file mode 100644 index 0000000..617e03d --- /dev/null +++ b/test.vim @@ -0,0 +1,106 @@ +" TODO: @jbodah 2024-09-17: setup path to lookup local git plugin + +let s:results = [] + +func s:assert_equal(testcase, expected, actual) + if (a:actual == a:expected) == 1 + call s:record_success(a:testcase, a:expected, a:actual) + else + call s:record_failure(a:testcase, a:expected, a:actual) + end +endfunction + +func s:record_success(testcase, expected, actual) + let s:results = s:results + [printf("PASS %s\n", a:testcase['name'])] + " let s:results = s:results + [printf("PASS %s\nwant\n%s\ngot\n\%s\n", a:testcase['name'], a:expected, a:actual)] +endfunction + +func s:record_failure(testcase, expected, actual) + let s:results = s:results + [printf("FAIL %s\nwant\n%s\ngot\n\%s\n", a:testcase['name'], a:expected, a:actual)] +endfunction + +func s:paste(text) + let @p = a:text + normal V"pP + call setreg("p", []) +endfunction + +func s:copy_buffer() + normal ggVG"yy + let l:copied = @y + call setreg("y", []) + return l:copied +endfunction + +func s:clear_buffer() + normal ggVGD +endfunction + +func s:indent_buffer() + normal ggVG= +endfunction + +func s:load_file(name) + return +endfunction + +function s:test_indent(testcase) + set ft=elixir + call s:paste(a:testcase['expected']) + let s:expected = s:copy_buffer() + + call s:indent_buffer() + let s:actual = s:copy_buffer() + + call s:assert_equal(a:testcase, s:expected, s:actual) +endfunction + +function s:paste_results() + set ft=none + call s:paste(join(s:results, "")) +endfunction + +func s:test_syntax(testcase) + set ft=elixir + call s:paste(a:testcase['body']) + + call search(a:testcase['pattern'], 'c') + let l:syngroups = map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') + call cursor(0, 0) + let l:i = index(l:syngroups, a:testcase['expected']) + if l:i == -1 + call s:record_failure({'name': "test_syntax"}, a:testcase['expected'], l:syngroups) + else + call s:record_success({'name': "test_syntax"}, a:testcase['expected'], l:syngroups) + end +endfunction + +let s:indent_testcases = map(readdir("vimtest/indent"), {_, val -> {'name': "vimtest/indent/" . val, 'expected': join(readfile("vimtest/indent/" . val), "\n")}}) +" Pin a test by uncommenting the following: +" let s:indent_testcases = [ +" \ {'name': "vimtest/indent/indent110.ex", 'expected': join(readfile("vimtest/indent/indent110.ex"), "\n")} +" \ ] + +" for tc in s:indent_testcases +" call s:test_indent(tc) +" call s:clear_buffer() +" endfor + +let s:syntax_testcases = [] +let s:syndir = readdir("vimtest/syntax") +for path in s:syndir + let contents = readfile("vimtest/syntax/" . path) + + let pattern = contents[0][2:-1] + let expected = contents[1][2:-1] + let body = join(contents[2:-1], "\n") + + let s:syntax_testcases = s:syntax_testcases + [{'body': body, 'pattern': pattern, 'expected': expected}] +endfor + +for tc in s:syntax_testcases + call s:test_syntax(tc) + call s:clear_buffer() +endfor + +call s:paste_results() diff --git a/vimtest/indent/indent0.ex b/vimtest/indent/indent0.ex new file mode 100644 index 0000000..c3a6405 --- /dev/null +++ b/vimtest/indent/indent0.ex @@ -0,0 +1,3 @@ +def do + some_func = fn x -> x end +end diff --git a/vimtest/indent/indent1.ex b/vimtest/indent/indent1.ex new file mode 100644 index 0000000..aa851df --- /dev/null +++ b/vimtest/indent/indent1.ex @@ -0,0 +1,3 @@ +def do + some_func = function do x -> x end +end diff --git a/vimtest/indent/indent10.ex b/vimtest/indent/indent10.ex new file mode 100644 index 0000000..371ef71 --- /dev/null +++ b/vimtest/indent/indent10.ex @@ -0,0 +1,2 @@ + +defmodule Hello do diff --git a/vimtest/indent/indent100.ex b/vimtest/indent/indent100.ex new file mode 100644 index 0000000..13dcf33 --- /dev/null +++ b/vimtest/indent/indent100.ex @@ -0,0 +1,5 @@ +defmodule Test do + def lol do + IO.inspect :end + end +end diff --git a/vimtest/indent/indent101.ex b/vimtest/indent/indent101.ex new file mode 100644 index 0000000..f4d395d --- /dev/null +++ b/vimtest/indent/indent101.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def name, do: IO.puts "bobmarley" + # expect next line starting here + + def name(param) do + param + end +end diff --git a/vimtest/indent/indent102.ex b/vimtest/indent/indent102.ex new file mode 100644 index 0000000..c63134a --- /dev/null +++ b/vimtest/indent/indent102.ex @@ -0,0 +1,7 @@ +defmodule Hello do + def name, do: IO.puts "bobmarley" + + def name(param) do + param + end +end diff --git a/vimtest/indent/indent103.ex b/vimtest/indent/indent103.ex new file mode 100644 index 0000000..8e23a74 --- /dev/null +++ b/vimtest/indent/indent103.ex @@ -0,0 +1,3 @@ +def f do + if true, do: 42 +end diff --git a/vimtest/indent/indent104.ex b/vimtest/indent/indent104.ex new file mode 100644 index 0000000..aafa4e7 --- /dev/null +++ b/vimtest/indent/indent104.ex @@ -0,0 +1,3 @@ +def f do + x = :do +end diff --git a/vimtest/indent/indent105.ex b/vimtest/indent/indent105.ex new file mode 100644 index 0000000..07af1b8 --- /dev/null +++ b/vimtest/indent/indent105.ex @@ -0,0 +1,13 @@ +defmodule Test do + def test do + one = + user + |> build_assoc(:videos) + |> Video.changeset() + + other = + user2 + |> build_assoc(:videos) + |> Video.changeset() + end +end diff --git a/vimtest/indent/indent106.ex b/vimtest/indent/indent106.ex new file mode 100644 index 0000000..87bac7b --- /dev/null +++ b/vimtest/indent/indent106.ex @@ -0,0 +1,6 @@ +defmodule MyMod do + def how_are_you do + IO.puts "I'm filling bad :(" + IO.puts "really bad" + end +end diff --git a/vimtest/indent/indent107.ex b/vimtest/indent/indent107.ex new file mode 100644 index 0000000..3248c45 --- /dev/null +++ b/vimtest/indent/indent107.ex @@ -0,0 +1,5 @@ +defmodule MyMod do + def how_are_you do + "function return" + end +end diff --git a/vimtest/indent/indent108.ex b/vimtest/indent/indent108.ex new file mode 100644 index 0000000..0806b89 --- /dev/null +++ b/vimtest/indent/indent108.ex @@ -0,0 +1,6 @@ +scope "/", API do + pipe_through :api # Use the default browser stack + + get "/url", Controller, :index + post "/url", Controller, :create +end diff --git a/vimtest/indent/indent109.ex b/vimtest/indent/indent109.ex new file mode 100644 index 0000000..0c294a1 --- /dev/null +++ b/vimtest/indent/indent109.ex @@ -0,0 +1,5 @@ +def hello do + {:ok, _} = TaskRunner.TaskStore.start_link(name: @task_store) + {:ok, _} = Workspace.start_link + {:ok, pending_task_sup} = TaskRunner.PendingTaskSupervisor.start_link +end diff --git a/vimtest/indent/indent11.ex b/vimtest/indent/indent11.ex new file mode 100644 index 0000000..63cacca --- /dev/null +++ b/vimtest/indent/indent11.ex @@ -0,0 +1,2 @@ +defmodule Hello do + def some_func do diff --git a/vimtest/indent/indent110.ex b/vimtest/indent/indent110.ex new file mode 100644 index 0000000..13db7c9 --- /dev/null +++ b/vimtest/indent/indent110.ex @@ -0,0 +1,4 @@ +def handle_info(:tick, state = %{policy_iteration: []}) do + state = put_in(state[:policy_iteration], state.policy) + {:noreply, state} +end diff --git a/vimtest/indent/indent111.ex b/vimtest/indent/indent111.ex new file mode 100644 index 0000000..07d94a2 --- /dev/null +++ b/vimtest/indent/indent111.ex @@ -0,0 +1,6 @@ +case some_function do + :ok -> + :ok + { :error, :message } -> + { :error, :message } +end diff --git a/vimtest/indent/indent112.ex b/vimtest/indent/indent112.ex new file mode 100644 index 0000000..9cd16e1 --- /dev/null +++ b/vimtest/indent/indent112.ex @@ -0,0 +1,8 @@ +case Connection.open(rabbitmq) do + {:ok, conn} -> + Woody.info "CONNECTION_SUCCESSFUL" + {:ok, chan} = Channel.open(conn) + {:error, error} -> + Woody.info "CONNECTION_FAILED" + :timer.sleep(10000) +end diff --git a/vimtest/indent/indent113.ex b/vimtest/indent/indent113.ex new file mode 100644 index 0000000..a7efa26 --- /dev/null +++ b/vimtest/indent/indent113.ex @@ -0,0 +1,12 @@ +defmodule M do + defp _fetch(result, key, deep_key) do + case _fetch(result, key) do + {:ok, val} -> + case _fetch(val, deep_key) do + :error -> {:error, :deep} + res -> res + end + + :error -> {:error, :shallow} + end + end diff --git a/vimtest/indent/indent114.ex b/vimtest/indent/indent114.ex new file mode 100644 index 0000000..9cd16e1 --- /dev/null +++ b/vimtest/indent/indent114.ex @@ -0,0 +1,8 @@ +case Connection.open(rabbitmq) do + {:ok, conn} -> + Woody.info "CONNECTION_SUCCESSFUL" + {:ok, chan} = Channel.open(conn) + {:error, error} -> + Woody.info "CONNECTION_FAILED" + :timer.sleep(10000) +end diff --git a/vimtest/indent/indent115.ex b/vimtest/indent/indent115.ex new file mode 100644 index 0000000..43bd4c0 --- /dev/null +++ b/vimtest/indent/indent115.ex @@ -0,0 +1,7 @@ +decoded_msg = case JSON.decode(msg) do + {:error, _} -> + a = "a" + b = "dasdas" + ">#{a}<>#{b}<" + {:ok, decoded} -> decoded +end diff --git a/vimtest/indent/indent116.ex b/vimtest/indent/indent116.ex new file mode 100644 index 0000000..56c7e87 --- /dev/null +++ b/vimtest/indent/indent116.ex @@ -0,0 +1,8 @@ +case Repo.insert(changeset) do + {:ok, user} -> + conn + |> put_flash(:info, "%{user.name} created!") + |> redirect(to: user_path(conn, :index)) + {:error, changeset} -> + render(conn, "new.html", changeset: changeset) +end diff --git a/vimtest/indent/indent117.ex b/vimtest/indent/indent117.ex new file mode 100644 index 0000000..627e93f --- /dev/null +++ b/vimtest/indent/indent117.ex @@ -0,0 +1,10 @@ +case st do + sym -> + code = if true do + :ok + else + :error + end + Logger.info(code) + st +end diff --git a/vimtest/indent/indent118.ex b/vimtest/indent/indent118.ex new file mode 100644 index 0000000..adb9469 --- /dev/null +++ b/vimtest/indent/indent118.ex @@ -0,0 +1,9 @@ +case world do + "apple" -> + IO.puts "its an apple" + + IO.puts "no really, its an apple" + "orange" -> + IO.puts "its not an apple" + IO.puts "believe it or not" +end diff --git a/vimtest/indent/indent119.ex b/vimtest/indent/indent119.ex new file mode 100644 index 0000000..1b74275 --- /dev/null +++ b/vimtest/indent/indent119.ex @@ -0,0 +1,4 @@ +case o do + a -> + e(fn -> f end) +end diff --git a/vimtest/indent/indent12.ex b/vimtest/indent/indent12.ex new file mode 100644 index 0000000..f986c3c --- /dev/null +++ b/vimtest/indent/indent12.ex @@ -0,0 +1,3 @@ +defmodule Hello do + def some_func do + end diff --git a/vimtest/indent/indent120.ex b/vimtest/indent/indent120.ex new file mode 100644 index 0000000..f990d5b --- /dev/null +++ b/vimtest/indent/indent120.ex @@ -0,0 +1,4 @@ +case pattern do + :* -> :ok + _ -> :error +end diff --git a/vimtest/indent/indent121.ex b/vimtest/indent/indent121.ex new file mode 100644 index 0000000..a274c34 --- /dev/null +++ b/vimtest/indent/indent121.ex @@ -0,0 +1,2 @@ +# do +IO.puts :test diff --git a/vimtest/indent/indent122.ex b/vimtest/indent/indent122.ex new file mode 100644 index 0000000..10c368b --- /dev/null +++ b/vimtest/indent/indent122.ex @@ -0,0 +1,10 @@ +defmodule Foo do + def run do + list = + File.read!("/path/to/file") + |> String.split() + # now start a new line + # used to start here + # but now starts here + end +end diff --git a/vimtest/indent/indent123.ex b/vimtest/indent/indent123.ex new file mode 100644 index 0000000..9239950 --- /dev/null +++ b/vimtest/indent/indent123.ex @@ -0,0 +1,8 @@ +defmodule Foo do + def run(task) when task in [:t1, :t2] do + end + + # now starts a new line + # use to start here + # but now starts here +end diff --git a/vimtest/indent/indent124.ex b/vimtest/indent/indent124.ex new file mode 100644 index 0000000..93f437b --- /dev/null +++ b/vimtest/indent/indent124.ex @@ -0,0 +1,7 @@ +receive do + {{:lock_ready, ^key}, ^pid} -> +after + # NOTE: @jbodah 2017-03-28: we should do some math to adjust the timeout + timeout -> + {:error, :timed_out_waiting_for_lock} +end diff --git a/vimtest/indent/indent125.ex b/vimtest/indent/indent125.ex new file mode 100644 index 0000000..90069fa --- /dev/null +++ b/vimtest/indent/indent125.ex @@ -0,0 +1,4 @@ +cond do + foo -> 1 + bar -> 2 +end diff --git a/vimtest/indent/indent126.ex b/vimtest/indent/indent126.ex new file mode 100644 index 0000000..b6fc05c --- /dev/null +++ b/vimtest/indent/indent126.ex @@ -0,0 +1,12 @@ +def handle_call({:release_lock, key}, _from, state) do + case get_lock(state, key) do + nil -> + {:reply, {:error, :already_unlocked}, state} + + _ -> + new_state = delete_lock(state, key) + {:reply, :ok, new_state} + end +end + +def diff --git a/vimtest/indent/indent127.ex b/vimtest/indent/indent127.ex new file mode 100644 index 0000000..7785c80 --- /dev/null +++ b/vimtest/indent/indent127.ex @@ -0,0 +1,47 @@ +defmodule Hello do + def hello do + end + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + def world do + end +end diff --git a/vimtest/indent/indent128.ex b/vimtest/indent/indent128.ex new file mode 100644 index 0000000..5c71044 --- /dev/null +++ b/vimtest/indent/indent128.ex @@ -0,0 +1,5 @@ +defmodule Test do + @doc """ + end + """ +end diff --git a/vimtest/indent/indent129.ex b/vimtest/indent/indent129.ex new file mode 100644 index 0000000..2b075c6 --- /dev/null +++ b/vimtest/indent/indent129.ex @@ -0,0 +1,6 @@ +defmodule Test do + @doc """ + it should + have reasonable + default start indent when typed + """ diff --git a/vimtest/indent/indent13.ex b/vimtest/indent/indent13.ex new file mode 100644 index 0000000..5d47a86 --- /dev/null +++ b/vimtest/indent/indent13.ex @@ -0,0 +1,4 @@ +defmodule Hello do + def some_func do + end +end diff --git a/vimtest/indent/indent130.ex b/vimtest/indent/indent130.ex new file mode 100644 index 0000000..086acdc --- /dev/null +++ b/vimtest/indent/indent130.ex @@ -0,0 +1,7 @@ +defmodule New do + def do_query do + from user in Users, + select: user.name, + join: signup in Signups, where: user.id == signup.user_id + end +end diff --git a/vimtest/indent/indent131.ex b/vimtest/indent/indent131.ex new file mode 100644 index 0000000..fff0b87 --- /dev/null +++ b/vimtest/indent/indent131.ex @@ -0,0 +1,4 @@ +def smth do + from = 1 + to = 7 +end diff --git a/vimtest/indent/indent132.ex b/vimtest/indent/indent132.ex new file mode 100644 index 0000000..614d34b --- /dev/null +++ b/vimtest/indent/indent132.ex @@ -0,0 +1 @@ +fromin, diff --git a/vimtest/indent/indent133.ex b/vimtest/indent/indent133.ex new file mode 100644 index 0000000..ebfd2ac --- /dev/null +++ b/vimtest/indent/indent133.ex @@ -0,0 +1 @@ +query = from u in query, select: u.city diff --git a/vimtest/indent/indent134.ex b/vimtest/indent/indent134.ex new file mode 100644 index 0000000..5d3075c --- /dev/null +++ b/vimtest/indent/indent134.ex @@ -0,0 +1,6 @@ +def do_query do + where = [category: "fresh and new"] + order_by = [desc: :published_at] + select = [:id, :title, :body] + from Post, where: ^where, order_by: ^order_by, select: ^select +end diff --git a/vimtest/indent/indent135.ex b/vimtest/indent/indent135.ex new file mode 100644 index 0000000..5006308 --- /dev/null +++ b/vimtest/indent/indent135.ex @@ -0,0 +1,3 @@ +def alphabetical(query) do + from c in query, order_by: c.name +end diff --git a/vimtest/indent/indent136.ex b/vimtest/indent/indent136.ex new file mode 100644 index 0000000..77fa2e1 --- /dev/null +++ b/vimtest/indent/indent136.ex @@ -0,0 +1,20 @@ +defmodule Onemedical.Types do + import EctoEnum + defenum(Work.Occupation, :work_occupation, [ + :actor, :architect, :athlete, :baker, :bank_clerk, :banker, :barber, :blogger, + :bricklayer, :broadcaster, :builder, :captain, :carpenter, :choreographer, + :computer_engineer, :computer_programmer, :custom_officer, :dancer, :designer, + :director, :doctor, :driver, :editor, :entertainer, :engineer, :facility_manager, + :farmer, :fashion_designer, :geologist, :goldsmith, :graphic_designer, :hairdresser, + :host_hostess, :house_girl, :interior_designer, :judge, :land_surveyor, :lecturer, + :make_up_artist, :manager, :mechanic, :midwife, :model, :music_director, :musician, + :nanny, :nurse, :pastor, :paediatrician, :photographer, :physicist, :pilot, :plumber, + :police_officer, :printer, :producer, :publisher, :quality_inspector, :radiographer, + :real_estate_agent, :referee, :refuse_collector, :registrar, :safety_engineer, :sales_manager, + :script_writer, :secretary, :security_guard, :shoemaker, :songwriter, :sound_engineer, + :stock_broker, :surveyor, :tailor, :teacher, :telecommunications_engineer, :usher, + :waiter, :writer, :zookeeper, :other]) + defenum(Work.Type, :work_type, [ + :full_time, :part_time, :volunteer, :temporary + ]) +end diff --git a/vimtest/indent/indent137.ex b/vimtest/indent/indent137.ex new file mode 100644 index 0000000..171ef21 --- /dev/null +++ b/vimtest/indent/indent137.ex @@ -0,0 +1,7 @@ +def render(assigns) do + ~L""" +
+ Some content +
+ """ +end diff --git a/vimtest/indent/indent138.ex b/vimtest/indent/indent138.ex new file mode 100644 index 0000000..595f566 --- /dev/null +++ b/vimtest/indent/indent138.ex @@ -0,0 +1,13 @@ +def render(assigns) do + ~H""" +
+
+ This is immediately nested +
+ + There's a self-closing tag +
+
+
+ """ +end diff --git a/vimtest/indent/indent139.ex b/vimtest/indent/indent139.ex new file mode 100644 index 0000000..d454d5e --- /dev/null +++ b/vimtest/indent/indent139.ex @@ -0,0 +1,7 @@ +def render(assigns) do + ~L""" +
+ Some content +
+ """ +end diff --git a/vimtest/indent/indent14.ex b/vimtest/indent/indent14.ex new file mode 100644 index 0000000..a0f2085 --- /dev/null +++ b/vimtest/indent/indent14.ex @@ -0,0 +1,5 @@ +defmodule Hello.World do + def some_func do + IO.puts "hello world" + end +end diff --git a/vimtest/indent/indent140.ex b/vimtest/indent/indent140.ex new file mode 100644 index 0000000..cc2b4c5 --- /dev/null +++ b/vimtest/indent/indent140.ex @@ -0,0 +1,9 @@ +def render(assigns) do + ~L""" +
+ Some content +
+ """ +end diff --git a/vimtest/indent/indent141.ex b/vimtest/indent/indent141.ex new file mode 100644 index 0000000..bf55027 --- /dev/null +++ b/vimtest/indent/indent141.ex @@ -0,0 +1,6 @@ +def render(assigns) do + ~L""" +
+

Some paragraph

+ """ +end diff --git a/vimtest/indent/indent142.ex b/vimtest/indent/indent142.ex new file mode 100644 index 0000000..5cbbb85 --- /dev/null +++ b/vimtest/indent/indent142.ex @@ -0,0 +1,13 @@ +def render(assigns) do + ~L""" +
+ it +
+ keeps +
+ nesting +
+
+
+ """ +end diff --git a/vimtest/indent/indent143.ex b/vimtest/indent/indent143.ex new file mode 100644 index 0000000..a661fa4 --- /dev/null +++ b/vimtest/indent/indent143.ex @@ -0,0 +1,9 @@ +def render(assgins) do + ~L""" +
+ <%= for i <- iter do %> +
<%= i %>
+ <% end %> +
+ """ +end diff --git a/vimtest/indent/indent144.ex b/vimtest/indent/indent144.ex new file mode 100644 index 0000000..ddf1be7 --- /dev/null +++ b/vimtest/indent/indent144.ex @@ -0,0 +1,23 @@ +def render(assigns) do + ~L""" + <%= live_component @socket, + Component, + id: "<%= @id %>", + user: @user do + %> + +
+
+

Some Header

+
+
+

Some Section

+

+ I'm some text +

+
+
+ + <% end %> + """ +end diff --git a/vimtest/indent/indent145.ex b/vimtest/indent/indent145.ex new file mode 100644 index 0000000..0430c65 --- /dev/null +++ b/vimtest/indent/indent145.ex @@ -0,0 +1,10 @@ +def render(assigns) do + ~L""" + <%= render_component, + @socket, + Component do %> + +

Multi-line opening eex tag that takes a block

+ <% end %> + """ +end diff --git a/vimtest/indent/indent146.ex b/vimtest/indent/indent146.ex new file mode 100644 index 0000000..04d3a57 --- /dev/null +++ b/vimtest/indent/indent146.ex @@ -0,0 +1,14 @@ +def render(assigns) do + ~L""" +
+ <%= render_component, + @socket, + Component %> +
+ + <%= render_component, + @socket, + Component %> +

Multi-line single eex tag

+ """ +end diff --git a/vimtest/indent/indent147.ex b/vimtest/indent/indent147.ex new file mode 100644 index 0000000..df5903c --- /dev/null +++ b/vimtest/indent/indent147.ex @@ -0,0 +1,16 @@ +def render(assigns) do + ~H""" + "bar" + } + }} + /> + """ +end diff --git a/vimtest/indent/indent148.ex b/vimtest/indent/indent148.ex new file mode 100644 index 0000000..b03dac7 --- /dev/null +++ b/vimtest/indent/indent148.ex @@ -0,0 +1,95 @@ +def render(assigns) do + ~L""" + <%= live_component @socket, + Component, + id: "<%= @id %>", + team: @team do + %> + +
+
+
+ A deeply nested tree +
+ with trailing whitespace + +
+
+
+
+ +
+ + <%= for i <- iter do %> +
<%= i %>
+ <% end %> + +
+ +
    +
  • + {{ item }} +
  • +
+ +
+ Hi

hi

+ I'm ok, ok? +
+ hi there! +
+
+
+

hi

+
+
+
+
+ + + + +
content
+
+ +
+ +
hi
+ +
+
+ content +
+
+
+ content in new div after a self-closing div +
+
+ +

+ <%= @solo.eex_tag %> + + content + +

+ + <% end %> + """ +end diff --git a/vimtest/indent/indent149.ex b/vimtest/indent/indent149.ex new file mode 100644 index 0000000..4c2fed6 --- /dev/null +++ b/vimtest/indent/indent149.ex @@ -0,0 +1,9 @@ +test "test" do + Mod.fun(fn -> + map = %Mod.Map{ + id: "abc123", + state: "processing", + submod: %Mod.Submod{ + options: %{} + } + } diff --git a/vimtest/indent/indent15.ex b/vimtest/indent/indent15.ex new file mode 100644 index 0000000..5d7e931 --- /dev/null +++ b/vimtest/indent/indent15.ex @@ -0,0 +1,8 @@ +defmodule Hello.World do + def some_func do + IO.puts "hello world" + end + def some_other_func do + IO.puts "hello world" + end +end diff --git a/vimtest/indent/indent150.ex b/vimtest/indent/indent150.ex new file mode 100644 index 0000000..aef6af0 --- /dev/null +++ b/vimtest/indent/indent150.ex @@ -0,0 +1,14 @@ +test "test" do + Mod.fun(fn -> + map = %Mod.Map{ + id: "abc123", + fun: fn -> + IO.inspect :hello + IO.inspect %{ + this_is: :a_map + } + end, + submod: %Mod.Submod{ + options: %{} + } + } diff --git a/vimtest/indent/indent151.ex b/vimtest/indent/indent151.ex new file mode 100644 index 0000000..9479ee1 --- /dev/null +++ b/vimtest/indent/indent151.ex @@ -0,0 +1,3 @@ +if foo do + bar +end diff --git a/vimtest/indent/indent152.ex b/vimtest/indent/indent152.ex new file mode 100644 index 0000000..d546e1a --- /dev/null +++ b/vimtest/indent/indent152.ex @@ -0,0 +1,5 @@ +if foo do + bar +else + baz +end diff --git a/vimtest/indent/indent153.ex b/vimtest/indent/indent153.ex new file mode 100644 index 0000000..5ee2ffa --- /dev/null +++ b/vimtest/indent/indent153.ex @@ -0,0 +1,3 @@ +def test do + "else" +end diff --git a/vimtest/indent/indent154.ex b/vimtest/indent/indent154.ex new file mode 100644 index 0000000..c785e2e --- /dev/null +++ b/vimtest/indent/indent154.ex @@ -0,0 +1,3 @@ +if true do +else +end diff --git a/vimtest/indent/indent155.ex b/vimtest/indent/indent155.ex new file mode 100644 index 0000000..d852ada --- /dev/null +++ b/vimtest/indent/indent155.ex @@ -0,0 +1,7 @@ +def exec(command, progress_func \ fn(_, state) -> state end, key \ nil, output \ nil) do + if key do + with_cache(key, output, fn -> do_exec(command, progress_func) end) + else + do_exec(command, progress_func) + end +end diff --git a/vimtest/indent/indent156.ex b/vimtest/indent/indent156.ex new file mode 100644 index 0000000..f6c85f6 --- /dev/null +++ b/vimtest/indent/indent156.ex @@ -0,0 +1,5 @@ +def handle_call({:get_in_line_for_lock, key}, from, state) do + queue = state[:queues][key] || :queue.new + queue = queue.in(from, queue) + hello +end diff --git a/vimtest/indent/indent157.ex b/vimtest/indent/indent157.ex new file mode 100644 index 0000000..c3c51ff --- /dev/null +++ b/vimtest/indent/indent157.ex @@ -0,0 +1,6 @@ +if arg[:arg] do + finish_time = Timex.Duration.now + start_time = Mod.Mod.arg(@attr, fun(state)) + duration = Timex.Duration.diff(finish_time, start_time, :milliseconds) + Mod.fun(:arg, arg, arg: arg, arg: arg, arg) + e diff --git a/vimtest/indent/indent158.ex b/vimtest/indent/indent158.ex new file mode 100644 index 0000000..2dd13c6 --- /dev/null +++ b/vimtest/indent/indent158.ex @@ -0,0 +1,5 @@ +Logger.metadata( + task_id: state.recipe.task_id, + hashed_id: state.recipe.config.some_id, + task +) diff --git a/vimtest/indent/indent159.ex b/vimtest/indent/indent159.ex new file mode 100644 index 0000000..1609cde --- /dev/null +++ b/vimtest/indent/indent159.ex @@ -0,0 +1,5 @@ +def example do + [ :foo, + :bar, + :baz ] +end diff --git a/vimtest/indent/indent16.ex b/vimtest/indent/indent16.ex new file mode 100644 index 0000000..3be0d4d --- /dev/null +++ b/vimtest/indent/indent16.ex @@ -0,0 +1,9 @@ +defmodule Hello.World do + def some_func do + IO.puts "hello world" + end + + def some_other_func do + IO.puts "hello world" + end +end diff --git a/vimtest/indent/indent160.ex b/vimtest/indent/indent160.ex new file mode 100644 index 0000000..692b59f --- /dev/null +++ b/vimtest/indent/indent160.ex @@ -0,0 +1,5 @@ +[ + [ + :foo + ] +] diff --git a/vimtest/indent/indent161.ex b/vimtest/indent/indent161.ex new file mode 100644 index 0000000..9d551a1 --- /dev/null +++ b/vimtest/indent/indent161.ex @@ -0,0 +1,5 @@ +def project do + [ name: "mix", + version: "0.1.0", + deps: deps ] +end diff --git a/vimtest/indent/indent162.ex b/vimtest/indent/indent162.ex new file mode 100644 index 0000000..35678a3 --- /dev/null +++ b/vimtest/indent/indent162.ex @@ -0,0 +1,4 @@ +def config do + [ name: + "John" ] +end diff --git a/vimtest/indent/indent163.ex b/vimtest/indent/indent163.ex new file mode 100644 index 0000000..e1bab0f --- /dev/null +++ b/vimtest/indent/indent163.ex @@ -0,0 +1,6 @@ +def test do + [ { :cowboy, github: "extend/cowboy" }, + { :dynamo, "0.1.0-dev", github: "elixir-lang/dynamo" }, + { :ecto, github: "elixir-lang/ecto" }, + { :pgsql, github: "semiocast/pgsql" } ] +end diff --git a/vimtest/indent/indent164.ex b/vimtest/indent/indent164.ex new file mode 100644 index 0000000..5fa349a --- /dev/null +++ b/vimtest/indent/indent164.ex @@ -0,0 +1,4 @@ +def test do + [ [:a, :b, :c], + [:d, :e, :f] ] +end diff --git a/vimtest/indent/indent165.ex b/vimtest/indent/indent165.ex new file mode 100644 index 0000000..a8ec152 --- /dev/null +++ b/vimtest/indent/indent165.ex @@ -0,0 +1,9 @@ +def test do + [ app: :first, + version: "0.0.1", + dynamos: [First.Dynamo], + compilers: [:elixir, :dynamo, :ecto, :app], + env: [prod: [compile_path: "ebin"]], + compile_path: "tmp/first/ebin", + deps: deps ] +end diff --git a/vimtest/indent/indent166.ex b/vimtest/indent/indent166.ex new file mode 100644 index 0000000..d795103 --- /dev/null +++ b/vimtest/indent/indent166.ex @@ -0,0 +1,6 @@ +def project do + [ + { :bar, path: "deps/umbrella/apps/bar" }, + { :umbrella, path: "deps/umbrella" } + ] +end diff --git a/vimtest/indent/indent167.ex b/vimtest/indent/indent167.ex new file mode 100644 index 0000000..8a19179 --- /dev/null +++ b/vimtest/indent/indent167.ex @@ -0,0 +1,20 @@ +def test do + a = [ + %{ + foo: 1, + bar: 2 + } + ] + + b = %{ + [ + :foo, + :bar + ] + } + + [ + a, + b + ] +end diff --git a/vimtest/indent/indent168.ex b/vimtest/indent/indent168.ex new file mode 100644 index 0000000..9fe0fc5 --- /dev/null +++ b/vimtest/indent/indent168.ex @@ -0,0 +1,7 @@ +def create(conn, %{ + "grant_type" => "password", + "username" => username, + "password" => password +}) do + 1 +end diff --git a/vimtest/indent/indent169.ex b/vimtest/indent/indent169.ex new file mode 100644 index 0000000..8720d44 --- /dev/null +++ b/vimtest/indent/indent169.ex @@ -0,0 +1,6 @@ +def double(x) do + add( + x, + y + ) +end diff --git a/vimtest/indent/indent17.ex b/vimtest/indent/indent17.ex new file mode 100644 index 0000000..2df2bbf --- /dev/null +++ b/vimtest/indent/indent17.ex @@ -0,0 +1,12 @@ +defmodule Hello.World do + def some_func do + IO.puts "hello world" + end + + def some_other_func do + IO.puts "hello world" + IO.puts "hello world" + IO.puts "hello world" + IO.puts "hello world" + end +end diff --git a/vimtest/indent/indent170.ex b/vimtest/indent/indent170.ex new file mode 100644 index 0000000..61fab93 --- /dev/null +++ b/vimtest/indent/indent170.ex @@ -0,0 +1,8 @@ +def double(x) do + add( + x, + y, + w, + z + ) +end diff --git a/vimtest/indent/indent171.ex b/vimtest/indent/indent171.ex new file mode 100644 index 0000000..e070eba --- /dev/null +++ b/vimtest/indent/indent171.ex @@ -0,0 +1,7 @@ +def double(x) do + result = add( + x, + z + ) + div(result, 2) +end diff --git a/vimtest/indent/indent172.ex b/vimtest/indent/indent172.ex new file mode 100644 index 0000000..a225e78 --- /dev/null +++ b/vimtest/indent/indent172.ex @@ -0,0 +1,8 @@ +defmodule Module do + @person1 { name: "name", + age: 18, + enabled?: true } + @person2 { name: "other name", + age: 21, + enabled?: false } +end diff --git a/vimtest/indent/indent173.ex b/vimtest/indent/indent173.ex new file mode 100644 index 0000000..4d03e4d --- /dev/null +++ b/vimtest/indent/indent173.ex @@ -0,0 +1,9 @@ +def test_another_feature do + assert json_response(conn, 200) == %{ + "results" => [ + %{ + "id" => result.id, + } + ] + } +end diff --git a/vimtest/indent/indent174.ex b/vimtest/indent/indent174.ex new file mode 100644 index 0000000..17d2bb1 --- /dev/null +++ b/vimtest/indent/indent174.ex @@ -0,0 +1,10 @@ +defmodule Mod do + def test do + foo == %{ + } + + assert json_response == %{ + "id" => "identifier" + } + end +end diff --git a/vimtest/indent/indent175.ex b/vimtest/indent/indent175.ex new file mode 100644 index 0000000..231b2aa --- /dev/null +++ b/vimtest/indent/indent175.ex @@ -0,0 +1,9 @@ +defmodule Mod do + def fun do + json_logger = Keyword.merge(Application.get_env(:logger, :json_logger, []), options) + Application.put_env(:logger, :json_logger, json_logger) + level = Keyword.get(json_logger, :level) + + %{level: level, output: :console} + end +end diff --git a/vimtest/indent/indent176.ex b/vimtest/indent/indent176.ex new file mode 100644 index 0000000..08363f0 --- /dev/null +++ b/vimtest/indent/indent176.ex @@ -0,0 +1,6 @@ +defmodule Mod do + def fun do + Enum.each(s.routing_keys, fn k -> Queue.bind(chan, s.queue, s.exchange, routing_key: k) end) + Basic.consume(chan, s.queue, nil, no_ack: true) + end +end diff --git a/vimtest/indent/indent177.ex b/vimtest/indent/indent177.ex new file mode 100644 index 0000000..340d27c --- /dev/null +++ b/vimtest/indent/indent177.ex @@ -0,0 +1,9 @@ +def init(_) do + children = [ + worker(QueueSet, [[name: @queue_set]]), + worker(Producer, [[name: @producer]]), + worker(ConsumerSupervisor, [[{@producer, max_demand: @max_executors}]]) + ] + + supervise(children, strategy: :one_for_one) +end diff --git a/vimtest/indent/indent178.ex b/vimtest/indent/indent178.ex new file mode 100644 index 0000000..0614fc3 --- /dev/null +++ b/vimtest/indent/indent178.ex @@ -0,0 +1,7 @@ +defmodule DeadboltTest do + use ExUnit.Case + doctest Deadbolt + + hello + +end diff --git a/vimtest/indent/indent179.ex b/vimtest/indent/indent179.ex new file mode 100644 index 0000000..d112faf --- /dev/null +++ b/vimtest/indent/indent179.ex @@ -0,0 +1,5 @@ +DrMock.mock(fn -> + params = %{ + + } +end) diff --git a/vimtest/indent/indent18.ex b/vimtest/indent/indent18.ex new file mode 100644 index 0000000..c3ad4b5 --- /dev/null +++ b/vimtest/indent/indent18.ex @@ -0,0 +1,13 @@ +defmodule Hello.World do + def some_func do + IO.puts "hello world" + end + + def some_other_func do + if blah? do + blah + else + not_blah + end + end +end diff --git a/vimtest/indent/indent180.ex b/vimtest/indent/indent180.ex new file mode 100644 index 0000000..498f92a --- /dev/null +++ b/vimtest/indent/indent180.ex @@ -0,0 +1,5 @@ +x = %{ + foo: :bar +} + +y = :foo diff --git a/vimtest/indent/indent181.ex b/vimtest/indent/indent181.ex new file mode 100644 index 0000000..94316d7 --- /dev/null +++ b/vimtest/indent/indent181.ex @@ -0,0 +1,4 @@ +x = + %{ foo: :bar } + +y = :foo diff --git a/vimtest/indent/indent182.ex b/vimtest/indent/indent182.ex new file mode 100644 index 0000000..0a7bdb5 --- /dev/null +++ b/vimtest/indent/indent182.ex @@ -0,0 +1,4 @@ +x = %{ + foo: :bar } + +y = :foo diff --git a/vimtest/indent/indent183.ex b/vimtest/indent/indent183.ex new file mode 100644 index 0000000..4c2fed6 --- /dev/null +++ b/vimtest/indent/indent183.ex @@ -0,0 +1,9 @@ +test "test" do + Mod.fun(fn -> + map = %Mod.Map{ + id: "abc123", + state: "processing", + submod: %Mod.Submod{ + options: %{} + } + } diff --git a/vimtest/indent/indent184.ex b/vimtest/indent/indent184.ex new file mode 100644 index 0000000..1670df4 --- /dev/null +++ b/vimtest/indent/indent184.ex @@ -0,0 +1,3 @@ +"a,b,c,d" +|> String.split(",") +|> Enum.reverse diff --git a/vimtest/indent/indent185.ex b/vimtest/indent/indent185.ex new file mode 100644 index 0000000..0236f23 --- /dev/null +++ b/vimtest/indent/indent185.ex @@ -0,0 +1,3 @@ +[ h | t ] = "a,b,c,d" + |> String.split(",") + |> Enum.reverse diff --git a/vimtest/indent/indent186.ex b/vimtest/indent/indent186.ex new file mode 100644 index 0000000..abb33dc --- /dev/null +++ b/vimtest/indent/indent186.ex @@ -0,0 +1,7 @@ +def test do + [ h | t ] = "a,b,c,d" + |> String.split(",") + |> Enum.reverse + + { :ok, h } +end diff --git a/vimtest/indent/indent187.ex b/vimtest/indent/indent187.ex new file mode 100644 index 0000000..7f0a47c --- /dev/null +++ b/vimtest/indent/indent187.ex @@ -0,0 +1,6 @@ +def test do + my_post = Post + |> where([p], p.id == 10) + |> where([p], u.user_id == 1) + |> select([p], p) +end diff --git a/vimtest/indent/indent188.ex b/vimtest/indent/indent188.ex new file mode 100644 index 0000000..2ddb005 --- /dev/null +++ b/vimtest/indent/indent188.ex @@ -0,0 +1,9 @@ +def test do + "a,b,c,d" + |> String.split(",") + |> Enum.first + |> case do + "a" -> "A" + _ -> "Z" + end +end diff --git a/vimtest/indent/indent189.ex b/vimtest/indent/indent189.ex new file mode 100644 index 0000000..7601930 --- /dev/null +++ b/vimtest/indent/indent189.ex @@ -0,0 +1,4 @@ +defrecord RECORD, field_a: nil, field_b: nil + +rec = RECORD.new + |> IO.inspect diff --git a/vimtest/indent/indent19.ex b/vimtest/indent/indent19.ex new file mode 100644 index 0000000..346e263 --- /dev/null +++ b/vimtest/indent/indent19.ex @@ -0,0 +1,18 @@ +defmodule Hello.World do + def some_func do + IO.puts "hello world" + end + + def some_other_func do + if blah? do + blah + else + not_blah + end + if blah? do + blah + else + not_blah + end + end +end diff --git a/vimtest/indent/indent190.ex b/vimtest/indent/indent190.ex new file mode 100644 index 0000000..0fd8609 --- /dev/null +++ b/vimtest/indent/indent190.ex @@ -0,0 +1,12 @@ +defmodule MyMod do + def export_info(users) do + {:ok, infos} = users + |> Enum.map(fn (u) -> do_something(u) end) + |> Enum.map(fn (u) -> + do_even_more(u) + end) + |> finall_thing + + infos + end +end diff --git a/vimtest/indent/indent191.ex b/vimtest/indent/indent191.ex new file mode 100644 index 0000000..47b5513 --- /dev/null +++ b/vimtest/indent/indent191.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + "embedded=here" + |> +end diff --git a/vimtest/indent/indent192.ex b/vimtest/indent/indent192.ex new file mode 100644 index 0000000..e155f69 --- /dev/null +++ b/vimtest/indent/indent192.ex @@ -0,0 +1,3 @@ +def build_command(input, output) do + 'embedded=here' + |> diff --git a/vimtest/indent/indent193.ex b/vimtest/indent/indent193.ex new file mode 100644 index 0000000..2ef5b92 --- /dev/null +++ b/vimtest/indent/indent193.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + %{:hello => :world} + |> +end diff --git a/vimtest/indent/indent194.ex b/vimtest/indent/indent194.ex new file mode 100644 index 0000000..f918590 --- /dev/null +++ b/vimtest/indent/indent194.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + true <= false + |> IO.inspect +end diff --git a/vimtest/indent/indent195.ex b/vimtest/indent/indent195.ex new file mode 100644 index 0000000..ac5cf12 --- /dev/null +++ b/vimtest/indent/indent195.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + true >= false + |> IO.inspect +end diff --git a/vimtest/indent/indent196.ex b/vimtest/indent/indent196.ex new file mode 100644 index 0000000..71100bf --- /dev/null +++ b/vimtest/indent/indent196.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + true == false + |> IO.inspect +end diff --git a/vimtest/indent/indent197.ex b/vimtest/indent/indent197.ex new file mode 100644 index 0000000..06c9225 --- /dev/null +++ b/vimtest/indent/indent197.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + true != false + |> IO.inspect +end diff --git a/vimtest/indent/indent198.ex b/vimtest/indent/indent198.ex new file mode 100644 index 0000000..331fbd8 --- /dev/null +++ b/vimtest/indent/indent198.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + true === false + |> IO.inspect +end diff --git a/vimtest/indent/indent199.ex b/vimtest/indent/indent199.ex new file mode 100644 index 0000000..ea4b0d9 --- /dev/null +++ b/vimtest/indent/indent199.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + true !== false + |> IO.inspect +end diff --git a/vimtest/indent/indent2.ex b/vimtest/indent/indent2.ex new file mode 100644 index 0000000..463b842 --- /dev/null +++ b/vimtest/indent/indent2.ex @@ -0,0 +1,5 @@ +def test do + assert_raise Queue.Empty, fn -> + Q.new |> Q.deq! + end +end diff --git a/vimtest/indent/indent20.ex b/vimtest/indent/indent20.ex new file mode 100644 index 0000000..1cf8c4c --- /dev/null +++ b/vimtest/indent/indent20.ex @@ -0,0 +1,18 @@ +defmodule Hello.World do + def some_func do + IO.puts "hello world" + end + + def some_other_func do + if blah? do + blah + if blah? do + blah + else + not_blah + end + else + not_blah + end + end +end diff --git a/vimtest/indent/indent200.ex b/vimtest/indent/indent200.ex new file mode 100644 index 0000000..bb86b1b --- /dev/null +++ b/vimtest/indent/indent200.ex @@ -0,0 +1,4 @@ +def build_command(input, output) do + true =~ false + |> IO.inspect +end diff --git a/vimtest/indent/indent201.ex b/vimtest/indent/indent201.ex new file mode 100644 index 0000000..8069516 --- /dev/null +++ b/vimtest/indent/indent201.ex @@ -0,0 +1,6 @@ +upcased_names = names + |> Enum.map(fn name -> + String.upcase(name) + end) + +IO.inspect names diff --git a/vimtest/indent/indent202.ex b/vimtest/indent/indent202.ex new file mode 100644 index 0000000..e478c65 --- /dev/null +++ b/vimtest/indent/indent202.ex @@ -0,0 +1,5 @@ +upcased_names = names + |> Enum.map(fn name -> + String.upcase(name) end) + +IO.inspect names diff --git a/vimtest/indent/indent203.ex b/vimtest/indent/indent203.ex new file mode 100644 index 0000000..6e7ad68 --- /dev/null +++ b/vimtest/indent/indent203.ex @@ -0,0 +1,6 @@ +upcased_names = names + |> Enum.map(fn name -> + String.upcase(name) + end) + + |> do_stuff diff --git a/vimtest/indent/indent204.ex b/vimtest/indent/indent204.ex new file mode 100644 index 0000000..914b19f --- /dev/null +++ b/vimtest/indent/indent204.ex @@ -0,0 +1,5 @@ +def hello do + do_something + |> Pipe.to_me + {:ok} +end diff --git a/vimtest/indent/indent205.ex b/vimtest/indent/indent205.ex new file mode 100644 index 0000000..79d04dc --- /dev/null +++ b/vimtest/indent/indent205.ex @@ -0,0 +1,9 @@ +defmodule MyModule do + def do_stuff do + name = + "Dr. Zaius" + |> determine_name + + hello + end +end diff --git a/vimtest/indent/indent206.ex b/vimtest/indent/indent206.ex new file mode 100644 index 0000000..89aa85a --- /dev/null +++ b/vimtest/indent/indent206.ex @@ -0,0 +1,5 @@ +defmacro foo do + quote do + unquote(foo) + end +end diff --git a/vimtest/indent/indent207.ex b/vimtest/indent/indent207.ex new file mode 100644 index 0000000..d430905 --- /dev/null +++ b/vimtest/indent/indent207.ex @@ -0,0 +1,7 @@ +defmacro foo do + if 1 = 1 do + quote do + unquote(foo) + end + end +end diff --git a/vimtest/indent/indent208.ex b/vimtest/indent/indent208.ex new file mode 100644 index 0000000..e11d2ec --- /dev/null +++ b/vimtest/indent/indent208.ex @@ -0,0 +1,3 @@ +receive do +after +end diff --git a/vimtest/indent/indent209.ex b/vimtest/indent/indent209.ex new file mode 100644 index 0000000..77b5c82 --- /dev/null +++ b/vimtest/indent/indent209.ex @@ -0,0 +1,10 @@ +def obtain_lock(pid, key, timeout \ 60_000) do + case GenServer.call(pid, {:obtain_lock, key}) do + :will_notify -> + receive do + after + timeout -> + end + res -> res + end +end diff --git a/vimtest/indent/indent21.ex b/vimtest/indent/indent21.ex new file mode 100644 index 0000000..858473b --- /dev/null +++ b/vimtest/indent/indent21.ex @@ -0,0 +1,8 @@ +defmodule Hello.World do + def some_func do + cond do + {:abc} -> false + _ -> true + end + end +end diff --git a/vimtest/indent/indent210.ex b/vimtest/indent/indent210.ex new file mode 100644 index 0000000..0db9cb3 --- /dev/null +++ b/vimtest/indent/indent210.ex @@ -0,0 +1,17 @@ +defmodule A do + defmodule State do + defstruct field: nil, field: nil, field: nil, + field: [], field: nil, field: 0, + field: false, field: %{} + end + + defmodule State do + defstruct field: nil, field: nil, field: nil + end + + defmodule State do + defstruct field: nil, + field: [], + field: false + end +end diff --git a/vimtest/indent/indent211.ex b/vimtest/indent/indent211.ex new file mode 100644 index 0000000..02d82b1 --- /dev/null +++ b/vimtest/indent/indent211.ex @@ -0,0 +1,3 @@ +try do +rescue +end diff --git a/vimtest/indent/indent212.ex b/vimtest/indent/indent212.ex new file mode 100644 index 0000000..56d758d --- /dev/null +++ b/vimtest/indent/indent212.ex @@ -0,0 +1,3 @@ +try do +catch +end diff --git a/vimtest/indent/indent213.ex b/vimtest/indent/indent213.ex new file mode 100644 index 0000000..f72ccae --- /dev/null +++ b/vimtest/indent/indent213.ex @@ -0,0 +1,3 @@ +try do +after +end diff --git a/vimtest/indent/indent214.ex b/vimtest/indent/indent214.ex new file mode 100644 index 0000000..305a797 --- /dev/null +++ b/vimtest/indent/indent214.ex @@ -0,0 +1,9 @@ +test "it proceses the command" do + out = "testfile" + try do + cmd = "thing #{@test_file} #{out}" + {:ok, 0, _} = Thing.exec(cmd) + after + File.rm!(out) + end +end diff --git a/vimtest/indent/indent215.ex b/vimtest/indent/indent215.ex new file mode 100644 index 0000000..e151f8d --- /dev/null +++ b/vimtest/indent/indent215.ex @@ -0,0 +1,5 @@ +try do + foo() +else + value -> value +end diff --git a/vimtest/indent/indent216.ex b/vimtest/indent/indent216.ex new file mode 100644 index 0000000..57a3f5c --- /dev/null +++ b/vimtest/indent/indent216.ex @@ -0,0 +1,5 @@ +def xpto do + { :a, + :b, + :c } +end diff --git a/vimtest/indent/indent217.ex b/vimtest/indent/indent217.ex new file mode 100644 index 0000000..b4a3f26 --- /dev/null +++ b/vimtest/indent/indent217.ex @@ -0,0 +1,6 @@ +def method do + { + :bar, + path: "deps/umbrella/apps/bar" + } +end diff --git a/vimtest/indent/indent218.ex b/vimtest/indent/indent218.ex new file mode 100644 index 0000000..9174887 --- /dev/null +++ b/vimtest/indent/indent218.ex @@ -0,0 +1,4 @@ +x = [ + {:text, "asd {"}, + {:text, "qwe"}, +] diff --git a/vimtest/indent/indent219.ex b/vimtest/indent/indent219.ex new file mode 100644 index 0000000..a39ca29 --- /dev/null +++ b/vimtest/indent/indent219.ex @@ -0,0 +1,5 @@ +with {:ok, msg} <- Msgpax.unpack(payload) do + {:ok, rebuild(msg)} +else + error -> error +end diff --git a/vimtest/indent/indent22.ex b/vimtest/indent/indent22.ex new file mode 100644 index 0000000..6045a5e --- /dev/null +++ b/vimtest/indent/indent22.ex @@ -0,0 +1,9 @@ +defmodule Hello.World do + def some_func do + cond do + {:abc} -> false + + _ -> true + end + end +end diff --git a/vimtest/indent/indent220.ex b/vimtest/indent/indent220.ex new file mode 100644 index 0000000..90d0489 --- /dev/null +++ b/vimtest/indent/indent220.ex @@ -0,0 +1,6 @@ +with {:ok, width} <- Map.fetch(opts, :width), + double_width = width * 2, + {:ok, height} <- Map.fetch(opts, :height) +do + {:ok, double_width * height} +end diff --git a/vimtest/indent/indent221.ex b/vimtest/indent/indent221.ex new file mode 100644 index 0000000..be49697 --- /dev/null +++ b/vimtest/indent/indent221.ex @@ -0,0 +1,4 @@ +with {:ok, width} <- Map.fetch(opts, :width), + double_width = width * 2, + {:ok, height} <- Map.fetch(opts, :height), + do: {:ok, double_width * height} diff --git a/vimtest/indent/indent222.ex b/vimtest/indent/indent222.ex new file mode 100644 index 0000000..3369a04 --- /dev/null +++ b/vimtest/indent/indent222.ex @@ -0,0 +1,8 @@ +with {:ok, width} <- Map.fetch(opts, :width), + {:ok, height} <- Map.fetch(opts, :height) +do + {:ok, width * height} +else + :error -> + {:error, :wrong_data} +end diff --git a/vimtest/indent/indent223.ex b/vimtest/indent/indent223.ex new file mode 100644 index 0000000..2a6dd5b --- /dev/null +++ b/vimtest/indent/indent223.ex @@ -0,0 +1,7 @@ +with {:ok, width} <- Map.fetch(opts, :width), + {:ok, height} <- Map.fetch(opts, :height), + do: + {:ok, + width * height * height * height * height * height * height * height * height * height * + height * height * height * height * height * height * height}, + else: (:error -> {:error, :wrong_data}) diff --git a/vimtest/indent/indent224.ex b/vimtest/indent/indent224.ex new file mode 100644 index 0000000..e11cba0 --- /dev/null +++ b/vimtest/indent/indent224.ex @@ -0,0 +1,5 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Mix.Config module. +use Mix.Config + +import_config "#{Mix.env}.exs" diff --git a/vimtest/indent/indent225.ex b/vimtest/indent/indent225.ex new file mode 100644 index 0000000..41d3872 --- /dev/null +++ b/vimtest/indent/indent225.ex @@ -0,0 +1,7 @@ +with {:ok, %File.Stat{size: size}} when size > 0 <- File.stat(first_frame_path) do + File.rename(first_frame_path, output_path) + {:ok, %Result{path: output_path}} +else + error -> + {:error, error} +end diff --git a/vimtest/indent/indent226.ex b/vimtest/indent/indent226.ex new file mode 100644 index 0000000..65d3394 --- /dev/null +++ b/vimtest/indent/indent226.ex @@ -0,0 +1,17 @@ +def resend_confirmation(username) when is_binary(username) do + with user = %User{confirmed_at: nil} <- get_by(username: username) do + {:ok, user} = + user + |> DB.add_confirm_token + |> update_user() + Log.info(%Log{user: user.id, message: "send new confirmation"}) + send_welcome(user) + {:ok, user} + else + nil -> + {:error, "not found"} + %User{email: email} -> + Email.already_confirmed(email) + {:error, "already confirmed"} + end +end diff --git a/vimtest/indent/indent227.ex b/vimtest/indent/indent227.ex new file mode 100644 index 0000000..8604c7e --- /dev/null +++ b/vimtest/indent/indent227.ex @@ -0,0 +1,14 @@ +def create_user(params) do + profile = UserProfile.registration_changeset(%UserProfile{}, params) + + user_cs = + %User{} + |> User.registration_changeset(params) + |> put_assoc(:user_profile, profile) + + with {:ok, user} <- Repo.insert(user_cs, returning: false) do + Log.info(%Log{user: user.id, message: "user created"}) + send_welcome(user) + {:ok, user} + end +end diff --git a/vimtest/indent/indent228.ex b/vimtest/indent/indent228.ex new file mode 100644 index 0000000..1d3771f --- /dev/null +++ b/vimtest/indent/indent228.ex @@ -0,0 +1,6 @@ +def my_function do + with :ok <- some_call, + :ok <- another_call do + + end +end diff --git a/vimtest/indent/indent229.ex b/vimtest/indent/indent229.ex new file mode 100644 index 0000000..c531bc9 --- /dev/null +++ b/vimtest/indent/indent229.ex @@ -0,0 +1,4 @@ +with {:ok, foo} <- thing(1), + {:ok, bar} <- thing(2) do + foo + bar +end diff --git a/vimtest/indent/indent23.ex b/vimtest/indent/indent23.ex new file mode 100644 index 0000000..09454d8 --- /dev/null +++ b/vimtest/indent/indent23.ex @@ -0,0 +1,13 @@ +defmodule Hello.World do + def some_func do + cond do + {:abc} -> + say_hello + say_goodbye + + _ -> + say_hello + say_goodbye + end + end +end diff --git a/vimtest/indent/indent24.ex b/vimtest/indent/indent24.ex new file mode 100644 index 0000000..275481d --- /dev/null +++ b/vimtest/indent/indent24.ex @@ -0,0 +1,21 @@ +defmodule Hello.World do + def some_func do + cond do + {:abc} -> + cond do + {:abc} -> + say_hello + say_goodbye + _ -> + say_hello + say_goodbye + end + say_hello + say_goodbye + + _ -> + say_hello + say_goodbye + end + end +end diff --git a/vimtest/indent/indent25.ex b/vimtest/indent/indent25.ex new file mode 100644 index 0000000..3509b6f --- /dev/null +++ b/vimtest/indent/indent25.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + case word do + :one -> :two + :high -> :low + end + end +end diff --git a/vimtest/indent/indent26.ex b/vimtest/indent/indent26.ex new file mode 100644 index 0000000..b8c89a2 --- /dev/null +++ b/vimtest/indent/indent26.ex @@ -0,0 +1,9 @@ +defmodule Hello do + def hello do + case word do + :one -> :two + + :high -> :low + end + end +end diff --git a/vimtest/indent/indent27.ex b/vimtest/indent/indent27.ex new file mode 100644 index 0000000..38e3960 --- /dev/null +++ b/vimtest/indent/indent27.ex @@ -0,0 +1,11 @@ +defmodule Hello do + def hello do + case word do + :one -> + :two + + :high -> + :low + end + end +end diff --git a/vimtest/indent/indent28.ex b/vimtest/indent/indent28.ex new file mode 100644 index 0000000..ab2fb72 --- /dev/null +++ b/vimtest/indent/indent28.ex @@ -0,0 +1,18 @@ +defmodule Hello do + def hello do + case word do + :one -> + case word do + :one -> + :two + + :high -> + :low + end + :two + + :high -> + :low + end + end +end diff --git a/vimtest/indent/indent29.ex b/vimtest/indent/indent29.ex new file mode 100644 index 0000000..7fdfb49 --- /dev/null +++ b/vimtest/indent/indent29.ex @@ -0,0 +1,7 @@ +defmodule Hello do + defmacro hello do + quote do + blah + end + end +end diff --git a/vimtest/indent/indent3.ex b/vimtest/indent/indent3.ex new file mode 100644 index 0000000..5b61c09 --- /dev/null +++ b/vimtest/indent/indent3.ex @@ -0,0 +1,7 @@ +defmodule Test do + def lol do + Enum.map([1,2,3], fn x -> + x * 3 + end) + end +end diff --git a/vimtest/indent/indent30.ex b/vimtest/indent/indent30.ex new file mode 100644 index 0000000..0249ef5 --- /dev/null +++ b/vimtest/indent/indent30.ex @@ -0,0 +1,7 @@ +defmodule Hello do + def hello do + unless blah do + blah + end + end +end diff --git a/vimtest/indent/indent31.ex b/vimtest/indent/indent31.ex new file mode 100644 index 0000000..e5a5d60 --- /dev/null +++ b/vimtest/indent/indent31.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + if stinky?, do: clean + if smelly?, do: clean + end +end diff --git a/vimtest/indent/indent32.ex b/vimtest/indent/indent32.ex new file mode 100644 index 0000000..bbc6819 --- /dev/null +++ b/vimtest/indent/indent32.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name = + "one" + street = + "two" + end +end diff --git a/vimtest/indent/indent33.ex b/vimtest/indent/indent33.ex new file mode 100644 index 0000000..bbc6819 --- /dev/null +++ b/vimtest/indent/indent33.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name = + "one" + street = + "two" + end +end diff --git a/vimtest/indent/indent34.ex b/vimtest/indent/indent34.ex new file mode 100644 index 0000000..3cd86ac --- /dev/null +++ b/vimtest/indent/indent34.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name = "one" + street = "two" + end +end diff --git a/vimtest/indent/indent35.ex b/vimtest/indent/indent35.ex new file mode 100644 index 0000000..48d9faa --- /dev/null +++ b/vimtest/indent/indent35.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name == + "one" + street == + "two" + end +end diff --git a/vimtest/indent/indent36.ex b/vimtest/indent/indent36.ex new file mode 100644 index 0000000..12619b4 --- /dev/null +++ b/vimtest/indent/indent36.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name == "one" + street == "two" + end +end diff --git a/vimtest/indent/indent37.ex b/vimtest/indent/indent37.ex new file mode 100644 index 0000000..dae2ff4 --- /dev/null +++ b/vimtest/indent/indent37.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name === + "one" + street === + "two" + end +end diff --git a/vimtest/indent/indent38.ex b/vimtest/indent/indent38.ex new file mode 100644 index 0000000..e4f0fed --- /dev/null +++ b/vimtest/indent/indent38.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name === "one" + street === "two" + end +end diff --git a/vimtest/indent/indent39.ex b/vimtest/indent/indent39.ex new file mode 100644 index 0000000..72429e1 --- /dev/null +++ b/vimtest/indent/indent39.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name != + "one" + street != + "two" + end +end diff --git a/vimtest/indent/indent4.ex b/vimtest/indent/indent4.ex new file mode 100644 index 0000000..41f6a06 --- /dev/null +++ b/vimtest/indent/indent4.ex @@ -0,0 +1,6 @@ +fizzbuzz = fn + 0, 0, _ -> "FizzBuzz" + 0, _, _ -> "Fizz" + _, 0, _ -> "Buzz" + _, _, x -> x +end diff --git a/vimtest/indent/indent40.ex b/vimtest/indent/indent40.ex new file mode 100644 index 0000000..683b92b --- /dev/null +++ b/vimtest/indent/indent40.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name != "one" + street != "two" + end +end diff --git a/vimtest/indent/indent41.ex b/vimtest/indent/indent41.ex new file mode 100644 index 0000000..1979ff4 --- /dev/null +++ b/vimtest/indent/indent41.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name !== + "one" + street !== + "two" + end +end diff --git a/vimtest/indent/indent42.ex b/vimtest/indent/indent42.ex new file mode 100644 index 0000000..68bbbfd --- /dev/null +++ b/vimtest/indent/indent42.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name !== "one" + street !== "two" + end +end diff --git a/vimtest/indent/indent43.ex b/vimtest/indent/indent43.ex new file mode 100644 index 0000000..6729098 --- /dev/null +++ b/vimtest/indent/indent43.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name <= + "one" + street <= + "two" + end +end diff --git a/vimtest/indent/indent44.ex b/vimtest/indent/indent44.ex new file mode 100644 index 0000000..5b48983 --- /dev/null +++ b/vimtest/indent/indent44.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name <= "one" + street <= "two" + end +end diff --git a/vimtest/indent/indent45.ex b/vimtest/indent/indent45.ex new file mode 100644 index 0000000..8b67a7c --- /dev/null +++ b/vimtest/indent/indent45.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name >= + "one" + street >= + "two" + end +end diff --git a/vimtest/indent/indent46.ex b/vimtest/indent/indent46.ex new file mode 100644 index 0000000..4acbe9f --- /dev/null +++ b/vimtest/indent/indent46.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name >= "one" + street >= "two" + end +end diff --git a/vimtest/indent/indent47.ex b/vimtest/indent/indent47.ex new file mode 100644 index 0000000..bdaf96a --- /dev/null +++ b/vimtest/indent/indent47.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name <> + "one" + street <> + "two" + end +end diff --git a/vimtest/indent/indent48.ex b/vimtest/indent/indent48.ex new file mode 100644 index 0000000..85b95a5 --- /dev/null +++ b/vimtest/indent/indent48.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name <> "one" + street <> "two" + end +end diff --git a/vimtest/indent/indent49.ex b/vimtest/indent/indent49.ex new file mode 100644 index 0000000..314a7de --- /dev/null +++ b/vimtest/indent/indent49.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name && + "one" + street && + "two" + end +end diff --git a/vimtest/indent/indent5.ex b/vimtest/indent/indent5.ex new file mode 100644 index 0000000..74cb89d --- /dev/null +++ b/vimtest/indent/indent5.ex @@ -0,0 +1,6 @@ +fizzbuzz = function do + 0, 0, _ -> "FizzBuzz" + 0, _, _ -> "Fizz" + _, 0, _ -> "Buzz" + _, _, x -> x +end diff --git a/vimtest/indent/indent50.ex b/vimtest/indent/indent50.ex new file mode 100644 index 0000000..ac5d9a6 --- /dev/null +++ b/vimtest/indent/indent50.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name && "one" + street && "two" + end +end diff --git a/vimtest/indent/indent51.ex b/vimtest/indent/indent51.ex new file mode 100644 index 0000000..db6347a --- /dev/null +++ b/vimtest/indent/indent51.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name || + "one" + street || + "two" + end +end diff --git a/vimtest/indent/indent52.ex b/vimtest/indent/indent52.ex new file mode 100644 index 0000000..408d32c --- /dev/null +++ b/vimtest/indent/indent52.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name || "one" + street || "two" + end +end diff --git a/vimtest/indent/indent53.ex b/vimtest/indent/indent53.ex new file mode 100644 index 0000000..a70e4f3 --- /dev/null +++ b/vimtest/indent/indent53.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name + + "one" + street + + "two" + end +end diff --git a/vimtest/indent/indent54.ex b/vimtest/indent/indent54.ex new file mode 100644 index 0000000..ed57692 --- /dev/null +++ b/vimtest/indent/indent54.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name + "one" + street + "two" + end +end diff --git a/vimtest/indent/indent55.ex b/vimtest/indent/indent55.ex new file mode 100644 index 0000000..623419c --- /dev/null +++ b/vimtest/indent/indent55.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name - + "one" + street - + "two" + end +end diff --git a/vimtest/indent/indent56.ex b/vimtest/indent/indent56.ex new file mode 100644 index 0000000..633ef57 --- /dev/null +++ b/vimtest/indent/indent56.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name - "one" + street - "two" + end +end diff --git a/vimtest/indent/indent57.ex b/vimtest/indent/indent57.ex new file mode 100644 index 0000000..6b26b6b --- /dev/null +++ b/vimtest/indent/indent57.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name * + "one" + street * + "two" + end +end diff --git a/vimtest/indent/indent58.ex b/vimtest/indent/indent58.ex new file mode 100644 index 0000000..9c67606 --- /dev/null +++ b/vimtest/indent/indent58.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name * "one" + street * "two" + end +end diff --git a/vimtest/indent/indent59.ex b/vimtest/indent/indent59.ex new file mode 100644 index 0000000..37996cb --- /dev/null +++ b/vimtest/indent/indent59.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name / + "one" + street / + "two" + end +end diff --git a/vimtest/indent/indent6.ex b/vimtest/indent/indent6.ex new file mode 100644 index 0000000..b650f07 --- /dev/null +++ b/vimtest/indent/indent6.ex @@ -0,0 +1,6 @@ +{:ok, 0} = Mod.exec!(cmd, fn progress -> + if event_handler do + event_handler.({:progress_updated, progress}) + end +end +) diff --git a/vimtest/indent/indent60.ex b/vimtest/indent/indent60.ex new file mode 100644 index 0000000..83278c2 --- /dev/null +++ b/vimtest/indent/indent60.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name / "one" + street / "two" + end +end diff --git a/vimtest/indent/indent61.ex b/vimtest/indent/indent61.ex new file mode 100644 index 0000000..ed7ce3f --- /dev/null +++ b/vimtest/indent/indent61.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name ~~~ + "one" + street ~~~ + "two" + end +end diff --git a/vimtest/indent/indent62.ex b/vimtest/indent/indent62.ex new file mode 100644 index 0000000..6c7c38b --- /dev/null +++ b/vimtest/indent/indent62.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name ~~~ "one" + street ~~~ "two" + end +end diff --git a/vimtest/indent/indent63.ex b/vimtest/indent/indent63.ex new file mode 100644 index 0000000..2588813 --- /dev/null +++ b/vimtest/indent/indent63.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name ^^^ + "one" + street ^^^ + "two" + end +end diff --git a/vimtest/indent/indent64.ex b/vimtest/indent/indent64.ex new file mode 100644 index 0000000..886c452 --- /dev/null +++ b/vimtest/indent/indent64.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name ^^^ "one" + street ^^^ "two" + end +end diff --git a/vimtest/indent/indent65.ex b/vimtest/indent/indent65.ex new file mode 100644 index 0000000..fb350c5 --- /dev/null +++ b/vimtest/indent/indent65.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name <<< + "one" + street <<< + "two" + end +end diff --git a/vimtest/indent/indent66.ex b/vimtest/indent/indent66.ex new file mode 100644 index 0000000..5a2c157 --- /dev/null +++ b/vimtest/indent/indent66.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name <<< "one" + street <<< "two" + end +end diff --git a/vimtest/indent/indent67.ex b/vimtest/indent/indent67.ex new file mode 100644 index 0000000..8ab427d --- /dev/null +++ b/vimtest/indent/indent67.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name >>> + "one" + street >>> + "two" + end +end diff --git a/vimtest/indent/indent68.ex b/vimtest/indent/indent68.ex new file mode 100644 index 0000000..5ecb7dd --- /dev/null +++ b/vimtest/indent/indent68.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name >>> "one" + street >>> "two" + end +end diff --git a/vimtest/indent/indent69.ex b/vimtest/indent/indent69.ex new file mode 100644 index 0000000..7c61a32 --- /dev/null +++ b/vimtest/indent/indent69.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name ||| + "one" + street ||| + "two" + end +end diff --git a/vimtest/indent/indent7.ex b/vimtest/indent/indent7.ex new file mode 100644 index 0000000..16c47ea --- /dev/null +++ b/vimtest/indent/indent7.ex @@ -0,0 +1,8 @@ +defp handle_chunk(:err, line, state) do + update_in(state[:stderr], fn + true -> true + false -> false + end) + + Map.update(state, :stderr, [line], &(&1 ++ [line])) +end diff --git a/vimtest/indent/indent70.ex b/vimtest/indent/indent70.ex new file mode 100644 index 0000000..d50a8cd --- /dev/null +++ b/vimtest/indent/indent70.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name ||| "one" + street ||| "two" + end +end diff --git a/vimtest/indent/indent71.ex b/vimtest/indent/indent71.ex new file mode 100644 index 0000000..94939d0 --- /dev/null +++ b/vimtest/indent/indent71.ex @@ -0,0 +1,8 @@ +defmodule Hello do + def hello do + name &&& + "one" + street &&& + "two" + end +end diff --git a/vimtest/indent/indent72.ex b/vimtest/indent/indent72.ex new file mode 100644 index 0000000..2c0f8b6 --- /dev/null +++ b/vimtest/indent/indent72.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name &&& "one" + street &&& "two" + end +end diff --git a/vimtest/indent/indent73.ex b/vimtest/indent/indent73.ex new file mode 100644 index 0000000..a68690e --- /dev/null +++ b/vimtest/indent/indent73.ex @@ -0,0 +1,7 @@ +defmodule Hi do + def hi do + fn hello -> + :world + end + end +end diff --git a/vimtest/indent/indent74.ex b/vimtest/indent/indent74.ex new file mode 100644 index 0000000..3cd86ac --- /dev/null +++ b/vimtest/indent/indent74.ex @@ -0,0 +1,6 @@ +defmodule Hello do + def hello do + name = "one" + street = "two" + end +end diff --git a/vimtest/indent/indent75.ex b/vimtest/indent/indent75.ex new file mode 100644 index 0000000..121e8b9 --- /dev/null +++ b/vimtest/indent/indent75.ex @@ -0,0 +1,6 @@ +defmodule Hi do + def hi do + fn hello -> :world end + fn hello -> :world end + end +end diff --git a/vimtest/indent/indent76.ex b/vimtest/indent/indent76.ex new file mode 100644 index 0000000..faf5a02 --- /dev/null +++ b/vimtest/indent/indent76.ex @@ -0,0 +1,20 @@ +defmodule Hi do + def hi do + fn hello -> + case hello do + :one -> + case word do + :one -> + :two + + :high -> + :low + end + :two + + :high -> + :low + end + end + end +end diff --git a/vimtest/indent/indent77.ex b/vimtest/indent/indent77.ex new file mode 100644 index 0000000..e1efbd9 --- /dev/null +++ b/vimtest/indent/indent77.ex @@ -0,0 +1,11 @@ +hello = + "str" + |> Pipe.do_stuff + |> Pipe.do_stuff + + |> Pipe.do_stuff + |> Pipe.do_stuff(fn -> + more stuff + end) + + |> Pipe.do_stuff diff --git a/vimtest/indent/indent78.ex b/vimtest/indent/indent78.ex new file mode 100644 index 0000000..489f592 --- /dev/null +++ b/vimtest/indent/indent78.ex @@ -0,0 +1,9 @@ +defmodule Hi do + defp hi do + :hello + end + + defp hi do + :hello + end +end diff --git a/vimtest/indent/indent79.ex b/vimtest/indent/indent79.ex new file mode 100644 index 0000000..47e2332 --- /dev/null +++ b/vimtest/indent/indent79.ex @@ -0,0 +1,12 @@ +defmodule Hi do + defp hi do + [ + :one, + :two, + fn -> + :three + end, + :four + ] + end +end diff --git a/vimtest/indent/indent8.ex b/vimtest/indent/indent8.ex new file mode 100644 index 0000000..d233a97 --- /dev/null +++ b/vimtest/indent/indent8.ex @@ -0,0 +1,8 @@ +defp handle_chunk(:err, line, state) do + update_in(state[:stderr], fn + hello -> :ok + world -> :ok + end) + + Map.update(state, :stderr, [line], &(&1 ++ [line])) +end diff --git a/vimtest/indent/indent80.ex b/vimtest/indent/indent80.ex new file mode 100644 index 0000000..81acd42 --- /dev/null +++ b/vimtest/indent/indent80.ex @@ -0,0 +1,12 @@ +defmodule Hi do + defp hi do + { + :one, + :two, + fn -> + :three + end, + :four + } + end +end diff --git a/vimtest/indent/indent81.ex b/vimtest/indent/indent81.ex new file mode 100644 index 0000000..178af92 --- /dev/null +++ b/vimtest/indent/indent81.ex @@ -0,0 +1,12 @@ +defmodule Hi do + defp hi do + %Struct{ + :one, + :two, + fn -> + :three + end, + :four + } + end +end diff --git a/vimtest/indent/indent82.ex b/vimtest/indent/indent82.ex new file mode 100644 index 0000000..62f0d51 --- /dev/null +++ b/vimtest/indent/indent82.ex @@ -0,0 +1,12 @@ +defmodule Hi do + defp hi do + %{ + :one, + :two, + fn -> + :three + end, + :four + } + end +end diff --git a/vimtest/indent/indent83.ex b/vimtest/indent/indent83.ex new file mode 100644 index 0000000..20ef74c --- /dev/null +++ b/vimtest/indent/indent83.ex @@ -0,0 +1,13 @@ +defmodule Hi do + defp hi do + try do + raise "boom" + rescue + e in errs -> + IO.puts "one" + + _ -> + IO.puts "one" + end + end +end diff --git a/vimtest/indent/indent84.ex b/vimtest/indent/indent84.ex new file mode 100644 index 0000000..fcdc641 --- /dev/null +++ b/vimtest/indent/indent84.ex @@ -0,0 +1,13 @@ +defmodule Hi do + defp hi do + try do + raise "wtf" + catch + e -> + IO.puts "one" + + _ -> + IO.puts "one" + end + end +end diff --git a/vimtest/indent/indent85.ex b/vimtest/indent/indent85.ex new file mode 100644 index 0000000..0a877a1 --- /dev/null +++ b/vimtest/indent/indent85.ex @@ -0,0 +1,14 @@ +defmodule Hi do + defp hi do + receive do + {:hello, world} -> + :ok + after + 1000 -> + IO.puts "one" + + 2000 -> + IO.puts "one" + end + end +end diff --git a/vimtest/indent/indent86.ex b/vimtest/indent/indent86.ex new file mode 100644 index 0000000..234646b --- /dev/null +++ b/vimtest/indent/indent86.ex @@ -0,0 +1,11 @@ +defmodule Hi do + defp hi do + receive do + {:hello, world} -> + :ok + + _ -> + :err + end + end +end diff --git a/vimtest/indent/indent87.ex b/vimtest/indent/indent87.ex new file mode 100644 index 0000000..d4adcc3 --- /dev/null +++ b/vimtest/indent/indent87.ex @@ -0,0 +1,10 @@ +defmodule Hi do + defp hi do + fn + :ok -> + IO.puts :ok + _ -> + IO.puts :err + end + end +end diff --git a/vimtest/indent/indent88.ex b/vimtest/indent/indent88.ex new file mode 100644 index 0000000..cea6c1d --- /dev/null +++ b/vimtest/indent/indent88.ex @@ -0,0 +1,8 @@ +defmodule Hi do + defp hi do + fn + :ok -> IO.puts :ok + _ -> IO.puts :err + end + end +end diff --git a/vimtest/indent/indent89.ex b/vimtest/indent/indent89.ex new file mode 100644 index 0000000..3657445 --- /dev/null +++ b/vimtest/indent/indent89.ex @@ -0,0 +1,5 @@ +fun2 = fn :foo -> + :bar + 'end' +end + diff --git a/vimtest/indent/indent9.ex b/vimtest/indent/indent9.ex new file mode 100644 index 0000000..7b62859 --- /dev/null +++ b/vimtest/indent/indent9.ex @@ -0,0 +1,2 @@ +fn -> +end diff --git a/vimtest/indent/indent90.ex b/vimtest/indent/indent90.ex new file mode 100644 index 0000000..2aa2598 --- /dev/null +++ b/vimtest/indent/indent90.ex @@ -0,0 +1,4 @@ +fun2 = fn :foo -> + :bar + 'end' +end diff --git a/vimtest/indent/indent91.ex b/vimtest/indent/indent91.ex new file mode 100644 index 0000000..9dca50c --- /dev/null +++ b/vimtest/indent/indent91.ex @@ -0,0 +1,4 @@ +fun3 = fn :foo -> + :bar + :send +end diff --git a/vimtest/indent/indent92.ex b/vimtest/indent/indent92.ex new file mode 100644 index 0000000..da0f09d --- /dev/null +++ b/vimtest/indent/indent92.ex @@ -0,0 +1,5 @@ +defmodule Hi do + def hello_world do + "end" + 'end' + end diff --git a/vimtest/indent/indent93.ex b/vimtest/indent/indent93.ex new file mode 100644 index 0000000..9125f6f --- /dev/null +++ b/vimtest/indent/indent93.ex @@ -0,0 +1,8 @@ +word = + "h" + <> "e" + <> "l" + <> "l" + <> "o" + +IO.puts word diff --git a/vimtest/indent/indent94.ex b/vimtest/indent/indent94.ex new file mode 100644 index 0000000..b5c3e92 --- /dev/null +++ b/vimtest/indent/indent94.ex @@ -0,0 +1,5 @@ +def hello do + expected = "hello" + <> "world" + IO.puts expected +end diff --git a/vimtest/indent/indent95.ex b/vimtest/indent/indent95.ex new file mode 100644 index 0000000..aa42896 --- /dev/null +++ b/vimtest/indent/indent95.ex @@ -0,0 +1,6 @@ +def hello do + expected = + "hello" + <> "world" + IO.puts expected +end diff --git a/vimtest/indent/indent96.ex b/vimtest/indent/indent96.ex new file mode 100644 index 0000000..c8727a7 --- /dev/null +++ b/vimtest/indent/indent96.ex @@ -0,0 +1,7 @@ +alias Rumbl.Repo +alias Rumbl.Category + +for category <- ~w(Action Drama Romance Comedy Sci-fi) do + Repo.get_by(Category, name: category) || + Repo.insert!(%Category{name: category}) +end diff --git a/vimtest/indent/indent97.ex b/vimtest/indent/indent97.ex new file mode 100644 index 0000000..afdb660 --- /dev/null +++ b/vimtest/indent/indent97.ex @@ -0,0 +1,5 @@ +data = [ + "blah", + "blah2", # * + "blah3" +] diff --git a/vimtest/indent/indent98.ex b/vimtest/indent/indent98.ex new file mode 100644 index 0000000..453e678 --- /dev/null +++ b/vimtest/indent/indent98.ex @@ -0,0 +1,6 @@ +data = [ + "blah", + # + + "blah2", + "blah3" +] diff --git a/vimtest/indent/indent99.ex b/vimtest/indent/indent99.ex new file mode 100644 index 0000000..d991d31 --- /dev/null +++ b/vimtest/indent/indent99.ex @@ -0,0 +1,3 @@ +do + something +end diff --git a/vimtest/syntax/alias1.ex b/vimtest/syntax/alias1.ex new file mode 100644 index 0000000..9c72c31 --- /dev/null +++ b/vimtest/syntax/alias1.ex @@ -0,0 +1,3 @@ +# Enum +# elixirAlias +Enum.empty?(...) diff --git a/vimtest/syntax/alias2.ex b/vimtest/syntax/alias2.ex new file mode 100644 index 0000000..334e2bb --- /dev/null +++ b/vimtest/syntax/alias2.ex @@ -0,0 +1,3 @@ +# \. +# elixirOperator +Enum.empty?(...) diff --git a/vimtest/syntax/alias3.ex b/vimtest/syntax/alias3.ex new file mode 100644 index 0000000..0a48705 --- /dev/null +++ b/vimtest/syntax/alias3.ex @@ -0,0 +1,3 @@ +# empty +# elixirId +Enum.empty?(...)