CodePerfect is an IDE for Go, made with the "handmade" philosophy.

The goal of CodePerfect is to both:

  1. Run as fast as a text editor like Vim
  2. Provide IDE features out of the box that "just work," without configuration or plugins

Right now, when you're selecting an IDE you basically have a few options. You can:

  • Use a pure text editor like Vim/Neovim, and then try to hack together a Go plugin and accept how far it gets you
  • Use a full-fledged IDE like Jetbrains, which is clunky and slow
  • Use a "semiautomatic weapon" like VSCode, which is acceptably fast and provides acceptable IDE functionality

CodePerfect is trying to create a better "semiautomatic weapon." It's almost as fast as vim, and provides a complete IDE exfperience.

Details

CodePerfect is written in C++ and OpenGL. It uses a custom-drawn UI for the editor portion and imgui for all the other windows.

Currently it only supports macOS. In theory it's cross-platform but there is some last-mile dev work needed to support Windows/Linux. If I get enough interest I will prioritize ports.

In the usual handmade style, it implements nearly everything from scratch. The core of the IDE, the indexer/intellisense, is handwritten in C++. It's not using a language server or anything from the Go standard library.

Unfortunately, there are a few things I'm not a strong enough programmer yet to rewrite from scratch. The biggest thing is the AST parser for the intellisense, which needs to be fully incremental (so results update as the user types). I don't know how to build this yet, so I'm just using tree-sitter (purely for the AST parsing part, the rest of intellisense is handwritten).

There are other things, like the debugger (which uses delve) or regular expressions (which uses pcre). In those cases I tried to use the most lightweight thing I could and just minimize dependency on third-party functionality as much as possible.

Memory allocation is amortized everywhere with arenas (allocated up front, all freed at the end) and pools (objects of equal size).

Features

  • Autocomplete
  • Jump to definition
  • Find all references
  • Parameter hints
  • Find implementations and implemented interfaces
  • Generate implementation
  • AST-based navigation (walk the syntax tree)
  • Generate struct tags
  • Postfix completion macros
  • Auto-rename anything
  • Vim keybindings (most commands work)
  • Fuzzy search for everything (files, declared symbols)
  • Live project-wide search (updates after each keystroke)
  • Global command palette (cmd+k)
  • Ergonomic keyboard shortcuts for everything
  • Auto format on save
  • Automatically organize imports
  • Integrated build/debug