Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
929235e
actor contract parsing
sbillig Nov 9, 2025
a370b23
contract hir
sbillig Nov 11, 2025
5761832
parser support for `msg` block
sbillig Mar 7, 2025
bb6bca1
hir for msg and contract recv blocks
sbillig Nov 28, 2025
b53c297
contract analysis wip
sbillig Nov 29, 2025
21cfb78
fmt crate skeleton
sbillig Nov 17, 2025
995e806
add fmt snapshot tests, itemlist walking
sbillig Nov 17, 2025
5268a13
block indentation
sbillig Nov 17, 2025
711e58b
expr and stmt formatting
sbillig Nov 18, 2025
e470d3a
function and item def formatting
sbillig Nov 18, 2025
adc7d31
refactor list formatting
sbillig Nov 25, 2025
726d82f
struct/enum field list formatting
sbillig Nov 25, 2025
2f8e601
generic type argument formatting
sbillig Nov 25, 2025
1f2f12f
trait/impl item list formatting
sbillig Nov 25, 2025
556885d
generic param list formatting
sbillig Nov 25, 2025
ac32b5c
refactor: deduplicate push_indent helper
sbillig Nov 25, 2025
7abbb41
fix comment blank line positioning
sbillig Nov 25, 2025
1d68d62
use list formatting for RecordInitExpr, UsesClause, WithExpr
sbillig Nov 25, 2025
4051c1c
add clause_indent to Config for `where` and `uses`
sbillig Nov 25, 2025
14cff99
add list trailing_comma config option
sbillig Nov 25, 2025
ad1ef87
`use` item formatting
sbillig Nov 25, 2025
79ba70c
use Path rewriter for patterns and expressions
sbillig Nov 25, 2025
68ebc14
add Rewrite for TypeAlias
sbillig Nov 25, 2025
70cdf41
add Rewrite for Mod
sbillig Nov 25, 2025
784ce81
add Rewrite for Extern blocks
sbillig Nov 25, 2025
cfddcd7
add Rewrite for where clauses, type bounds, and trait refs
sbillig Nov 25, 2025
b3329c9
use Rewrite for type bounds and generic args
sbillig Nov 25, 2025
5b1e3ef
use WhereClause rewriter in function formatting
sbillig Nov 25, 2025
7efe6c5
add context.token() helper for trimmed token text
sbillig Nov 25, 2025
d5c0475
handle missing names in item rewriters
sbillig Nov 25, 2025
b822af2
refactor rewrites
sbillig Nov 26, 2025
af83a93
split up fmt/src/ast.rs
sbillig Dec 3, 2025
71be54a
format QualifiedType
sbillig Dec 3, 2025
6bc3e77
funcsignature reflow
sbillig Dec 4, 2025
1e6bcf9
use `pretty` crate
sbillig Dec 4, 2025
94d1a5a
wrap binary exprs
sbillig Dec 5, 2025
c7c4016
field and method chain wrapping
sbillig Dec 5, 2025
f4bfe14
use doc allocator
sbillig Dec 5, 2025
3a6adf6
nest binops by precedence
sbillig Dec 5, 2025
484d856
augassign test case
sbillig Dec 5, 2025
3bf0074
use config.clause_indent for `uses` indentation
sbillig Dec 5, 2025
321b1aa
add config.fn_call_width, struct_lit_width
sbillig Dec 6, 2025
bbe9f07
add single_line_if_max_width, single_line_if_else_max_width
sbillig Dec 6, 2025
58c6803
add config.struct_variant_width
sbillig Dec 6, 2025
b5a84fd
attribute formatting
sbillig Dec 6, 2025
f11f23e
parser: allow optional comma after match arms
sbillig Dec 6, 2025
6f67cde
`fe fmt --check` with colored diff output
sbillig Dec 6, 2025
d05b4cb
fix `use` tree formatting; keep trailing newline in file
sbillig Dec 6, 2025
1c6cd3a
show `fe fmt --check` diffs in hunks
sbillig Dec 6, 2025
89aef64
preserve separating lines in item lists (eg trait bodies)
sbillig Dec 6, 2025
2ef41cb
lsp handle_formatting
micahscopes Dec 8, 2025
b18d47f
fix lsp formatting position calculation
sbillig Dec 9, 2025
bea8361
Merge pull request #1160 from sbillig/fefmt
sbillig Dec 9, 2025
d873224
contract analysis
sbillig Dec 3, 2025
b91b146
desugar msg into mod with structs
sbillig Dec 6, 2025
3395fbf
support recv blocks with no msg root, better diags
sbillig Dec 10, 2025
9fbaef4
remove `msg` attribute requirement for recv msg roots
sbillig Dec 10, 2025
4a338bf
fix duplicate detection for generic msg variants
sbillig Dec 10, 2025
455baa9
restrict recv arm pattern parsing
sbillig Dec 11, 2025
c793aea
fix contract field effect seeding; add erc20
sbillig Dec 11, 2025
9ce01b2
fix resolution of trait Self methods inside trait body
sbillig Dec 11, 2025
a470123
fix local find all refs
micahscopes Dec 6, 2025
c9ce935
fix reference finding for local func params
micahscopes Dec 6, 2025
832cc9f
Add inlay hints for type inference
micahscopes Dec 5, 2025
f30e51d
Add document symbols for file outline
micahscopes Dec 5, 2025
0b774d3
Add workspace symbols for project-wide search
micahscopes Dec 5, 2025
07f12ff
Add basic completion support
micahscopes Dec 5, 2025
5de6fdf
Improve completion with scope-aware item collection
micahscopes Dec 5, 2025
68e0676
Fix completion text replacement and detect member access
micahscopes Dec 5, 2025
2e1dd99
completion improvements; error handling
micahscopes Dec 5, 2025
772221d
Add signature help for function arguments
micahscopes Dec 5, 2025
b19ce0d
Fix argument label inference requiring variable names to match parame…
micahscopes Dec 5, 2025
d7f9abd
Add auto-import completions for symbols from current ingot
micahscopes Dec 5, 2025
ec728ae
Add code action to suggest return type annotations
micahscopes Dec 5, 2025
47bb1fb
Wire up signature help and code actions handlers
micahscopes Dec 5, 2025
5f63686
Update hoverable test fixture with add function example
micahscopes Dec 5, 2025
d8f0159
Fix clippy warnings and simplify tests
micahscopes Dec 5, 2025
706cc78
Fix rename to work from definition sites
micahscopes Dec 7, 2025
730a552
Add go-to implementations and fix trait method rename
micahscopes Dec 7, 2025
5877f27
go-to implementations and trait method rename
micahscopes Dec 7, 2025
c658b60
warning when an ingot is standalone
micahscopes Dec 7, 2025
42c2cf4
find implementations niceties
micahscopes Dec 7, 2025
7c256b3
consolidate implementation oriented traversal helpers
micahscopes Dec 7, 2025
2a8729a
cleanup
micahscopes Dec 8, 2025
f707c84
remove verbose logging
micahscopes Dec 8, 2025
50c492a
rename skips implicit `Self` type spans
micahscopes Dec 8, 2025
ad2d7ec
Add callable snippets with tabstops for function/method completion
micahscopes Dec 11, 2025
8382fb0
Add trait method completions for implemented traits
micahscopes Dec 11, 2025
95413ec
add context-aware completion filtering (type vs expression)
micahscopes Dec 11, 2025
5ca97f2
module completions add ::, path completions use context filtering
micahscopes Dec 11, 2025
157b6b1
add codespan-based completion snapshot tests
micahscopes Dec 11, 2025
7e32d8e
format completion snapshot as bullet list
micahscopes Dec 11, 2025
43d9b0f
filter completions properly: no traits/modules in type context
micahscopes Dec 11, 2025
0ddb6f3
update completion fixture with more test cases
micahscopes Dec 11, 2025
9525220
completions with auto-import; consolidated collectoin
micahscopes Dec 11, 2025
5f29e95
use name resolution machinery for autocompletion precedence
micahscopes Dec 11, 2025
1e81fdd
refine auto-import scoping
micahscopes Dec 11, 2025
7f3a616
YUL: Fix bug in emit_eval_inst
cburgdorf Dec 8, 2025
9685097
MIR+YUL: Add support for keccak intrinsic
cburgdorf Dec 9, 2025
843ea1e
Teach contract harness how to deploy contracts with init code
cburgdorf Dec 9, 2025
479bb3d
Add addr_of intrinsic
cburgdorf Dec 9, 2025
9bf7e94
MIR+YUL: Monomorphize storage/memory decision through Ptr type
cburgdorf Dec 9, 2025
38f8540
MIR+YUL: Add revert intrinsic
cburgdorf Dec 10, 2025
00729ab
Add caller() intrinsic
cburgdorf Dec 10, 2025
f34a614
MIR: Add support for nested structs
cburgdorf Dec 11, 2025
230de80
Add StorageMap
cburgdorf Dec 9, 2025
db132e6
Add a working ERC20 test
cburgdorf Dec 10, 2025
8ecb434
Make clippy happy
cburgdorf Dec 11, 2025
6babe71
remove spans from LocalBinding
sbillig Dec 11, 2025
efaa4aa
desugar contract init into a func
sbillig Dec 11, 2025
62500dc
Merge branch 'master' into contractor
sbillig Dec 12, 2025
57770eb
fix formatting of contracts and record literals
sbillig Dec 12, 2025
1c3dfb0
Merge pull request #1170 from sbillig/contractor
sbillig Dec 12, 2025
41cbe03
Merge pull request #1178 from cburgdorf/storage_map
sbillig Dec 12, 2025
c8e8624
Merge pull request #1175 from micahscopes/lsp-features-galore
sbillig Dec 12, 2025
2feae99
diagnostics for unresolved effects
sbillig Dec 12, 2025
c347dcb
allow `with` to specify effect bindings without the type/trait key
sbillig Dec 12, 2025
45d1f98
add `Place`; track address space of effect params
sbillig Dec 13, 2025
3d9c84a
allow ptrs to satisfy effects, propagate effect source to mir
sbillig Dec 13, 2025
12b28b2
generic abi lib
sbillig Dec 14, 2025
849f812
decision tree codegen
micahscopes Dec 15, 2025
dce0677
Wire up decision tree bindings for tuple and struct pattern matching
micahscopes Dec 15, 2025
19c739b
projection path sketch
micahscopes Dec 15, 2025
9129c2b
Unify field access with Place abstraction for direct load/store emission
micahscopes Dec 15, 2025
cd853c3
Fix review issues: type conversions, defensive handling, panic safety
micahscopes Dec 15, 2025
edf96a5
Add debug_assert for absent patterns in match lowering
micahscopes Dec 15, 2025
0b712b4
Add hard errors for Place projection failures and hash enum_ty
micahscopes Dec 15, 2025
89f514e
more generic projections
micahscopes Dec 15, 2025
c769cf2
Unify projection system and centralize layout computation
micahscopes Dec 15, 2025
b5b8004
Move layout to HIR and add layout snapshot tests
micahscopes Dec 15, 2025
1093c95
Add enum_size_bytes helper and fail loudly on unknown sizes
micahscopes Dec 15, 2025
6da9c6e
Fix off-by-one in field_offset_bytes bounds check
micahscopes Dec 15, 2025
4a97a66
Add ty_size_bytes_or_word to make word-size fallback explicit
micahscopes Dec 15, 2025
e05e2ef
Route wildcard arm explicitly in MIR match lowering
micahscopes Dec 16, 2025
f72dd40
Fix nested wildcard pattern matching in codegen
micahscopes Dec 16, 2025
5e0f42d
Use centralized layout API for field offsets everywhere
micahscopes Dec 16, 2025
b7c3d5c
Preserve PlaceRef for match bindings
micahscopes Dec 16, 2025
171d3cd
Drop offset-based enum match bindings
micahscopes Dec 16, 2025
b49dd13
Add Place::new helper
micahscopes Dec 16, 2025
1fca033
Track PlaceRef bindings in codegen state
micahscopes Dec 16, 2025
077d61c
Expose BlockState::resolve_place
micahscopes Dec 16, 2025
b6f6763
Add layout offset helpers
micahscopes Dec 16, 2025
460790f
contract desugaring
sbillig Dec 14, 2025
a7bf8ac
remove contract from RecordLike
sbillig Dec 17, 2025
2a633be
hir pretty printing
sbillig Dec 17, 2025
c42f036
fix cross-ingot trait method resolution
sbillig Dec 17, 2025
b46166f
fix associated const visibility
sbillig Dec 17, 2025
26b39e6
handle default arm bindings consistently
micahscopes Dec 17, 2025
25ee23f
more field offset calculation consistency
micahscopes Dec 17, 2025
e9e70ca
deduplicated binding emission logic
micahscopes Dec 17, 2025
76cda16
clearly marked API stubs (intended to be used or discarded)
micahscopes Dec 17, 2025
7e7c608
removed speculative Editable api
micahscopes Dec 17, 2025
ae879ac
fix attribute parsing error handling
sbillig Dec 17, 2025
7b36611
contract desugaring cleanup
sbillig Dec 17, 2025
a23b484
Merge pull request #1174 from micahscopes/decision-tree-codegen
sbillig Dec 18, 2025
2635b73
Merge branch 'master' into contract-mir
sbillig Dec 18, 2025
7d5d95d
post-merge cleanup
sbillig Dec 18, 2025
b8716d0
fix unary expr parsing in `if` (honor allow_struct_init)
sbillig Dec 18, 2025
cce1d67
update high-level erc20.fe
sbillig Dec 18, 2025
d6c8b3e
codegen: lower record inits in calls
sbillig Dec 18, 2025
1d8911a
codegen: lower field assignments and tuple destructuring
sbillig Dec 18, 2025
da4adc0
fix const patterns in match stmt; lower recv to match
sbillig Dec 18, 2025
9d753f4
cleanup; move layout.rs to mir; handle enums in ty_storage_slots
sbillig Dec 18, 2025
d2aac2f
Merge pull request #1183 from sbillig/contract-mir
sbillig Dec 18, 2025
5e31874
Remove old website stuff
cburgdorf Dec 17, 2025
2a99422
MIR: lower tuples to structs
cburgdorf Dec 11, 2025
55750f1
Merge pull request #1188 from argotorg/tuple_lowering
sbillig Dec 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add list trailing_comma config option
  • Loading branch information
