Skip to content

Commit

Permalink
Merge 1a33b0d into 36756e8
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Sep 9, 2024
2 parents 36756e8 + 1a33b0d commit 2978e35
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 20 additions & 7 deletions tooling/lsp/src/requests/document_symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use noirc_errors::Span;
use noirc_frontend::{
ast::{
Expression, FunctionReturnType, Ident, LetStatement, NoirFunction, NoirStruct, NoirTrait,
NoirTraitImpl, TypeImpl, UnresolvedType, UnresolvedTypeData, Visitor,
NoirTraitImpl, TypeImpl, UnresolvedType, Visitor,
},
parser::ParsedSubModule,
ParsedModule,
Expand Down Expand Up @@ -391,13 +391,9 @@ impl<'a> Visitor for DocumentSymbolCollector<'a> {
return false;
};

let UnresolvedTypeData::Named(name_path, ..) = &type_impl.object_type.typ else {
return false;
};
let name = type_impl.object_type.typ.to_string();

let name = name_path.last_ident();

let Some(name_location) = self.to_lsp_location(name.span()) else {
let Some(name_location) = self.to_lsp_location(type_impl.object_type.span) else {
return false;
};

Expand Down Expand Up @@ -710,6 +706,23 @@ mod document_symbol_tests {
}
]),
},
#[allow(deprecated)]
DocumentSymbol {
name: "i32".to_string(),
detail: None,
kind: SymbolKind::NAMESPACE,
tags: None,
deprecated: None,
range: Range {
start: Position { line: 27, character: 0 },
end: Position { line: 27, character: 11 }
},
selection_range: Range {
start: Position { line: 27, character: 5 },
end: Position { line: 27, character: 8 }
},
children: Some(Vec::new())
}
]
);
}
Expand Down
2 changes: 2 additions & 0 deletions tooling/lsp/test_programs/document_symbol/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ impl SomeTrait<i32> for SomeStruct {
mod submodule {
global SOME_GLOBAL = 1;
}

impl i32 {}

0 comments on commit 2978e35

Please sign in to comment.