Skip to content
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

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Nov 6, 2024

No description provided.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Nov 6, 2024
@redsun82 redsun82 marked this pull request as ready for review November 6, 2024 15:58
@redsun82 redsun82 requested a review from aibaars November 6, 2024 15:58
Copy link
Contributor

@aibaars aibaars left a 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.

.into_iter()
.flat_map(|x| x.to_vec())
.collect();
let mut no_semantics_reason = "";
Copy link
Contributor

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?

Suggested change
let mut no_semantics_reason = "";
let no_semantics_reason;

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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 🙂

@redsun82 redsun82 requested a review from aibaars November 6, 2024 16:19
}
no_semantics_reason = "file not found in project";
Copy link
Contributor

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?

aibaars
aibaars previously approved these changes Nov 6, 2024
Copy link
Contributor

@aibaars aibaars left a 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.

@redsun82 redsun82 merged commit 3488b9f into main Nov 7, 2024
13 checks passed
@redsun82 redsun82 deleted the redsun82/rust-files branch November 7, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants