It's been a while since I've blogged about the IDE. A lot of exciting changes have been introduced to the codebase since my last post in July!
Lazy-load directories in Workspace Explorer.
Show hidden files (dotfiles) in Workspace Explorer.
Find in Files feature
Config file support
Added .dockerignore to improve build times during development
Find in Files - fixed the catch and minor improvements.
Refactor IDE internals to migrate to
Let's see in detail what each of these highlights have to offer.
Lazy-load directories in Workspace Explorer
During the initial stages of the IDE, I went with a "recursively read all directories" approach when loading a Workspace (project directory) into the IDE. This was to ensure I don't succumb to scope creep and as a "FIXME" for the future.
A few months pass and I finally found the inspiration to fix this. I fixed this by setting the
read_dir_recursive function and listening on
row-expanded event of
A caveat with
GtkTreeView was that the icon to expand/collapse a row isn't shown unless the node has at least one child. This meant adding a "dummy" row and deleting it before we add new entries (like when a row is expanded).
You can find the Git commit here.
Show hidden files (dotfiles) in Workspace Explorer
This was a simple fix to
read_dir_recursive function which just set
skip_hidden parameter to
Find in Files
This feature is one of my favorite additions to the IDE. I use it often in other code editors when navigating a project.
I created a
Gtk::Dialog inside the
main_window.glade file and added relevant code to show rows of a
SourceView with all the bells and whistles from the main editor seen beside Workspace Explorer.
Label would contain the full path of the search result followed by the line and column number and the
SourceView would contain the code along with the cursor set to the line.
I am having trouble scrolling the viewport to the active line number inside
SourceView which will be fixed in a future release.
After shipping this feature in v0.1.6 release, I realized I had forgotten to implement opening search results inside the main editor💀.
This has been fixed very recently - I have added a section for this so continue reading!
Config File Support
This feature was introduced to allow customizing the IDE without having to rebuild as I'd like to.
Currently, we allow window width and height settings by the config file. More features will be added as time goes on.
Sourced from my Mastodon post
You can find my Git commit here.
This change was needed to skip sending the
release directories to the Docker "context" on every build. In Rust projects, the source code needs to be compiled before it can be executed. These compiled artifacts are stored in
release directory stores the production build of the project which is used to publish a new release on GitHub.
This was an oversight on my part and I should've fixed it sooner.
Find in Files (again)
As mentioned above, I completely missed the fact that my Find in Files implementation does not open the search result in the main editor section.
To fix this, I had to first refactor the communication pipeline using struct which
init s' the pipes during init and saves a reference to
tx or sender via a Thread Local Storage.
Now, I can access the
Sender by simply calling
Refactoring IDE internals
I've been migrating public functions inside each file with a
struct for cleaner code.
In my opinion, this makes the code more Rust-like and follows the best practices of the Rust language.
Here are a few things I'd like to see in the future in no specific order:
Language Server Protocol
Messages panel for logging IDE internal messages and errors
Ability to create new files/folders within a workspace.
Build & Run a program
If you've made it this far, well I thank you for your interest. This project is my way of learning Rust by building complex applications.
Please consider following me on Mastodon so you don't miss my new articles.
Bye for now :-)