Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #790 from pkoenig10/symbolsParent
Browse files Browse the repository at this point in the history
Add container_name information to symbols response
  • Loading branch information
nrc authored Mar 26, 2018
2 parents 974c515 + 0cd5f1c commit 75230dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/actions/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ impl RequestAction for Symbols {
ctx: InitActionContext,
params: Self::Params,
) -> Result<Self::Response, ResponseError> {
let analysis = ctx.analysis;

let file_path = parse_file_path!(&params.text_document.uri, "symbols")?;

let symbols = ctx.analysis.symbols(&file_path).unwrap_or_else(|_| vec![]);
let symbols = analysis.symbols(&file_path).unwrap_or_else(|_| vec![]);

Ok(
symbols
Expand All @@ -118,7 +120,9 @@ impl RequestAction for Symbols {
name: s.name,
kind: source_kind_from_def_kind(s.kind),
location: ls_util::rls_to_location(&s.span),
container_name: None, // FIXME: more info could be added here
container_name: s.parent
.and_then(|id| analysis.get_def(id).ok())
.map(|parent| parent.name),
}
})
.collect(),
Expand Down

0 comments on commit 75230dc

Please sign in to comment.