[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"
    }
}
相关推荐
skywalk81631 天前
发布vscode插件到 VS Code 市场流程
ide·vscode·编辑器
牙牙要健康1 天前
Windows 下为 VSCode 配置 Anaconda:从零安装 Python 环境到完整配置教程
windows·vscode·python
蚂蚁不吃土&1 天前
VSCode 搜索显示补全
vscode
nuoyigui98892 天前
vscode中常用插件介绍xiaojie
ide·vscode·编辑器
不吃土豆的马铃薯2 天前
5.SGI STL 二级空间配置器 _S_chunk_alloc核心函数解析
开发语言·c++·vscode·c·内存池
陳10302 天前
Linux:工具Vscode的简单介绍
ide·vscode·编辑器
ChampaignWolf2 天前
VSCode Copilot 也能支持其他OpenAI兼容接口啦,可以使用其他模型(DeepSeek、Kimi、Qwen)和第三方转发API
ide·vscode·编辑器
XX風2 天前
VSCode + CMake + C++:配置文件体系完整说明
c++·ide·vscode
nebula-AI2 天前
VSCode SFTP 同步流程指南
ide·vscode·云计算·编辑器·ssh
jrrz08282 天前
Apollo OSQP库交叉编译
vscode·apollo·交叉编译·mpc·osqp