Commit graph

502 commits

Author SHA1 Message Date
Chris O'Brien
edd77fb1f2
Adds function returning only fn signature in function code blocks (#3545)
This PR adds a function `trim_fn_body()` that returns only the function
signature for documentable function code blocks.

Result:
![Screen Shot 2022-12-08 at 1 25 46
PM](https://user-images.githubusercontent.com/57543709/206549104-1b5b1e79-d573-422b-9bb2-eaa1af6bfa37.png)

Closes #3540

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
2022-12-08 21:16:07 -06:00
Mohammad Fawaz
2a147d1cf1
Bump to fuels 0.32 (#3539) 2022-12-08 22:30:09 +00:00
Chris O'Brien
3a80db63a2
Add --document-private-items option to forc doc (#3537)
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
2022-12-08 18:29:27 +00:00
Chris O'Brien
1b75006f38
Add favicon to forc doc (#3541)
Uses the `sway-logo.svg` as the favicon for docs produced by `forc doc`

Outcome:
<img width="98" alt="Screen Shot 2022-12-07 at 2 28 23 PM"
src="https://user-images.githubusercontent.com/57543709/206288671-7407045c-0c64-49b5-9af5-d9cfd0d85804.png">

Closes #3481
2022-12-08 00:52:44 +03:00
Chris O'Brien
a5b1c18b29
Add CSS styling to forc doc (#3471)
This PR adds styling and some updates to the structure of the docs
produced by `forc doc`. It also makes the sidebar visible but the items
aren't added yet so #3170 will remain open until then.

- [x] Figure out where to host CSS, icon & logo files

Closes #3169 

![Screenshot from 2022-11-29
22-01-07](https://user-images.githubusercontent.com/57543709/204707367-77362bd1-9ea5-4b95-8cd2-67c40f57a616.png)
![Screenshot from 2022-11-29
21-53-33](https://user-images.githubusercontent.com/57543709/204707368-1471fac8-2396-410e-b226-89ba9e104eec.png)

There are some TODOs in here that I wouldn't mind some input on, and in
general I always welcome the keen eyes of @kayagokalp
2022-12-06 20:18:07 -06:00
João Matos
487770f695
Adds a new forc build flag to print the DCA graph. (#3493)
This adds a new `--print-dca-graph` to `forc build` which allows the
user to print the DCA graph.
2022-12-02 16:48:25 -05:00
Emily Herbert
12ad842381
Bump to v0.31.3 (#3479)
Co-authored-by: emilyaherbert <emily.herbert@fuel.sh>
2022-11-30 14:57:21 -06:00
Mohammad Fawaz
1b971480eb
Fix type inference for integer variables and constants with type ascriptions (#3458) 2022-11-30 06:00:41 +00:00
Chris O'Brien
4b6f6d5409
Add code block formatting to forc doc (#3435)
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`.
2022-11-30 03:30:31 +00:00
Mohammad Fawaz
12239f7d57
Bump to v0.31.2 (#3461) 2022-11-29 11:59:43 -05:00
Mazdak Farrokhzad
fe6b76e2c4
Nix the global TYPE_ENGINE (#3353) 2022-11-22 18:06:39 +00:00
Chris O'Brien
cfef86811b
Cleanup reallocations in forc doc markdown function (#3382)
Follow up to #3373 to reduce reallocations
2022-11-21 21:10:33 +00:00
Chris O'Brien
0f86e24747
Add markdown formatting & support to forc doc (#3373)
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
2022-11-16 22:28:59 +00:00
Mohammad Fawaz
c32b0759d2
Bump to v0.31.1 (#3352)
Waiting on:
- [x] https://github.com/FuelLabs/sway/pull/3343
2022-11-11 20:55:57 -05:00
Mohammad Fawaz
ca7c1a4803
Bump to fuels v0.31.0 (#3343) 2022-11-11 13:32:36 -05:00
Mohammad Fawaz
7a389ddb35
Bump tov0.31.0 (#3335)
Also ran `cargo update`

Co-authored-by: Voxelot <brandonkite92@gmail.com>
2022-11-09 19:32:10 -05:00
Kaya Gökalp
94f73b2b76
feat: Implement workspace deployment/running (#3248)
closes #3156.
closes #3312.
2022-11-10 02:02:43 +03:00
Brandon Kite
a4c2eb4f37
don't exhaustively match on transaction status in forc deploy (#3334)
Allow for new TransactionStatus variants to be added in a non-breaking
way. This is blocking the release of fuel-core v0.14.1.
2022-11-09 13:31:35 -08:00
Kaya Gökalp
66b8481645
feat: Implement workspace building (#3146)
closes #3135.
2022-11-08 08:42:27 +00:00
bing
136d125ad0
forc-doc: add name/about/versioning and fix option description (#3308)
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>
2022-11-08 01:27:32 +00:00
Mohammad Fawaz
dff5e4f0df
Bump to fuels 0.30 and fuel-core 0.14 (#3304) 2022-11-06 02:59:34 +00:00
Mohammad Fawaz
158f22115b
Bump to v0.30.1 (#3290)
Co-authored-by: Emily Herbert <17410721+emilyaherbert@users.noreply.github.com>
2022-11-04 14:28:28 -07:00
Kaya Gökalp
32a9a3c067
fix: create message to sign from transaction id bytes (#3201)
closes #3200.
2022-11-04 11:51:39 +00:00
Kaya Gökalp
76b1ee9d4c
Provide a way to obtain workspace member order (#3134)
closes #3130.
2022-11-04 21:30:22 +11:00
Joshua Batty
d818f1406d
LSP: Collect declaration tokens from std lib prelude and dependencies (#3212)
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
2022-11-04 16:00:51 +11:00
Mohammad Fawaz
2e20b089d8
Address Clippy warnings due to rustc 1.65 (#3274)
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.
2022-11-03 21:44:33 +00:00
Mohammad Fawaz
37deaee8fc
Bump to v0.30.0 (#3249)
Also ran `cargo update` as this is a minor release.
2022-11-02 15:40:29 -04:00
bing
0fb693c6cb
deprecate forc-explore (#3163)
2/2 of #2609 
accompanying issue in `forc-explorer` repo:
https://github.com/FuelLabs/forc-explorer/issues/1
Once this and #2926 are merged, we can close the issue linked above.

Removes `forc-explore` from `forc-plugins` since `forc-explore` is now
released and available here:
https://github.com/FuelLabs/forc-explorer/releases/tag/v0.28.1

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
2022-11-02 15:21:12 +00:00
Brandon Kite
11496e6ced
fuel-core v0.13 upgrade (#3181)
- $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>
2022-11-02 15:19:26 +11:00
Alex Hansen
dc8e5f6b84
v0.29.0 (#3222)
Lots of breaking changes. Will go in after:
- [x] https://github.com/FuelLabs/sway/pull/3218
- [x] https://github.com/FuelLabs/sway/pull/3223
2022-10-31 21:13:49 +00:00
bing
aff832c654
forc-lsp: re-add App::parse (#3184)
Re-adds `App::parse()` to `forc-lsp`, following the change in a #3015
[here](https://github.com/FuelLabs/sway/pull/3015/files#diff-3d3683bdbf07b0fb222b9f323cca8beb84018f4db9df06f33e0a947287edc0f8L22).
This fixes not being able to execute `forc lsp --version` or `forc lsp
--help`.

This was an issue first spotted here (screenshot inside):
https://github.com/FuelLabs/fuelup/pull/250.

Has also led to issues with `forc-documenter` not being able to document
`forc-lsp`'s description, leading to an empty page in the latest
version: https://fuellabs.github.io/sway/v0.28.1/forc_lsp.html. In
contrast, https://fuellabs.github.io/sway/v0.26.0/forc_lsp.html is fine.

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2022-10-28 16:21:11 +00:00
Emily Herbert
b445ffaf0f
Implement generic traits. (#3031)
Co-authored-by: Toby Hutton <toby@grusly.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
2022-10-28 10:07:06 +00:00
Mohammad Fawaz
e40cbd65dc
Bump all fuel dependencies (to fuel-core 0.11.2) (#3054)
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).
2022-10-28 01:30:08 +00:00
mitchmindtree
c0880ebce6
Refactor forc_pkg::BuildOptions into its parts (#3166)
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>
2022-10-28 09:00:02 +11:00
Kaya Gökalp
de60a8318c
Provide a way to detect type of manifest files and general refactor for workspace builds (#3129)
closes #3127.
2022-10-26 14:02:50 +00:00
mitchmindtree
224e7291d0
Add a --tests flag to forc build (and sway-core) in preparation for building unit tests (#3150)
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.
2022-10-26 22:40:04 +11:00
Chris O'Brien
203b59053c
Implement forc doc (#2869)
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>
2022-10-25 23:58:24 +00:00
Mohammad Fawaz
84f9aad376
Bump to v0.28.1 (#3142)
Mainly to publish https://github.com/FuelLabs/sway/pull/3140
2022-10-25 17:31:48 +00:00
Kaya Gökalp
444ffa97f5
Enable printing contract-id and accept Bech32 address in forc-deploy (#3140)
closes #3137.
2022-10-25 16:23:22 +00:00
Mohammad Fawaz
598bbf6785
Bump to v0.28.0 (#3114) 2022-10-25 17:31:02 +11:00
bing
642c4b01dd
refactor(forc): extract tracing utils from forc-util into dedicated forc-tracing (#3108)
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>
2022-10-24 11:10:21 +00:00
Mohammad Fawaz
40f1e79de0
Bump to v0.27.0 (#3100)
https://github.com/FuelLabs/sway/pull/2909 is technically breaking for
someone previoysly using `not()` directly, so I'm releasing `0.27.0`
instead of `0.26.1`.

Pending:
- [x] https://github.com/FuelLabs/sway/pull/3099
- [x] https://github.com/FuelLabs/sway/pull/3096
- [x] https://github.com/FuelLabs/sway/pull/3091
- [x] https://github.com/FuelLabs/sway/pull/3080
- [x] `cargo update`
2022-10-23 20:30:18 -04:00
JC
ea28b9c769
Allow signing forc-client transactions without prompting (#3075)
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.
2022-10-21 11:07:31 +00:00
Joshua Batty
50262c059c
LSP: Add Inlay Hints functionality for variables (#3015)
Provides inlay hints for variables that don't already have a
type_ascription set by the user.

<img width="617" alt="Screen Shot 2022-10-12 at 4 40 46 pm"
src="https://user-images.githubusercontent.com/1289413/195259328-d224a4cb-90ac-4fe0-bc65-5b2ea4412e2f.png">

Also adds a new `Config` type that is deserialized from reading
`InitializeParams::initialization_options` during the lsp initialize
callback.

closes #2853
2022-10-17 06:23:42 -07:00
Mohammad Fawaz
f05d7f6416
Bump to v0.26.0 (#3023)
Also run `cargo update`
2022-10-13 13:32:01 -04:00
Mohammad Fawaz
f51d3f484e
Remove the --generate-logged-types flag (#2987) 2022-10-12 14:29:03 +11:00
Mohammad Fawaz
dfa6224932
Bump to v0.25.2 (#2973)
Another quick release to publish
https://github.com/FuelLabs/sway/pull/2972 to unblock the SDK team.
Pending
- [x] https://github.com/FuelLabs/sway/pull/2972
2022-10-07 11:20:52 -04:00
Kaya Gökalp
c27135ffee
Refactor manifest handling around forc-pkg to accommodate workspace manifest files (#2894) 2022-10-07 11:51:53 +03:00
Emily Herbert
4e9a5ae61a
Create a language module (#2955) 2022-10-07 13:49:40 +11:00
Mohammad Fawaz
cc9740bea1
Bump to v0.25.1 (#2959)
Mainly to publish https://github.com/FuelLabs/sway/pull/2947
2022-10-06 11:18:52 -04:00