kxd.me()

kxd.me()

Adventures in geekdom

16 Oct 2020

GitHub Codespaces Experience

So I was originally going to post another update in my PX-HER0 series today, but I thought I’d write something else instead. GitHub Codespaces has been interesting to me since they announced it earlier this year. I was able to get into the preview almost right away, so I was excited to give it a try. I’ve been trying to find a way to have my code in a single place so I don’t need to set up multiple environments and move code around when I’m not at the same computer (even with using git) and I just haven’t been able to find a solution I’m happy with yet. This blog post will be mostly geared around using it on a 2020 iPad Pro with the Apple Smart Keyboard Folio (not the laptop-type one, though i have one of those as well). GitHub Codespaces had the possibility of fitting the bill!

In the Past

In the past I’ve done things such as using emacs or vim over SSH, but VS Code has been improving a lot and I’ve wanted to start using it again because of the wealth of extensions available. I also have moved from dual-booting my desktop (Linux for most stuff, Windows for games) to using my desktop purely for games and then having a laptop (Lenovo X1 Extreme Gen 2 with Ubuntu 20.04) connected to an eGPU that I can switch between instead of rebooting.

For the most part this new setup has been good and I like having all my code on my desktop-class laptop (i7, 32GB ram and a GTX 1650) that I can just disconnect and take with me. The trip that I’m on, though, I ended up not taking my personal laptop with me because I’m limited in the amount of weight I’m allowed to lift right now and decided to bring my work laptop instead. I also brought a recent iPad Mini (for books) and the iPad Pro that I’m typing this on. It’s just nice to have a smaller device that boots up so quickly with more than all-day battery life that I can use for times like right now when I’m sitting in an airport waiting for a flight, instead of getting out a much larger laptop. As I’m typing this, though, I’m wondering if I should look at getting something like a Surface running Linux… I may have a problem with buying too many laptops.

Enter GitHub Codespaces

As I mentioned earlier, I was interested in codespaces since it was initially announced and hopped on as soon as I received my invite. I ran into a problem, though, where I couldn’t actually think of a use-case for myself. I don’t really do a lot of collaboration on code outside of work and most of the time I’m on a full-fledged computer so I can just use that instead. I ended up putting it down pretty quickly and never really thought about it again until today.

As I type this I’m sitting in the San Francisco airport waiting for my flight back home and I was looking for a way to occupy the two hours I had until my flight left. I decided I’d start writing the 3rd part in my PX-HER0 series because I got the terminal logging working a couple days ago and haven’t written it yet. I was trying to think of a way to write it on my iPad and since my blog uses Hugo I needed a way to edit and commit to that repository. Deployment is automatic so I didn’t need to worry about that (yay CI/CD). I was wracking my brain a little and I first thought of just using SSH into one of my machines, but that wouldn’t be easy because I’d have to set up port forwarding and everything in order to acxtually view the rendered version of the blog. At that point I remembered that GitHub has an iOS app that allows you to edit code (I think), so I went to the app store to download that. Once I got to the app page, though, I remembered codespaces and thought it would be fun to try, since it would give me a full VS Code environment and a shell! I decided to give it a try because this seemed like the perfect use-case for it.

Using Codespaces

I logged into GitHub and started up a codespace to start editing and quickly ran into issues, many of them related to using it on an iPad. I was impressed that it automatically added all my normal extensions because I use GitHub to store my VS Code sync profile, so that’s a huge plus. I wasn’t able to really get much done with that post due to the number of issues I ran into, though, so I figured I might as well write a blog post about my experience as I was experiencing it!

Can’t Full-Screen Browser on iOS

The first thing I ran into was the inability to make the iOS browser full-screen. The title bar takes up a lot of vertical screen real estate, so that limited what I could see while I was editing. Not only that, but even when using a keyboard with my iPad the operating system adds a keyboard hotbar at the bottom of the screen that I can’t seem to get rid of when something is in edit mode, taking up even more vertical space.

It’s possible to get it full-screen (which I’m using now), but in order to do that I needed to add my codespace to my iOS home screen. I didn’t like this because each codespace has its own hostname and in order to use a different codespace I’d need to re-add it every time.

No ESC Key

The next issue I ran into is that iOS doesn’t have an ESC key… This normally wouldn’t be an issue but as I’d mentioned, my VS Code extensions were all synced to the codespace automatically (which is good!) but that also meant Vim mode was ALSO synced. So I’d be able to enter insert mode but couldn’t ever exit. That means I’m going to be typing all this up, but I won’t actually be able to post it until I get home and can edit it on a real keyboard. I found something online that mentions being able to press CMD+Period as an ESC meta-key but when I tried that it just broke my editor and I couldn’t edit anything and had to reload the browser.

Editing Latency

This is actually probably the biggest annoyance for me. I’m very sensitive to typing latency (laggy SSH sessions drive me BONKERS, I need to start using Mosh), so when it takes a few hundred milliseconds for every letter to show up while I’m editing a file it gets a bit frustrating. Sometimes I get spikes where I’ll have typed a few words and they won’t show up for a few seconds. I have to type extremely slowly in order to not get too far ahead or I might have to go back a few words in order to fix a typo. This is exacerbated by the iPad keyboard I’m using missing key presses relatively often, possibly because i don’t press down on them hard enough.

I’m not sure if it’s latency between my client and the server (I’m tethering to my phone), or if it’s VS Code running in the browser using up CPU time. Given that the iPad CPU is pretty powerful and I’m running this over cellular I’m going to guess it’s the former.

Update (2020-10-18): It’s not (completely) the CPU, I’m editing this now on my desktop at home and I’m still having input latency issues. That’s basically a total deal breaker for me.

Can’t Ctrl+C in Terminal

As I mentioned in the part about the ESC key, I use Hugo as the platform for this blog so that means I run the Hugo server while I’m writing in order to be able to view the site in near real-time. I’ll typically run the server from one of the terminals in VS Code, which is why I was excited about the codespaces shell access, but I can’t seem to get the terminal to honor the keypress, so that means I can’t reuse the terminal for anything without killing the terminal and opening a whole new one. This hasn’t been as bad because I write most of this in Markdown and don’t really need a preview until I’m finishing up a post. I could see it being a problem if I’m trying to use this setup for actually working on a project.

Lack of Right Click for Sidebar

Since I’m using an iPad I don’t really have a way to right click on any elements in the sidebar, which would make using some extensions impossible. I ran into this when I accidentally created a file with the wrong filename and went to try and rename it. In this case there was a workaround by just doing it in the terminal, but a lot of extensions provide capabilities that aren’t exposed that way.

Not Quite There Yet

GitHub Codespaces are definitely a convenient feature and a neat idea, but with everything I mentioned above it’s just not in a place I can really use it right now. My personal use-cases are relatively few and this little experiment showed me that even in one of the use-cases I could find it’s not quite there yet.

I’ve seen a number of articles in the past about “Get Work Done on an iPad” and the like, and the idea sounds nice, but this pairing needs some work of its own. It’s taken me a bit to write this article and the whole time I’ve been thinking about that Surface running Linux, so I’m about to go do some research on those types of devices with fast boots and long battery life. 😁

Update (2020-10-18): So I’m home now and I decided to get a Macbook Air. It’s still small and relatively light, though not as light as an iPad Pro. It also has a 9-11 hour battery life, so I’ll be able to use it for as long as I need since I’m not planning on doing anything CPU intensive (at least most of the time).