remember spans with paths

This commit is contained in:
Aleksey Kladov 2018-11-20 21:17:14 +03:00
parent c54b51fded
commit 1cf92c3e28

View file

@ -3,7 +3,7 @@ use rustc_hash::FxHashMap;
use ra_syntax::{ use ra_syntax::{
SmolStr, SyntaxKind, SmolStr, SyntaxKind,
ast::{self, NameOwner} ast::{self, NameOwner, AstNode}
}; };
use crate::{ use crate::{
@ -28,7 +28,7 @@ struct InputModuleItems {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct Path { struct Path {
kind: PathKind, kind: PathKind,
segments: Vec<SmolStr>, segments: Vec<(LocalSyntaxPtr, SmolStr)>,
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -150,7 +150,8 @@ fn convert_path(prefix: Option<Path>, path: ast::Path) -> Option<Path> {
kind: PathKind::Abs, kind: PathKind::Abs,
segments: Vec::with_capacity(1), segments: Vec::with_capacity(1),
}); });
res.segments.push(name.text()); let ptr = LocalSyntaxPtr::new(name.syntax());
res.segments.push((ptr, name.text()));
res res
} }
ast::PathSegmentKind::CrateKw => { ast::PathSegmentKind::CrateKw => {