This PR adds the `--document-private-items` tag to `forc doc`, and sorts
the items based on visibility while determining whether an item is
documentable.
Closes#3482
This PR adds a formatting step to documentable code blocks which also
removes user comments. So something like
```rust
pub struct Hello { \n\n
// hello, a comment good sir
my_field : u32, // another unwanted comment
// oops this is a comment
my_other_field: u32 ,
}
```
will get formatting and have its comments removed only for the main code
block show casing the `struct`.
Along the way, I found a small problem in `sway_parse` in `item_struct`.
Looks like the parser was looking for the `struct` keyword first instead
of the `pub` keyword. I just added a `let` binding for the visibility
keyword before we check for `struct`.
Some things that are nice about this PR: The library I've chosen to
handle markdown to HTML rendering is based on `cmark` and has some
really great customization options. I've gone ahead and chosen the ones
that I think make sense, and it looks like this library is also well
maintained. I've made the `format_docs` function public from the LSP to
get some formatting before rendering to HTML.
Closes#3175
Minor changes to `forc-doc`.
- Add top-level `clap` description, mostly to allow for `fuelup` to be
able to query its version.
- Fixed what I believe was a typo (Cargo -> forc-doc)
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
We weren't collecting tokens imported by default with the new std lib
prelude. This PR now collects these tokens so we can do things like show
documentation for imported types on hover requests.
closes#3208
So far I'm addressing all Clippy warnings except for `result_large_err`:
Example:
```console
warning: the `Err`-variant returned from this function is very large
--> sway-core/src/semantic_analysis/namespace/items.rs:130:56
|
130 | pub(crate) fn check_symbol(&self, name: &Ident) -> Result<&ty::TyDeclaration, CompileError> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `Err`-variant is at least 224 bytes
```
Addressing this seems like it will take some time. Might have to throw
in `Box` in various places. To unblock everyone from working, I'm
allowing `clippy::result_large_err` in CI for now.
- $rB on state opcodes is now used as a flag for whether the storage
slot was previously set
- $rD on quad word state opcodes is reserved for use as accessing a
range of slots (currently hardcoded to 1)
Closes https://github.com/FuelLabs/sway/issues/3159
Closes https://github.com/FuelLabs/sway/issues/2115 (the dependency is
on `sway-core` now)
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: green <xgreenx9999@gmail.com>
Bumping everything all at once due to transitive dependencies that have
to match.
Only to `fuel-core 0.11.2` for now and all the other dependencies it
uses.
To bump to `fuel-core 0.12.0`, we need a new release of `fuels` that
uses `fuel-core 0.12.0` (pending
https://github.com/FuelLabs/fuels-rs/pull/656).
This is in anticipation of introducing a new `forc-test` library crate
that will contain the logic for building and executing tests. It will
expose a similar `TestOpts` type that shares some of these parts, but
not all.
Also splits up the forc `BuildCommand` for easier sharing between sets
of clap arguments (using the `clap` `flatten` attribute) that require
building a project (e.g. build, test).
Also adds two missing args to the `RunCommand` (`release` and
`build-profile`).
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
This strips out a couple commits from #2985 and aims to land them
independently!
Specifically, this enables calling `forc build --tests` which will (once
#2985 lands) build the current project along with all its tests.
Eventually we'll also want `forc check --tests` and `forc test` itself,
but landing this command early is particularly useful for testing the
new in-progress unit testing feature.
This PR also removes the old `AsmOrLib` and `BytecodeOrLib` types in
favour of new `CompiledAsm` and `CompiledBytecode` types. This is in
preparation for #2985 in which libraries will begin to generate bytecode
when tests are enabled.
Opening up for visibility, still reading through `cargo doc` and
previous comments related to this
Closes#161
- [x] #3027
- [x] #3033
- [x] #3036
- [x] #3038
- [x] #3088
- [x] #3090
Co-authored-by: Alex Hansen <alex@quickr.us>
Co-authored-by: Alex <alex@system76-pc.localdomain>
closes#3107
For the motivation for this PR, refer to the issue linked above.
This PR extracts all `tracing` related util functions from `forc-util`
and puts them into a dedicated `forc-tracing` crate. There is a minor
code change
[here](https://github.com/FuelLabs/sway/pull/3108/files#diff-fb650e8292a5d6bc84d8a261393ff2cabe324b5162c40ee5cf23af57ff4dcf58R161-R164)
because it is the only place that `forc-explore` uses `forc-util` (so we
can eliminate the dependency entirely), but other than that this PR is
mostly just moving code around and updating deps as required for crates
dependent on the moved `tracing` utils.
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
We do not sign transactions while running the E2E tests, causing them to
have similar IDs and collide. Some randomness could be inserted to
prevent this, but signing the transactions already achieve the same
result.
The only way `forc-client` could do signing was through stdio prompts,
so support for signing with a provided key was also needed.
This PR:
- Moves tx related code used in `forc-client`'s `run` and `deploy`
commands into `tx_util.rs`.
- Adds support for signing transactions with a provided `SecretKey`
instead of prompting stdio.
- Signs transactions using `fuel-core`'s built-in key while testing.