PHPStorm 常用设置

参考版本 2019.3, 箭头(->)表示菜单顺序

常用设置菜单路径

  • 修改主题:

    Apperance & Behavior -> Apperance -> UI Options -> Theme

  • 代码自动(软)换行:

    Setting ->Editor -> General -> Soft Wraps -> 选择"Use soft wraps in editor", (新版本是"Soft-wrap files *", 添加需要自动换行的文件扩展名)

  • 修改代码字体:

    Setting ->Editor -> General -> Font

  • 注释用斜线不在行头:

    Setting ->Editor -> Code Style -> PHP -> Wrapping and Braces -> Keep when reformatting -> 取消"Comment at first column"

    以及:

    Setting ->Editor -> Code Style -> PHP -> Code Generation -> Comment Code -> 取消 “Line comment at first column”

    同时:

    Setting ->Editor -> Code Style -> HTML -> Code Generation -> Comments 下取消"Line commment at first column" 和 “Block commment at first column”

  • 代码自动完成的大小写区分取消:

    Setting ->Editor -> General -> Code Completion -> 取消 “Math case”

  • 大括号不换行

    Setting ->Editor -> Code Style -> PHP -> Wrapping and Braces -> Braces placement -> In class declaration 和 In function declaration 选择 End of line

  • EOL设置为unix格式:

    Setting ->Editor -> Code Style -> General -> Line Separtor 选择 “Unix and macOS(\n)”

  • 取消HTML属性的自动换行:

    Setting -> Editor -> Code Style -> HTML -> Other -> Wrap attributes 设置为 “Do not wrap”, 并取消"Wrap text".
    (那个"Hard wrap at"的默认值120在Editor -> Code Style -> Hard wrap at, 最大值是1000)

  • 取消输入引号时的自动补充:

    Setting ->Editor -> General -> Smart Keys 取消 “Surround selection on typeing quote or brace”

  • 选中相同文字高亮:

    Setting ->plugins -> 搜索 BrowseWordAtCaret 安装,然后重启; 然后进入 Settings -> Editor -> General -> Appearance -> Browse Word At Caret 勾选。
    如果想修改默认的颜色,在Settings -> Editor -> Colors & Font 或者 Color Scheme -> BrowseWordAtCaret 中进行修改,可以改成亮点的颜色。

  • else换行(不建议修改)

    Setting ->Editor -> Code Style -> PHP -> Warpping and Braces -> ‘if()’ statement -> 选中 “‘else’ on new line”

  • 修改搜索结果只显示前100个(100+ matches)的问题:

    顶部Help菜单 ->Edit Custom VM Options, 添加一行-Dide.usages.page.size=500就改成500了, 重启. (2019.3版本测试没问题)

    2021.2 版本中新增了设置Settings -> Advanced Settings -> Maximum number of results to show in Find In Path/Show Usages preview可以直接改.

  • 调整/关闭 SQL 代码背景色

Setting -> Editor -> Color Scheme -> General -> Code -> “Injected language fragment”,右边的 “Background” 复选框可以取消,或者选中后再选择一个自己喜欢的颜色。

  • 显示所有参数提示 (默认只显示非变量传入的参数提示)

Setting -> Editor -> Inlay hints -> PHP -> 选中 “Show name for all arguments”

或者: 在 “setting” 中 搜索"show parameter hints", 然后找到 “PHP” 对应的记录, 选中 “Show name for all arguments”

  • CSS代码保留单行块 (对html中的style块比较友好)
    Settings -> Editor -> Code Style -> Style Sheets -> CSSOther标签下, 下勾选 “Keep single-line blocks”

  • HTML中部分标签的子标签不缩进
    Settings -> Editor -> Code Style -> HTMLOther标签下, 在Do not indent children of里面添加不想缩进的标签, 比如: head

关闭不常用的代码检查

  • 对于thinkphp orm的table方法引起的"Non-static method ‘table’ should not be called statically, but clas has _magic"错误, 暂时取消 Editor -> Inspections -> PHP-> General ->"Dynamic method called as static"

  • Editor->Inspection->SQL:

    • No data sources configured
    • SQL dialect detection.
  • Editor->Inspection->HTML:

    • Anchor reference problems
    • File reference problems
    • Form input without an associated label or title attribute
    • Image size mismatch
    • Missing required attribute
    • Presentational HTML tag
    • Quirks mode(兼容模式检查).
  • Editor->Inspection->CSS:

    • Unused CSS selector.
  • Editor->Inspection->CSS->Probable bugs:

    • Missing generic font name.
  • Editor->Inspection->Javascript->ECMScript 6 migration aids:

    • ‘var’ used instead of ‘let’ or ‘const’.
  • Editor->Inspection->PHP: Statement has empty body:

    • Comments count as content
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值