Dartboard: Pub support, Stagehand templates & better theming

Aug 19, 2019 ยท 3 minutes read

Automatic pub.dev dependency synchronization, stagehand templates and theme improvements for TM4E.

Pub dependency synchronization

pub.dev is the main source of packages for Dart projects. Dependencies are added to a pubspec.yaml file and the $ pub get command is used to download the packages from the registry. Since most projects require at least a few dependencies this step must be taken before the project compiles without errors.

To ease this process a little, the command is now automatically run when saving the pubspec.yaml file in Eclipse. With this, required dependencies are automatically downloaded when a project is imported or when a new package is added to the pubspec.yaml file.

If you don't want this behavior the feature can be disabled from the preference page. Manually running the synchronization is also supported from the context menu of a project.

Pub context handler

The current progress of the synchronization is reported to the Progress view.

Pub progress

Stagehand

Stagehand is a CLI tool, written in Dart, that generates new projects from a list of templates. There are different project types to chose from, like Flutter, AngularDart or just console applications. After a template is generated the project contains a pubspec.yaml file containing all necessary dependency information and various entry files that are required by the type of project.

This tool is now supported graphically by the New Dart Project wizard also provided by Dartboard. Under the hood the plugin uses the exact executable from pub.dev. And by automatically updating it we make sure that new templates can be immediately used.

This is how the New Dart Project wizard looks now: Stagehand

At first selection of the Wizard (after a fresh IDE start) Stagehand is updated and its templates are fetched. After that job is finished the available templates are added to the combo box. If no template should be used the Use Stagehand template checkbox can be unchecked and an empty project is generated.

Subsequent usages of the wizard use cached versions of the templates list to not strain your network or the pub.dev registry too much.

Project import

Not every Dart project was created from Eclipse though. So to be able to use Dartboard with existing Dart projects it is required to import them into the workspace. For this task we now provide a shortcut to import Dart projects from the Import Project context menu entry.

Currently it simply opens the Projects from Folder or Archive wizard. This wizard however allows to specify a ProjectConfigurator that takes care of selecting folders that should be imported as a project. In our own configurator we traverse all children and look for pubspec.yaml files. Every folder that contains such a file is considered to be a separate project.

Eclipse light theme for TM4E

TM4E can be used to apply different syntax highlighting to the editor. We provide a configuration file that specifies how certain words inside the editor should look. It also gives the option to select what theme to use. There are different light and dark themes available, like Solarized Light or the classic Eclipse Java editor theme.

I provided a patch to add some missing styles to the latter to make it look more like the classic theme. This is what it looks like now: Eclipse light theme

See eclipse/tm4e#215.

Wrap up

With two weeks to go until the end of Summer of Code 2019 there is not that much left to do for me to fulfill my proposed timeline. One major thing that is still missing are automated tests. I have started work on it now and will work on that for the last two weeks.

This will also be my last update post on Summer of Code as the next post will be a summary of my whole summer.