sbillig committed Dec 9, 2025
commit 14cff9976d65279e35bcf9516db5d8412ba5d98f
1 change: 0 additions & 1 deletion crates/fmt/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ impl Rewrite for ast::VariantDefList {
fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
let formatting = ListFormatting::new(shape)
.tactic(ListTactic::Vertical)
.trailing_separator(false)
.with_surround("{", "}");
format_list(self, &formatting, context, shape)
}
Expand Down
15 changes: 15 additions & 0 deletions crates/fmt/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/// Controls when trailing commas are added to lists.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum TrailingComma {
/// Always add trailing commas.
Always,
/// Never add trailing commas.
Never,
/// Add trailing commas only for multiline (vertical) lists.
#[default]
Multiline,
}

/// Global configuration for the Fe formatter.
#[derive(Clone, Debug)]
pub struct Config {
Expand All @@ -7,6 +19,8 @@ pub struct Config {
pub indent_width: usize,
/// Indentation for `where` and `uses` clauses, in spaces.
pub clause_indent: usize,
/// When to add trailing commas in lists.
pub trailing_comma: TrailingComma,
}

impl Default for Config {
Expand All @@ -15,6 +29,7 @@ impl Default for Config {
max_width: 100,
indent_width: 4,
clause_indent: 2,
trailing_comma: TrailingComma::default(),
}
}
}
2 changes: 1 addition & 1 deletion crates/fmt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod shape;
#[cfg(test)]
mod tests;

