MAC上的Visual Studio中的文件缩进

时间:2017-09-29 13:21:49

标签: c# visual-studio xamarin xamarin.forms visual-studio-mac

我见过一些应用程序,其中C#代码被分成不同的文件,每个文件都包含一个分部类。从我看来,它可以使这些在Mac上的Visual Studio中缩进,如下例所示:

file1
   file1.data
   file1.commands
   file1.bindings

有人可以告诉我如何实现这种视觉效果

1 个答案:

答案 0 :(得分:2)

只需在csproj文件中添加<DependentUpon />标记即可。

<Compile Include="file1.cs" />
<Compile Include="file1.data.cs">
  <DependentUpon>file1.cs</DependentUpon>
</Compile>
<Compile Include="file1.commands.cs">
  <DependentUpon>file1.cs</DependentUpon>
</Compile>
<Compile Include="file1. bindings.cs">
  <DependentUpon>file1.cs</DependentUpon>
</Compile>

我认为除非你安装扩展程序,否则在visual-studio中有一个快捷方式。您必须在文本编辑器中手动编辑csproj。此外,我认为还没有适用于VS for Mac的插件。

参考文献:

  1. Nesting Files In Visual Studio
  2. Introducing File Nestor for Visual Studio
  3. 编辑1 看起来有一个nesting add-in(测试版)可用于MonoDevelop - 反过来应该与VS for Mac兼容。