<?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: Coder</title>
    <description>The latest articles on DEV Community by Coder (@coder).</description>
    <link>https://dev.to/coder</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%2Forganization%2Fprofile_image%2F3128%2F0f7e21e6-c3d7-44e6-871f-b7061cfabee2.png</url>
      <title>DEV Community: Coder</title>
      <link>https://dev.to/coder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/coder"/>
    <language>en</language>
    <item>
      <title>Faster JetBrains IDEs with shared indexes</title>
      <dc:creator>Ben Potter</dc:creator>
      <pubDate>Sun, 02 Jan 2022 21:53:11 +0000</pubDate>
      <link>https://dev.to/coder/faster-jetbrains-ides-with-shared-indexes-10n1</link>
      <guid>https://dev.to/coder/faster-jetbrains-ides-with-shared-indexes-10n1</guid>
      <description>&lt;p&gt;If you develop with IntelliJ IDEA, PyCharm, GoLand, or other JetBrains IDEs,  it’s likely you’ve waited for “indexing” to complete after opening a project. While this may be annoying, it’s necessary for IntelliJ and other heavy-weight IDEs to have features such as code search, highlighting, refactoring, and code completion.&lt;/p&gt;

&lt;p&gt;Waiting for an IDE to finish indexing a project might not be a big problem for many workflows. After the first load, indexes are cached and subsequent runs are faster. However, indexing time can be a huge blocker for developers, especially in these cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;large projects (monorepos, many dependencies, monolithic applications)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;running old/slow machines (indexing is CPU-intensive)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ephemeral developer workspaces (containers, remote IDEs)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksoux60kx7ntmfu4fywr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksoux60kx7ntmfu4fywr.png" alt="edit of xkcd's "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post, we’ll cover how &lt;a href="https://www.jetbrains.com/help/idea/shared-indexes.html" rel="noopener noreferrer"&gt;shared indexes&lt;/a&gt; can significantly reduce IDE load times, share some examples, and a one-line command to generate these for your project. (Historically, shared indexes have been difficult to set up)&lt;/p&gt;

&lt;h2&gt;
  
  
  First, how indexing works
&lt;/h2&gt;

&lt;p&gt;Indexing works by traversing the project’s codebase to create a “virtual map” of classes, methods, and objects for future lookups. After the index is generated, it is cached on your device for later use.&lt;/p&gt;

&lt;p&gt;Indexing a codebase will likely take the longest &lt;strong&gt;the first time you open it on your machine&lt;/strong&gt;. When the codebase changes, such as pulling code or switching branches, your indexes will “update,” but significantly faster than the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shared indexes ⚡
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.jetbrains.com/help/idea/shared-indexes.html" rel="noopener noreferrer"&gt;Shared indexes&lt;/a&gt; make it possible to host pre-generated indexes for others to download, significantly improving loading speeds across your team. These remote indexes work in conjunction with local indexing to ensure your IDE always has up-to-date information on the codebase.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.datocms-assets.com%2F19109%2F1639079914-final61b24be6b9a30400a127b80d760422.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.datocms-assets.com%2F19109%2F1639079914-final61b24be6b9a30400a127b80d760422.gif" alt="Comparison: local vs shared indexes"&gt;&lt;/a&gt;GIF: Loading the code-server project in WebStorm&lt;/p&gt;

&lt;h2&gt;
  
  
  Generating shared indexes for your project
&lt;/h2&gt;

&lt;p&gt;JetBrains has a &lt;a href="https://www.jetbrains.com/help/idea/shared-indexes.html" rel="noopener noreferrer"&gt;guide for creating shared indexes&lt;/a&gt;, but it involves many steps, including downloading custom tooling and uploading indexes to a CDN. It also lacks instructions for automating this process, to generate indexes in CI, for example.&lt;/p&gt;

&lt;p&gt;Using a Docker container to generate shared indexes makes it simple to try locally or automate with cron/CI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your_large_codebase/

