32 Commits (master)
 

Author SHA1 Message Date
alex 7fe315da03 output: reset color before rendering container doc comments 2 years ago
alex a338423b16 output: colored doc comments and identifiers in error sets 2 years ago
alex 41a6e8ad23 output: always color file names as comments, if enabled 2 years ago
alex 95b6490a31 output: pull in changes from lib/std/zig/render.zig at 68d2f68ed 2 years ago
alex 96e101607e merge branch '0.10'
pulling in further changes from lib/std/zig/render.zig,
starting with ca9e1760, requires zig 0.11.
2 years ago
alex e0e7f5db23 output: pull in changes from lib/std/zig/render.zig at 71e0ab4e 2 years ago
alex 02fafb76a0 output: log unreachable in renderExpression rather than crashing
something in std/os/windows/kernel32.zig hits an unreachable in
renderExpression. will figure it out later. for now, prefer logging an
error and continue program execution.
2 years ago
alex c6fe95a36b output: print results in very basic colors unless suppressed
zig now outputs dimmed comments and bold identifiers, where supported.
suppressed by NO_COLOR env var or --nocolor flag.
2 years ago
alex 8c2b7543b1 docs: mention explicitely no semantic analysis is run 2 years ago
alex 19b427b665 output: skip top level doc comments on exact/sub queries
the assumption is top level doc comments are of litte to no interest
if an exact/sub query is specified.

a side effect of this change is, if -s option is specified but no
identifier arg is provided, zdoc outputs only top level doc comments.
for example,

    zdoc -s std.log
2 years ago
alex a7391145f4 analyze: improve and reconcile public declarations detection
notably, zdoc previously ignored fields in a top level module container.
it now correctly shows all fields, for example in:

    zdoc std.Process
2 years ago
alex 62ab3da52d output: render top level doc comments
those at the beginning of each file, prefixed with "//!".
2 years ago
alex 1359c9ecb1 output: print filename under search if there are many
when searching over multiple files, it's unclear where a type is coming
from. zdoc now outputs the filename before printing out search results.
2 years ago
alex 78607c3a96 readme: delete outdated info about 'unimplemented' errors
most of them work now. if anything still shows up, it's probably more of
a bug now.
2 years ago
alex af1b591672 docs: correct optional vs required positional args format
the source arg is always required, identifier is optional.
the opposite was remnant from an earlier version.
2 years ago
alex a684fbb425 cmd: search across the whole zig stdlib if source is exactly 'std'
sometimes, it may be unclear which module a certain type is in.
searching the whole stdlib makes it easier:

    zdoc std ipv6
2 years ago
alex e90e5eefbb output: print doc comments for all container fields and var decl
this was a big omission from when adapting the original
std/zig/render.zig: renderDocComments was a the very top which i
completely forgot about.

with it, double newlines are gone now, too.
2 years ago
alex 802fda7cf7 analyze: add a -s option to search for identifier substring
for example, all expectXxx from the testing module:

    zdoc -s std.testing expect
2 years ago
alex 3fa0f65b54 output: insert empty line between container members
unfortunately, this spits out double newlines between top level
declarations and sometimes in between fields. this is because the
original rendering logic designed to handle a complete source file,
whereas we're printing only public members.

but this makes reading the output of container fields easier.
will take care of double newlines later.
2 years ago
alex dc51518b13 output: enable array literal rendering
can now compile the renderArrayInit with the TypeErasedWriter type of Ais,
added in the previous commit.

example: zdoc std.x.os.net IPv6
2 years ago
alex 56fe08fa7a output: use a comptime type-independent writer
all rendering functions output using Ais (AutoIndentingStream) which
writes to an std.fs.File.Writer but some commented out functions
like renderArrayInit need to use Ais to temporary output a partial
expression into an std.ArrayList(u8) buffer, making a new type of Ais
which renderExpression func cannot accept.

the new TypeErasedWriter abstracts the underlying writer away and so Ais
now always outputs to the same TypeErasedWriter.Writer type. in other
words, a single type of Ais should now satisfy all render functions.
2 years ago
alex b2d59f9f0e output: render unwrap_optional tags and comptime
some pub types are defined at compile time, based on the host properties.
example:

    zdoc std.x.os.socket
2 years ago
alex 8448fa079b output: render 'usingnamespace'
some constructs are imported using "pub usingnamespace". example:

    zdoc std.x
2 years ago
alex 054254c5ab output: enable container_field and aligned variant rendering
this was an oversight. should've enabled it from the start.
for example, IterableDir.Iterator defines an alighted buf:

    zdoc std.fs IterableDir
2 years ago
alex cd961b5dd6 output: enable switch case rendering
some pub const and vars may be defined using switch expressions.
example:

    zdoc std.fs.path sep
    zdoc std.fs.path sep_str
2 years ago
alex 0affa0b302 output: enable blocks and struct init rendering
some global pub vars are defined in blocks and use struct literals.
for example:

    zdoc std.testing allocator_instance
2 years ago
alex 40b8da106a readme: mention zig build test before sending a patch 2 years ago
alex 2a3b2d57d8 analyze: add a couple identifier matching tests 2 years ago
alex 4056c6dbcb build: add test subcommand
zig build test can now run tests defined in main.zig and all files it
imports due to std.testing.refAllDecls.
2 years ago
alex ba68c4a971 analyze: deinit AST once search in a file is done
arena allocator would take care of it upon program exit but deinit'ing earlier
may make a mem footprint difference when searching an arbitrary large
number of files.
2 years ago
alex 6c8e03ebd8 readme: mention unimplemented rendering output 2 years ago
alex 0a505782aa initial import 2 years ago