#output #extension #tree #graph #display #structured #read

deviz

Provides access to a VS Code extension for displaying structured program output

4 releases

0.1.3 Dec 23, 2020
0.1.2 Dec 22, 2020
0.1.1 Dec 22, 2020
0.1.0 Dec 22, 2020

#2234 in Algorithms

MIT license

13KB
270 lines

deviz

deviz is a VS Code extension that displays structured program output such as trees and graphs. This crate allows Rust code to produce output that can be read by this extension.

See the top level README for more information about deviz.

Documentation


lib.rs:

deviz

deviz is a VS Code extension that displays structured program output such as trees and graphs. This crate allows Rust code to produce output that can be read by this extension.

To use this crate, call one of the top level output functions.

These functions take a pane_name argument, which specifies the name of the tab where the output will be displayed. The same output function can be called multiple times with the same pane name, but combining different types of output into the same pane won't work.

The functions each return a builder object that is used for constructing the output. The output data is automatically sent to the VS Code extension when this builder object is dropped.

Examples

let mut tree = deviz::tree("ast");
tree.begin_node();
tree.label("+");
{
    tree.begin_node();
    tree.label("1");
    tree.end_node();
}
{
    tree.begin_node();
    tree.label("2");
    tree.end_node();
}
tree.end_node();

let mut text = deviz::text("types", "x + y");
text.hover_text(0..1, "Int");
text.hover_text(4..5, "Bool");
text.hover_text(0..5, "Error");

Dependencies

~145KB