&lt;span class="c"&gt;# generate shared indexes&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:/var/project &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;/indexes-output:/shared-index &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;INDEXES_CDN_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://cdn.myserver.com/project &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  bencdr/indexer:idea-2021.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;After generating indexes, you can upload the output folder to your CDN, or a local server. You can also use shared indexes without a CDN by using a network share or even your local filesystem for testing. Check out my &lt;a href="https://github.com/bpmct/indexer" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt; for details:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/bpmct" rel="noopener noreferrer"&gt;
        bpmct
      &lt;/a&gt; / &lt;a href="https://github.com/bpmct/jetbrains-indexer" rel="noopener noreferrer"&gt;
        jetbrains-indexer
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Generate &amp;amp; package JetBrains shared indexes with a Docker container.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;h2&gt;
  
  
  Benchmarking shared indexes
&lt;/h2&gt;

&lt;p&gt;I tested indexing time for some popular projects on my 2019 MacBook Pro. To benchmark your own projects, &lt;code&gt;File → Invalidate Caches&lt;/code&gt; in your IDE will allow you to opt in/out of downloading shared indexes to simulate first launching your project.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project&lt;/th&gt;
&lt;th&gt;Language(s)&lt;/th&gt;
&lt;th&gt;Local indexing 🐌&lt;/th&gt;
&lt;th&gt;With shared indexes ⚡&lt;/th&gt;
&lt;th&gt;Improvement %&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/kubernetes/kubernetes" rel="noopener noreferrer"&gt;kubernetes/kubernetes&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;2m 40s&lt;/td&gt;
&lt;td&gt;22s&lt;/td&gt;
&lt;td&gt;727%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/cdr/code-server" rel="noopener noreferrer"&gt;cdr/code-server&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Typescript&lt;/td&gt;
&lt;td&gt;2m 30s&lt;/td&gt;
&lt;td&gt;34s&lt;/td&gt;
&lt;td&gt;441%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Coder internal monorepo&lt;/td&gt;
&lt;td&gt;Go &amp;amp; Typescript&lt;/td&gt;
&lt;td&gt;3m 20s&lt;/td&gt;
&lt;td&gt;32s&lt;/td&gt;
&lt;td&gt;625%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/jetbrains-intellij-community" rel="noopener noreferrer"&gt;jetbrains/intellij-community&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;6m 30s&lt;/td&gt;
&lt;td&gt;2m 15s&lt;/td&gt;
&lt;td&gt;288%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These times were averaged across two test runs. Your mileage will vary depending on network speeds, device performance, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Remote development &amp;amp; shared indexes
&lt;/h2&gt;

&lt;p&gt;Recently, JetBrains released &lt;a href="https://www.jetbrains.com/remote-development/" rel="noopener noreferrer"&gt;remote development support&lt;/a&gt;, making it simple to develop from powerful, remote workspaces. On-demand workspaces have a lot of benefits, such as faster onboarding and better reproducibility. However, first-time indexing happens much more frequently, since, after all, workspaces are meant to be ephemeral.&lt;/p&gt;

&lt;p&gt;Shared indexes work with &lt;a href="https://coder.com" rel="noopener noreferrer"&gt;Coder&lt;/a&gt;, our remote development platform. Coder supports all JetBrains IDEs locally, or via the web browser. If you don’t want to host a CDN for shared indexes, you can include them in the workspace image, so everything loads in a snap ⚡&lt;/p&gt;

&lt;p&gt;If you’d like to learn more about Coder, you can &lt;a href="https://coder.com/demo" rel="noopener noreferrer"&gt;request a demo&lt;/a&gt; or &lt;a href="https://coder.com/trial" rel="noopener noreferrer"&gt;try it for free&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=xJKff0QUd3c" rel="noopener noreferrer"&gt;Talk: Indexing, or How We Made Indexes Shared and Fast&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jetbrains.com/remote-development/" rel="noopener noreferrer"&gt;JetBrains Remote Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jetbrains.com/help/idea/shared-indexes.html" rel="noopener noreferrer"&gt;JetBrains docs: Indexing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/damintsew/idea-shared-index-dockerfile" rel="noopener noreferrer"&gt;GitHub: idea-shared-index-dockerfile&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>productivity</category>
      <category>tooling</category>
      <category>performance</category>
      <category>devops</category>
    </item>
    <item>
      <title>I developed on an iPad for two weeks: Here’s what I learned</title>
      <dc:creator>Joe Previte (he/him)</dc:creator>
      <pubDate>Mon, 08 Feb 2021 21:24:31 +0000</pubDate>
      <link>https://dev.to/coder/i-developed-on-an-ipad-for-two-weeks-here-s-what-i-learned-2dda</link>
      <guid>https://dev.to/coder/i-developed-on-an-ipad-for-two-weeks-here-s-what-i-learned-2dda</guid>
      <description>&lt;p&gt;“We’re going to send this to Apple and you should get it back in 5-7 business days.”&lt;/p&gt;

