[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"
    }
}
相关推荐
jerwey1 小时前
新版vscode+ copilot 下 copilot Agent 类型
ide·vscode·copilot·agent
智驾1 小时前
Claude Code + vscode + deepseek在Windows环境上的搭建教程
windows·vscode·claude
acanab2 小时前
vscode对isaac lab开发时包不能正常导入的问题
vscode·python
fengtangjiang2 小时前
VScode连接Claude code
ide·vscode·编辑器
咋吃都不胖lyh2 小时前
linux环境在vscode链接到一个git仓库,克隆和拉取详细命令行
linux·git·vscode
不做无法实现的梦~2 小时前
解决在vscode打不开codex插件的问题,一直在转圈圈
ide·vscode·编辑器
yangzheui6 小时前
使用vscode开发flutter项目环境配置
ide·vscode·flutter
HookJames7 小时前
解决Claude帐号被封,利用VSCode+OpenRouter搭建本地环境
ide·vscode·编辑器
@HNUSTer7 小时前
基于 Visual Studio Code 配置 Python 开发环境详细教程
ide·vscode·python·csdn开发云
linux修理工8 小时前
VSCODE 使用LMSTUDIO本地显卡amd588 开发app
ide·vscode·编辑器