-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: exclude uncompiled files from semantics and surface semantic-less reason #17920
Conversation
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.
Looks good to me.
rust/extractor/src/rust_analyzer.rs
Outdated
.into_iter() | ||
.flat_map(|x| x.to_vec()) | ||
.collect(); | ||
let mut no_semantics_reason = ""; |
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.
Could this be as follows, or are there code paths where the variable is used before it is initialised?
let mut no_semantics_reason = ""; | |
let no_semantics_reason; |
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.
ah, I had tried that, but the reason it was not working had to do with some nesting I didn't notice right away. Fixed now!
@@ -160,7 +160,7 @@ impl<'a> Translator<'a> { | |||
self.path, | |||
start.line + 1, | |||
start.col + 1, | |||
&message | |||
&full_message |
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 is the reason for this change? I think the full message (possibly multi-line markdown format) is for a long message to be displayed on the tool status page.
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 think more information is better in the logs, and I don't mind it being multiline. Maybe we can try this out, and revert it if we find it too spammy?
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.
at the moment I don't think we have full messages that heavier than message, but we can reconsider if we start having them.
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.
Currently the message
and full_message
are the same in our code, so it doesn't matter much. I was just wondering what triggered the change.
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.
In case of the semantic-less warning, I preferred the additional context of stating what will not work for the extraction of a given source file. Not much more information for us, but I think it gives a better context to a user other than hard-core rust analysis developers like us reading the logs 🙂
rust/extractor/src/rust_analyzer.rs
Outdated
} | ||
no_semantics_reason = "file not found in project"; |
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.
Can this line be moved to right after (or before) the debug!
statement?
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.
Looks good to me. One nit about the location of ano_semantics_reason
assignment.
No description provided.