VSCode编辑器中对PHP语言的支持

编辑器的下载:

https://code.visualstudio.com/Download

根据需要下载中文语言包

在这里插入图片描述

安装插件

easy less(CSS样式)
One Monokai Theme(VSCode主题)
PHP Debug (需要安装PHP扩展)
在这里插入图片描述PHP IntelliSense(增强VSCode对PHP语法支持提示)
Sublime Text Keymap and Settings Importer(Sublime的一些快捷键使用)
Vetur(增强VSCode对Vue语法支持提示)

设置VSCode

VsCode-setting.json
文件->首选项->设置->{}->粘贴

{
    // "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
    "editor.tabCompletion": "on",
    "editor.formatOnPaste": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.snippetSuggestions": "top",
    "files.autoSave": "off",
    "editor.fontSize": 18,
    "editor.fontWeight": "100",
    "breadcrumbs.enabled": true,
    "editor.renderWhitespace": "none",
    "editor.renderControlCharacters": true,
    "editor.minimap.enabled": true,
    "workbench.colorTheme": "One Monokai",
    "editor.mouseWheelZoom": true,
    "window.zoomLevel": 0,
    "vetur.validation.template": false,
    "php-cs-fixer.executablePath": "${extensionPath}\\php-cs-fixer.phar",
    "php-cs-fixer.lastDownload": 1559524432022,
    "php-cs-fixer.onsave": true,
    "php-cs-fixer.formatHtml": true,
    "[php]": {
        "editor.defaultFormatter": "junstyle.php-cs-fixer"
    },
    "php.validate.executablePath": "D:\\AppServ\\php7.1.18\\php.exe",
    "files.associations": {
        "*.cjson": "jsonc",
        "*.wxss": "css",
        "*.wxs": "javascript"
    },
    "emmet.includeLanguages": {
        "wxml": "html"
    },
    "minapp-vscode.disableAutoConfig": true,
    "terminal.integrated.rendererType": "dom"
}

在这里插入图片描述
VsCode快捷键设置.json
文件->首选项->键盘快捷方式->{}->粘贴

// 将密钥绑定放在此文件中以覆盖默认值
[
    // ctrl+d 删除一行
    {
        "key": "ctrl+d",
        "command": "editor.action.deleteLines",
        "when": "editorTextFocus"
    },
    // 与删除一行的快捷键互换
    {
        "key": "ctrl+shift+k",
        "command": "editor.action.addSelectionToNextFindMatch",
        "when": "editorFocus"
    },
    {
        "key": "ctrl+x",
        "command": "-extension.vim_ctrl+x",
        "when": "editorTextFocus && vim.active && vim.use<C-x> && !inDebugRepl"
    },
    {
        "key": "ctrl+a",
        "command": "-editor.action.webvieweditor.selectAll",
        "when": "!editorFocus && !inputFocus && activeEditor == 'workbench.editor.htmlPreviewPart'"
    },
    {
        "key": "ctrl+a",
        "command": "-editor.action.webvieweditor.selectAll",
        "when": "!editorFocus && !inputFocus && activeEditor == 'WebviewEditor'"
    },
    {
        "key": "ctrl+a",
        "command": "-list.selectAll",
        "when": "listFocus && listSupportsMultiselect && !inputFocus"
    },
    {
        "key": "ctrl+k a",
        "command": "-workbench.action.showErrorsWarnings"
    },
    {
        "key": "ctrl+a",
        "command": "-extension.vim_ctrl+a",
        "when": "editorTextFocus && vim.active && vim.use<C-a> && !inDebugRepl"
    },
    {
        "key": "ctrl+shift+c",
        "command": "-workbench.action.terminal.openNativeConsole",
        "when": "!terminalFocus"
    },
    {
        "key": "ctrl+c",
        "command": "-search.action.copyMatch",
        "when": "fileMatchOrMatchFocus"
    },
    {
        "key": "ctrl+c",
        "command": "-problems.action.copy",
        "when": "problemFocus"
    },
    {
        "key": "ctrl+c",
        "command": "-keybindings.editor.copyKeybindingEntry",
        "when": "inKeybindings && keybindingFocus"
    },
    {
        "key": "ctrl+c",
        "command": "-filesExplorer.copy",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
    },
    {
        "key": "ctrl+c",
        "command": "-extension.vim_ctrl+c",
        "when": "editorTextFocus && vim.active && vim.overrideCtrlC && vim.use<C-c> && !inDebugRepl"
    },
    {
        "key": "ctrl+v",
        "command": "-filesExplorer.paste",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
    },
    {
        "key": "ctrl+y",
        "command": "-extension.vim_ctrl+y",
        "when": "editorTextFocus && vim.active && vim.use<C-y> && !inDebugRepl"
    },
    {
        "key": "ctrl+insert",
        "command": "-editor.action.clipboardCopyAction",
        "when": "textInputFocus"
    },
    {
        "key": "ctrl+v",
        "command": "-extension.vim_ctrl+v",
        "when": "editorTextFocus && vim.active && vim.use<C-v> && !inDebugRepl"
    }
]

在这里插入图片描述

让VScode支持PHP函数跳转

前提是已经安装PHP Intelephense 插件

在首选项 =》设置 =》用户 =》扩展 =》PHP Intelephense 点击 在settings.json中编辑加入php程序执行路径
在这里插入图片描述
在这里插入图片描述

给VScode设置代码换行

在首选项 =》设置 搜索 Word Wrap 将状态改为 on
在这里插入图片描述

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Visual Studio Code (VSCode) 是一个强大的代码编辑器支持多种编程语言,包括PHP。在VSCode配置PHP开发环境,你需要设置PHP引擎、调试器以及路径等。下面是基本的设置步骤: 1. **安装PHP插件**:在VSCode扩展市场搜索并安装 "PHP" 或 "PHP Intelephense" 插件,它们提供了语法高亮和智能提示等功能。 2. **配置PHP解释器(Path)**: - 打开VSCode,转到 `File` > `Preferences` > `Settings`(或者使用快捷键 `Ctrl + ,`),然后输入 `php.validate.executablePath` 或 `php.interpreter.path`。 - 输入你的系统PHP解释器路径,比如 `/usr/bin/php` 或 `C:\Program Files\php\php.exe`。 3. **设置工作区(Workspace)路径**: - 如果你想在特定的文件夹启用PHP支持,可以在设置添加 `php.projectPath` 或 `php.workspaceRoot`。 4. **启动调试**:VSCode的Live Server插件或者安装如`php-debug`这样的调试扩展,用于设置断点和调试代码。 5. **代码片段和自动完成**: - 如果想自定义代码片段,可以在 `settings.json` 添加 `php.codeSnippets` 配置。 6. **自动格式化代码**: - 可以安装 `Prettier-Code formatter` 插件,对PHP代码进行格式化。 相关问题-- 1. 如何在VSCode启用PHP插件? 2. 如何检查是否正确配置了PHP解释器? 3. 怎样设置VSCode才能进行PHP代码的自动格式化? 请注意,具体路径和设置可能因操作系统和个人喜好而异。如果遇到问题,VSCode的内置帮助文档和社区论坛都是很好的资源。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值