<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Peter</title>
    <description>The latest articles on DEV Community by Peter (@petereborn).</description>
    <link>https://dev.to/petereborn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1374562%2Fc2cf9e2c-7c79-43ee-8f97-fff5b279c481.jpg</url>
      <title>DEV Community: Peter</title>
      <link>https://dev.to/petereborn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/petereborn"/>
    <language>en</language>
    <item>
      <title>How to Automatically Document C# Code in Rider</title>
      <dc:creator>Peter</dc:creator>
      <pubDate>Fri, 22 Mar 2024 10:43:45 +0000</pubDate>
      <link>https://dev.to/petereborn/how-to-automatically-document-c-code-in-rider-4k0e</link>
      <guid>https://dev.to/petereborn/how-to-automatically-document-c-code-in-rider-4k0e</guid>
      <description>&lt;p&gt;&lt;a href="https://submain.com/ghostdoc/"&gt;GhostDoc&lt;/a&gt; is all you need if you're using Visual Studio on a Windows machine. &lt;/p&gt;

&lt;p&gt;But I use a Mac. The best IDE in the world is &lt;a href="https://www.jetbrains.com/rider/"&gt;JetBrains Rider&lt;/a&gt; since &lt;a href="https://devblogs.microsoft.com/visualstudio/visual-studio-for-mac-retirement-announcement/"&gt;Visual Studio for Mac is retired&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I couldn't find any good Rider plug-ins to do what GhostDoc does, so I used the top option code option from GitHub: &lt;a href="https://github.com/p1va/dotnet-document"&gt;dotnet-document&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;Following their install instructions, you'll need to add it globally. &lt;strong&gt;It's not officially released on Nuget which is why you need to specify the version. I encourage you to make sure you're &lt;a href="https://github.com/p1va/dotnet-document"&gt;using the latest&lt;/a&gt;.&lt;/strong&gt;. At the time of writing (March 2024), I had to run this in my terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet tool &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--global&lt;/span&gt; dotnet-document &lt;span class="nt"&gt;--version&lt;/span&gt; 0.1.9-alpha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it's installed, open Rider's settings and add an External Tool. Press &lt;code&gt;⌘Сmd ,&lt;/code&gt; to open the IDE settings and then go to &lt;code&gt;Tools | External Tools&lt;/code&gt;. Click the &lt;code&gt;+&lt;/code&gt; button to bring up the Add modal.&lt;/p&gt;

&lt;p&gt;Maybe you're here from the future and JetBrains changed something? &lt;a href="https://www.jetbrains.com/help/rider/Configuring_Third-Party_Tools.html#local-ext-tools"&gt;Follow these instructions&lt;/a&gt; if my instructions didn't work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl80lzfp4lg68vfgvfnha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl80lzfp4lg68vfgvfnha.png" alt="External tool config to apply to a specific file" width="571" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Above is my configuration for documenting a specific file.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Program: &lt;code&gt;dotnet&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Arguments: &lt;code&gt;document apply $FileName$&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Working directory: &lt;code&gt;$FileDir$&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: It's possible to document folders, supply project filename paths, solution filename paths, or just the current directory. You'll want to replace (or remove) the &lt;code&gt;$FileName$&lt;/code&gt; and explore the macros provided by Rider. Click the &lt;code&gt;+&lt;/code&gt; button to the right of Arguments to see the argument variables JetBrains provide.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmzfrsi851kq8rlu6xs9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmzfrsi851kq8rlu6xs9.png" alt="External tool config to apply to a folder" width="570" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Above is the setup for documenting a folder.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;OK&lt;/code&gt; to save your new tool and you're all set up! 🎉🎉&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Run
&lt;/h2&gt;

&lt;p&gt;It's simple: &lt;code&gt;Tools menu | External Tools | dotnet-document&lt;/code&gt; (or whatever you named your command). Test it out and make sure it works. &lt;strong&gt;Don't forget to commit before you test so that you can roll back any problems.&lt;/strong&gt; 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Keyboard Shortcuts
&lt;/h2&gt;

&lt;p&gt;It's also possible to add keyboard shortcuts, but I found it flaky to set up when you've got multiple external tools. It doesn't name them properly in the Keymap list. Just be aware of the order that you have them in you menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fev953qe4pfmpm3saedb7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fev953qe4pfmpm3saedb7.png" alt="My External Tools menu with two tools and a shortcut" width="564" height="71"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here's how my menu appears.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fafki7n6uxd450uo1l1ch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fafki7n6uxd450uo1l1ch.png" alt="My Keymap setup showing the order matches the menu" width="596" height="102"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And here's what it looks like in my Keymap.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Cover by &lt;a href="https://unsplash.com/@swimstaralex?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash"&gt;Alexander Sinn&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/a-heart-is-shown-on-a-computer-screen-KgLtFCgfC28?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>rider</category>
      <category>documentation</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
