Add "move column" command. (#2123)

This commit is contained in:
Andrés N. Robalino
2020-07-06 10:27:01 -05:00
committed by GitHub
parent c3ba1e476f
commit 34e1e6e426
17 changed files with 566 additions and 25 deletions

View File

@ -61,6 +61,11 @@ impl ColumnPath {
pub fn split_last(&self) -> Option<(&PathMember, &[PathMember])> {
self.members.split_last()
}
/// Returns the last member
pub fn last(&self) -> Option<&PathMember> {
self.iter().last()
}
}
impl PrettyDebug for ColumnPath {
@ -99,6 +104,13 @@ impl PathMember {
pub fn int(int: impl Into<BigInt>, span: impl Into<Span>) -> PathMember {
UnspannedPathMember::Int(int.into()).into_path_member(span)
}
pub fn as_string(&self) -> String {
match &self.unspanned {
UnspannedPathMember::String(string) => string.clone(),
UnspannedPathMember::Int(int) => format!("{}", int),
}
}
}
/// Prepares a list of "sounds like" matches for the string you're trying to find