-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust: trait for impl to inherits and end fields #1604
Rust: trait for impl to inherits and end fields #1604
Conversation
(This is based on pull request universal-ctags#1601 submitted by @ithinuel.) For the input impl A for B { Rust parser emits: B foo.rs /^impl A for B {$/;" kind:implementation inherits:A This on on the analogy of what Java parser does: interface A { } class B implements A { } For the above input ctags emits for class B: B foo.java /^class B implements A {$/;" inherits:A Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
With your change, a user cannot find the following line of source code from search word 'C':
A user must specify What we have to think first is a newly defined name.
Next what we can add as fields to the tag.
If we implemented all the above well, enough intelligent editor can make a string
So the editor can use the string as it wants. Providing such low-level information to client tools is a design principle in uctags. Rich information like you want comes after that. uctags has an infrastructure for providing such rich information. What I'm thinking of is tagging
as The following page and commits tell how to add a parser specific extra tag. I still think adding "trait:" field to method kind tag is not a bad idea as I described in #1603. |
Indeed, and the fun really comes for impl<T: Clone> SpecFromElem for T {
default fn from_elem(elem: Self, n: usize) -> Vec<Self> { /* ... */ }
} which means that we provide/implement SpecFromElement for any type which also implement Clone. impl<'a, T: 'a, I> SpecExtend<&'a T, I> for Vec<T>
where I: Iterator<Item=&'a T>,
T: Clone which means implement SpecExtend with the signature impl<T> SpecExtend<T, IntoIter<T>> for Vec<T> which means implement SpecExtend with the signature impl<T, I> SpecExtend<T, I> for Vec<T>
where I: Iterator<Item=T> which means implement SpecExtend with the signature This gets too complicated for me in regards to my knowledge on uctags. Taking a step back, I'm not even sure that the "scope" approach is the right one for this and I don't know who the rust's compiler handle this. |
@ithinuel, thank you very much for taking time. I will think more about how to handle impl lines. |
I close this as I can't plan to work on that in the next few month. Thank you for the feedback though ! |
This article, https://joshleeb.com/posts/surprising-ctags.html is related to this issue. |
This PR follows #1603 #1601.
The intent is to have fully qualified trait names associated to type for implementations.
A good use case is vec.rs from rust's sources.
Drop, FromIter and other traits are implemented multiple times for the same type but with different type arguments.