other-编辑器Rider

other-编辑器Rider


前篇

  • a

编辑器设置


还原设置

  • a

    image-20230310211004298


去掉引用显示

  • settings -> editor -> code vision, 取消勾选 enable code vision

    image-20220710134208181


取消形参名显示

  • settings -> editor -> inlay hints -> c# parameter name hints, visibility 修改为 never show

image-20220710135044550


取消下划线建议提示

  • alt + enter

    image-20220811141951232


格式化代码

格式化代码时,{}不换行 - https://blog.csdn.net/assassinsshadow/article/details/81170749

image-20220710152253803


代码提示回车选中第一个

默认情况下,智能提示的第一行是灰色的,我们按回车时也并不会输入。

settings -> editor -> general -> code completion, 勾选 enter inserts suggestion …

image-20220710212933520


格式化设置


else try 等 block 换行
  • a

    image-20230310205007801


if 语句块 前后换行
  • a

    image-20230310210144305


花括号 不换行
  • a

    image-20230310211552585


单元测试

  1. 创建工程

    image-20220710210550727

  2. 因为主要是针对 unity 做开发, 所以设置一下库和语言版本

    https://docs.unity3d.com/2019.4/Documentation/Manual/CSharpCompiler.html

    Scripting Runtime Version C# compiler C# language version
    .NET 4.6 equivalent Roslyn C# 7.3

    右键 Test 模块 -> properties

    image-20220710211037842

    设置后工程会报错, 因为使用了 c# 10 的语法 global using

    1. 手动注释掉所有 global using
    2. 并且手动修改 Test/Test.csproj 增加 <ImplicitUsings>disable</ImplicitUsings> 配置, 用来禁用 global using 自动生成 image-20220710211314599
  3. done. 可以开始码了.


引用/解引用 模块

  • 引用

    右键 模块的 dependencies -> add reference, 勾选上其他模块. 会添加到 projects 里面

    image-20220713000326450

  • 解引用

    直接删除 projects 里面的模块

    image-20220713000515357


unity 设置 rider

  1. unity 下载 rider 包

    image-20230310104648399

  2. 设置编辑器为 rider

    image-20230310104817001

  3. done. 打开工程

    image-20230310104855033