&lt;p&gt;And this is how the first work week of 2021 started for me — my brand new MacBook Pro keyboard unusable and out of my possession for what could be two weeks. Fortunately, my coworker had sent me an iPad testing device a few days prior. The timing couldn’t have been better. &lt;/p&gt;

&lt;p&gt;I made a decision.&lt;/p&gt;

&lt;p&gt;I insisted to my manager and HR that I could use the iPad while I waited for my laptop to be repaired instead of letting them send me a new laptop. Plus, it gave me an excuse to answer the question, “Could I work and develop full-time off an iPad?”&lt;/p&gt;

&lt;p&gt;Here’s what I learned. &lt;/p&gt;

&lt;h3&gt;
  
  
  You can use an External Monitor, Keyboard, and Mouse
&lt;/h3&gt;

&lt;p&gt;My home office setup includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.dell.com/en-us/work/shop/dell-ultrasharp-49-curved-monitor-u4919dw/apd/210-arnw/monitors-monitor-accessories"&gt;Dell UltraSharp 49 Inch Curved Monitor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gaming.kinesis-ergo.com/product/freestyle-edge/"&gt;Kinesis Freestyle Edge RGB Keyboard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.logitech.com/en-us/products/mice/mx-vertical-ergonomic-mouse.910-005447.html"&gt;Logitech MX Vertical Mouse&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At first I thought I couldn’t use these with the iPad. After some trial and error, it turns out you can! I connected the keyboard via USB to the monitor and then the monitor via USB-C to the iPad and it “just works.” The mouse was easy to connect via bluetooth.&lt;/p&gt;

&lt;p&gt;The iPad mirrors the display to the monitor, which means you don’t get the screen real estate you do with a laptop, but it’s better than nothing. There were also some apps which would not mirror to the external monitor — most notably the &lt;a href="https://apps.apple.com/us/app/hey-email/id1506603805"&gt;HEY email app&lt;/a&gt; and the &lt;a href="https://apps.apple.com/us/app/github/id1477376905"&gt;GitHub app&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  VS Code on iPad feels like magic
&lt;/h3&gt;

&lt;p&gt;I still can’t believe you can use VS Code on an iPad. Using Coder, I created an environment for me to work on &lt;a href="https://github.com/cdr/code-server"&gt;code-server&lt;/a&gt;.  I was then able to install the editor (code-server) as a PWA and use VS Code as if it were a native app on iOS. The experience is magical. You feel powerful, like you can take your editor anywhere you’d like. And thanks to the Dev URLs, I can run apps on any port, and create a Dev URL to access them from the browser. This made my life a lot easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  iPads as Devices are Portable and Powerful
&lt;/h3&gt;

&lt;p&gt;The battery of the iPad surprised me. It felt like it lasted way longer than I would have expected. The performance felt fast. There was hardly ever any lag. With the &lt;a href="https://www.apple.com/shop/product/MXQT2LL/A/magic-keyboard-for-ipad-air-4th-generation-and-ipad-pro-11-inch-2nd-generation-us-english?fnode=82651b35918e7b97be7affb0d2cd40a464cef34423cb0ddd46057f28faa88c2527d5799434e185f9dfa475fd532a9be679980054a1578da13111439ae8a1a8797c03cc072265d3761210b6bfc4019962bf99e5aa3df18e4c2b889e146aef35ce204fcf3ea663c4a58e4a298b791697d3"&gt;Magic Keyboard&lt;/a&gt;, I felt like I could take the iPad anywhere and start coding. It was liberating. In addition, I loved having the cmd + shift + 4 shortcut for taking screenshots and the &lt;a href="https://support.apple.com/en-us/HT207935"&gt;built-in screen recording&lt;/a&gt; added in iOS 14. &lt;/p&gt;

