• 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
  • 相关阅读:
    初始化一个Vue3项目
    android 解决webView底部留白问题
    九大高效的前端测试工具与框架
    SpringBoot (4)开发实用篇—监控
    第十三章《集合》第2节:List集合
    4大软件测试策略的特点和区别(单元测试、集成测试、确认测试和系统测试)
    搜索二叉树——寻找节点,插入节点,删除节点
    Unity TrailRenderer实现拖尾
    go语言初学(备忘)
    (2022版)一套教程搞定k8s安装到实战 | PV/PVC
  • 原文地址:https://blog.csdn.net/aben_sky/article/details/126915068