-
Notifications
You must be signed in to change notification settings - Fork 628
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
lsp: Simplify tests for renaming #7309
base: master
Are you sure you want to change the base?
Conversation
let identifier = en.DeclaredIdentifier(); | ||
if identifier.text() == name { | ||
result.push(identifier); | ||
#[track_caller] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function have many unwrap. It may be difficult to distinguish them if they are all reported at the location of the caller. But I guess this is not a problem in practice anyway as it is more important to know what fails rather than why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it more convenient this way: The test print the processed output and which file that was taken from already and it typically is pretty obvious what I mistyped with that visible :-)
let document = document_cache.get_document_by_path(document_path).unwrap(); | ||
let document = document.node.as_ref().unwrap(); | ||
let comment = document | ||
.descendants_with_tokens() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I'm usually doing in the other tests is to just call find() on the source string to get the offset, and then find the token from the offset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, that makes sense :-) I'll change that.
Simplify the testing of the renaming and some more small patches that should be pretty uncontroversial.