Skip to content

Commit

Permalink
LSP: Collect supertraits from the ParseProgram (FuelLabs#3739)
Browse files Browse the repository at this point in the history
partially addresses FuelLabs#3723
  • Loading branch information
JoshuaBatty authored Jan 10, 2023
1 parent 50c8f1e commit 565662b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sway-core/src/language/parsed/declaration/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct TraitDeclaration {
pub attributes: transform::AttributesMap,
pub interface_surface: Vec<TraitFn>,
pub methods: Vec<FunctionDeclaration>,
pub(crate) supertraits: Vec<Supertrait>,
pub supertraits: Vec<Supertrait>,
pub visibility: Visibility,
pub span: Span,
}
Expand Down
10 changes: 10 additions & 0 deletions sway-lsp/src/traverse/parsed_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ impl<'a> ParsedTree<'a> {
for func_dec in &trait_decl.methods {
self.handle_function_declation(func_dec);
}

for supertrait in &trait_decl.supertraits {
self.tokens.insert(
to_ident_key(&supertrait.name.suffix),
Token::from_parsed(
AstToken::Declaration(declaration.clone()),
SymbolKind::Trait,
),
);
}
}
Declaration::StructDeclaration(struct_dec) => {
self.tokens.insert(
Expand Down

0 comments on commit 565662b

Please sign in to comment.