本文档介绍了笔者使用 Sublime Text 编辑器进行 Laravel 应用开发时的配置方案。
插件
以下插件显著提升了开发效率:
插件安装方法:使用 cmd + shift + p / alt + shift + p 打开命令面板,选择“安装插件”进行安装。
LSP 配置
LSP 插件依赖 Node.js,请先安装 Node.js:
安装 Intelephense:
npm -g i intelephense
在 Sublime Text 中,打开 Preferences > Package Settings > LSP > Servers > lsp-intelephense,配置如下:
{ "enabled": true, "command": [ "intelephense", "--stdio", ], "scopes": ["source.php", "embedding.php"], "syntaxes": ["packages/php/php.sublime-syntax"], "languageid": "php", "initializationoptions": { "clearcache": false, "licencekey": "", }, }
启用 LSP:在命令面板中选择 LSP: Enable Language Server。
Sublime Text 设置
使用 cmd + , / alt + , 打开设置文件,添加以下配置:
{ "ignored_packages": [ "git", "git blame", "gitgutter", "vintage", ], "save_on_focus_lost": true, "shell_exec_executable": "/bin/zsh", "shell_exec_output": "panel", "shell_exec_output_word_wrap": false }
按键绑定
添加以下按键绑定:
[ { "command": "lsp_symbol_definition", "args": { "side_by_side": false }, "keys": [ "super+enter" ], "context": [ { "key": "lsp.session_with_capability", "operator": "equal", "operand": "definitionprovider" }, { "key": "auto_complete_visible", "operator": "equal", "operand": false } ] }, // ... (其余按键绑定保持不变) ]
鼠标绑定
添加以下鼠标绑定:
[ { "button": "button1", "count": 1, "modifiers": ["super"], "press_command": "drag_select", "command": "lsp_symbol_definition" }, { "button": "button1", "count": 1, "modifiers": ["ctrl"], "press_command": "drag_select", "press_args": {"additive": true} } ]
更多细节请访问我的博客原文。
以上就是Sublime Text Config for Laravel的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号