pub use crate::config::Config;
pub use crate::config::{Config, TrailingComma};
pub use crate::context::RewriteContext;
pub use crate::format::{FormatError, format_file, format_str};
pub use crate::list::{ListFormatting, ListTactic, format_list};
Expand Down
33 changes: 20 additions & 13 deletions crates/fmt/src/list.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Indent, RewriteContext, Shape, rewrite::RewriteExt};
use crate::{Indent, RewriteContext, Shape, config::TrailingComma, rewrite::RewriteExt};

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ListTactic {
Expand All @@ -14,7 +14,8 @@ pub enum ListTactic {
pub struct ListFormatting<'a> {
pub tactic: ListTactic,
pub separator: &'a str,
pub trailing_separator: bool,
/// Override trailing separator behavior. `None` means use config default.
pub trailing_separator: Option<bool>,
pub surround: Option<(&'a str, &'a str)>,
/// Add space padding inside surrounds for horizontal mode (e.g., `{ a, b }` instead of `{a, b}`).
pub horizontal_padding: bool,
Expand All @@ -25,7 +26,7 @@ impl<'a> Default for ListFormatting<'a> {
Self {
tactic: ListTactic::Mixed,
separator: ",",
trailing_separator: true,
trailing_separator: None,
surround: None,
horizontal_padding: false,
}
Expand All @@ -45,7 +46,7 @@ impl<'a> ListFormatting<'a> {
}

pub fn trailing_separator(mut self, trailing: bool) -> Self {
self.trailing_separator = trailing;
self.trailing_separator = Some(trailing);
self
}

Expand Down Expand Up @@ -84,6 +85,14 @@ where
return Some(format!("{}{}", open, close));
}

// Resolve trailing separator behavior from override or config.
let trailing_for_horizontal = formatting.trailing_separator.unwrap_or_else(|| {
matches!(context.config.trailing_comma, TrailingComma::Always)
});
let trailing_for_vertical = formatting.trailing_separator.unwrap_or_else(|| {
!matches!(context.config.trailing_comma, TrailingComma::Never)
});

// 1. Try Horizontal
if matches!(formatting.tactic, ListTactic::Horizontal | ListTactic::Mixed) {
let item_strings: Vec<String> = items
Expand All @@ -99,9 +108,7 @@ where
let inline_len = joined.len();

if inline_len <= available_width {
let trailing = if formatting.trailing_separator
&& matches!(formatting.tactic, ListTactic::Horizontal)
{
let trailing = if trailing_for_horizontal {
formatting.separator
} else {
""
Expand All @@ -116,28 +123,28 @@ where
return Some(result);
}
}

// 2. Vertical
let indent_width = context.config.indent_width;
let item_indent = shape.indent.block_indent + indent_width;
let item_shape = Shape::with_width(shape.width, Indent::from_block(item_indent));

let mut out = String::new();
out.push_str(open);
out.push('\n');

for (idx, item) in items.iter().enumerate() {
push_indent(&mut out, item_indent);
out.push_str(&item.rewrite_or_original(context, item_shape));
if formatting.trailing_separator || idx + 1 != items.len() {
if trailing_for_vertical || idx + 1 != items.len() {
out.push_str(formatting.separator);
}
out.push('\n');
}

push_indent(&mut out, shape.indent.block_indent);
out.push_str(close);

Some(out)
}

Expand Down
12 changes: 6 additions & 6 deletions crates/fmt/tests/fixtures/enums.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,38 @@ input_file: tests/fixtures/enums.fe
enum Color {
Red,
Green,
Blue
Blue,
}

// Enum with tuple variants
enum Option {
None,
Some(i32)
Some(i32),
}

// Enum with record variants
enum Result {
Ok { value: i32 },
Err { code: i32 }
Err { code: i32 },
}

// Mixed variants
enum Mixed {
Unit,
Tuple(i32, bool),
Record { x: i32, y: i32 }
Record { x: i32, y: i32 },
}

// Enum with generics
enum Container<T> {
Empty,
Value(T)
Value(T),
}

// Single line enum
enum SingleLine {
A,
B,
C { x: i32, y: u8 },
D(i8, i8)
D(i8, i8),
}