[vscode] 创建erlang gen_serve 文件快捷方式

点击左下角功能按钮,代码片段,新建全局代码片段,然后输入自定义内容就可以

复制代码
{
    "Erlang gen_server": {
        "prefix": "genserver",
        "body": [
            "-module(${1:module_name}).",
            "-behaviour(gen_server).",
            "",
            "%% API",
            "-export([start_link/0]).",
            "",
            "%% gen_server callbacks",
            "-export([init/1, handle_call/3, handle_cast/2, handle_info/2,",
            "         terminate/2, code_change/3]).",
            "",
            "-record(state, {}).",
            "",
            "%%%===================================================================",
            "%%% API",
            "%%%===================================================================",
            "",
            "start_link() ->",
            "    gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).",
            "",
            "%%%===================================================================",
            "%%% gen_server callbacks",
            "%%%===================================================================",
            "",
            "init([]) ->",
            "    {ok, #state{}}.",
            "",
            "handle_call(Request, _From, State) ->",
            "    lager:error(\"Unhandled call: ===> ~p\", [Request]),",
            "    Reply = ok,",
            "    {reply, Reply, State}.",
            "",
            "handle_cast(Msg, State) ->",
            "    lager:error(\"Unhandled cast: ===> ~p\", [Msg]),",
            "    {noreply, State}.",
            "",
            "handle_info(Info, State) ->",
            "    lager:error(\"Unhandled info: ===> ~p\", [Info]),",
            "    {noreply, State}.",
            "",
            "terminate(Reason, _State) ->",
            "    lager:error(\"Server terminated: ===> ~p\", [Reason]),",
            "    ok.",
            "",
            "code_change(_OldVsn, State, _Extra) ->",
            "    {ok, State}."
        ],
        "description": "Template for an Erlang gen_server"
    }
}
相关推荐
啊湘5 分钟前
vscode 使用 github (适用CURSOR等使用)
ide·vscode·github·cursor·mcp
云堆客栈2 小时前
基于vscode的markdown编辑器部署方案
ide·vscode·编辑器
OpenMiniServer3 小时前
AI + GitLab + VSCode:下一代开发工作流的革命性集成
人工智能·vscode·gitlab
dust_and_stars3 小时前
ubuntu24 安装vscode
ide·vscode·编辑器
Destiny_where4 小时前
Claude VSCode插件版接入强大的GLM(无需登录注册claude code)
ide·人工智能·vscode·编辑器·claude code
__雨夜星辰__4 小时前
VScode免密远程连接到Ubuntu(VMware17环境)虚拟机
ide·vscode·ubuntu
痞老板25 小时前
【Cmder】VSCode设置Cmder为内置终端
ide·vscode·编辑器
Albert Edison5 小时前
【Git】多人协作一(同一分支下)
git·vscode·svn·github
__雨夜星辰__5 小时前
VS Code 的Remote-SSH/Remote Development插件无法连接到 Ubuntu 系统下 的远程虚拟主机(VMware)
运维·vscode·ubuntu·ssh
风静如云5 小时前
VSCode:SSH后无法使用c0pil0t
vscode