&lt;h3&gt;
  
  
  Didn’t have much use for Apple Pencil
&lt;/h3&gt;

&lt;p&gt;Along with the Magic Keyboard, I had the Apple Pencil at my disposal with my iPad. Unfortunately, I didn’t find much use for it. I am not blaming Apple or the iPad for that, but rather myself. I think if I were more of a designer, there would be use. Or if I were a student in college taking notes, I could use it. I didn’t have much use for it and can’t say I recommend it to fellow developers considering a full-time iPad setup. &lt;/p&gt;

&lt;h3&gt;
  
  
  Browsers are Inconsistent
&lt;/h3&gt;

&lt;p&gt;Sadly, one of my main frustrations was the lack of consistency for browsers on iOS. My preferred browser is Firefox. However, there were a number of bugs which caused me to switch over to Chrome. The keyboard shortcuts I was used to from desktop did not always map over to the iOS apps, which slowed down my workflow significantly. There are also a number of UX-related issues for mobile apps. Chrome wasn’t perfect, but it was better than Safari in most aspects. My one wish: make a browser that is consistent across platforms and stable. &lt;/p&gt;

&lt;h3&gt;
  
  
  Use the PWA and Gain Control Over Keyboard Shortcuts
&lt;/h3&gt;

&lt;p&gt;If you’re going to work off an iPad and write code, being able to download your editor either as a native app or a PWA is a must. This is the only way for you to get keyboard shortcuts that don’t conflict with global or app shortcuts.&lt;/p&gt;

&lt;p&gt;Once I started using the PWA for Coder’s editor, my workflow levels approached normalcy. I had to manually add a lot of keyboard shortcuts to my settings in VS Code/code-server. Once I did, I felt like I was back in my usual flow. &lt;/p&gt;

&lt;h3&gt;
  
  
  Inspect Browser is a Tool You Need
&lt;/h3&gt;

&lt;p&gt;When you’re developing on iPad and using the standard iOS browser apps (Chrome, Safari, Firefox), you don’t have access to the developer tools. This means you need a workaround. The best one I found was an app for purchase ($6.99) called &lt;a href="https://apps.apple.com/us/app/inspect-browser/id1203594958"&gt;Inspect Browser&lt;/a&gt;. Although the UX isn’t that of your standard browser devtools, it succeeds in filling the gap. It provides you with the ability to look at the console and inspect elements. There are more features but those were the two it helped me with the most. &lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Overall, I really enjoyed the two weeks I spent developing off an iPad full-time. There were many moments I wanted to give up and ask HR to send me a laptop, but I’m glad I stuck with it. I have a greater understanding of the iPad workflow from a developer perspective and I hope I can translate that into product improvements that make the UX for both Coder and code-server users even better. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t_Y2cyZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/89wi90r6q3x7c7vckese.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t_Y2cyZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/89wi90r6q3x7c7vckese.jpg" alt="Joe Previte smiling and pointing to iPad with code on screen."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading! It would mean a lot to me if you &lt;a href="https://twitter.com/intent/tweet?text=%22I%20developed%20on%20an%20iPad%20for%20two%20weeks.%20Here's%20what%20I%20learned%22%20by%20%40jsjoeio%20%F0%9F%9A%80%20%0A%0Ahttps%3A%2F%2Fcoder.com%2Fblog%2Fi-developed-on-an-ipad-for-two-weeks"&gt;shared this on Twitter&lt;/a&gt;. If you have questions or want to get in touch, feel free to &lt;a href="https://twitter.com/messages/compose?recipient_id=1567529924&amp;amp;text=Hey!%20I%20read%20your%20article%20about%20working%20off%20an%20iPad.%20"&gt;shoot me a DM&lt;/a&gt; on Twitter. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was first published on the Coder blog &lt;a href="https://coder.com/blog/i-developed-on-an-ipad-for-two-weeks"&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ipad</category>
      <category>ipados</category>
      <category>vscode</category>
    </item>
  </channel>
</rss>
