如何配置 Atom 以折叠代码区域,例如## region_name 就像 Sublime Text 一样
How to configure Atom to fold code regions e.g. ## region_name like Sublime Text does
Sublime text 中的代码部分可以方便地折叠,例如:
## Client
def start_link(_\[]), do: GenServer.start_link(__MODULE__, %MainLink.State{mobile: mobile}, name: MLink)
def code(code), do: GenServer.call(MLink, {:code, code})
def fwd(v, dc_id), do: GenServer.cast(MLink, {:forward, v, dc_id})
def upload_done(is_big, id, name, parts, user_id), do: GenServer.cast(MLink, {:upload_done, is_big, id, name, parts, user_id})
def text(user_id, text), do: GenServer.cast(MLink, {:send_text, user_id, text})
def media(user_id, file), do: GenServer.cast(MLink, {:send_media, user_id, file})
def test(data), do: GenServer.cast(MLink, {:test, data})
def update_salt(salt, dc_id), do: GenServer.call(MLink, {:update_salt, salt, dc_id})
def reverse_geo(uid, msg_id, place), do: GenServer.cast(MLink, {:reverse_geo, uid, msg_id, place})
## Server
def init(s) do
GenServer.cast(self, :start)
{:ok, s}
end
def handle_cast(:start, s), do: {:noreply, _start(s)}
def handle_cast({:forward, v, dc_id}, s), do: {:noreply, forward(v, dc_id, s)}
def handle_cast({:send_text, user_id, text}, s), do: {:noreply, messages_sendText(user_id, text, s)}
def handle_cast({:send_media, user_id, file}, s), do: {:noreply, messages_sendMedia(user_id, file, s)}
def handle_cast({:upload_done, is_big, id, name, parts, user_id}, s), do: {:noreply, messages_uploaded(is_big, id, name, parts, user_id, s)}
def handle_cast({:test, data}, s), do: {:noreply, send_message(data, s, true)}
以上简单地折叠成
## Client
## Server
请问我们如何在 Atom 中启用类似功能?
嗯,我的默认情况下是通过将鼠标移到装订线(左侧的行号)上来实现的。它显示一个小三角形,您可以单击它来折叠该区域。
版本 1.11.1(禁用所有非核心包)。
Sublime text 中的代码部分可以方便地折叠,例如:
## Client
def start_link(_\[]), do: GenServer.start_link(__MODULE__, %MainLink.State{mobile: mobile}, name: MLink)
def code(code), do: GenServer.call(MLink, {:code, code})
def fwd(v, dc_id), do: GenServer.cast(MLink, {:forward, v, dc_id})
def upload_done(is_big, id, name, parts, user_id), do: GenServer.cast(MLink, {:upload_done, is_big, id, name, parts, user_id})
def text(user_id, text), do: GenServer.cast(MLink, {:send_text, user_id, text})
def media(user_id, file), do: GenServer.cast(MLink, {:send_media, user_id, file})
def test(data), do: GenServer.cast(MLink, {:test, data})
def update_salt(salt, dc_id), do: GenServer.call(MLink, {:update_salt, salt, dc_id})
def reverse_geo(uid, msg_id, place), do: GenServer.cast(MLink, {:reverse_geo, uid, msg_id, place})
## Server
def init(s) do
GenServer.cast(self, :start)
{:ok, s}
end
def handle_cast(:start, s), do: {:noreply, _start(s)}
def handle_cast({:forward, v, dc_id}, s), do: {:noreply, forward(v, dc_id, s)}
def handle_cast({:send_text, user_id, text}, s), do: {:noreply, messages_sendText(user_id, text, s)}
def handle_cast({:send_media, user_id, file}, s), do: {:noreply, messages_sendMedia(user_id, file, s)}
def handle_cast({:upload_done, is_big, id, name, parts, user_id}, s), do: {:noreply, messages_uploaded(is_big, id, name, parts, user_id, s)}
def handle_cast({:test, data}, s), do: {:noreply, send_message(data, s, true)}
以上简单地折叠成
## Client
## Server
请问我们如何在 Atom 中启用类似功能?
嗯,我的默认情况下是通过将鼠标移到装订线(左侧的行号)上来实现的。它显示一个小三角形,您可以单击它来折叠该区域。
版本 1.11.1(禁用所有非核心包)。