Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Add show_warnings to config #392

Merged
merged 1 commit into from
Jul 6, 2017
Merged

Add show_warnings to config #392

merged 1 commit into from
Jul 6, 2017

Conversation

robbym
Copy link
Contributor

@robbym robbym commented Jul 5, 2017

Issue #252

  • Added show_warnings to config
  • Implemented in convert_build_results_to_notifications
  • Made config in BuildQueue public

First, am I filtering in the right place? This works, but I'm not sure if there is a better place to put the filter. Also, adding pub to BuildQueue feels dirty. Should config be some sort of shared object or accessed via method call?

Copy link
Member

@nrc nrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good approach to me. I'm currently changing the config management stuff, so don't worry about making config public.

Could you squash the commits please? And rebase, rather than merging. Thanks!

diagnostics: diagnostics.iter().map(|&(ref d, _)| d.clone()).collect(),
diagnostics: diagnostics.iter()
.map(|&(ref d, _)| d.clone())
.filter(|d| show_warnings || d.severity != Some(DiagnosticSeverity::Warning))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use filter_map here rather than map and filter?

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 guess like so?

diagnostics: diagnostics.iter()
                        .filter_map(|&(ref d, _)| {
                            let d = d.clone();
                            if show_warnings || d.severity != Some(DiagnosticSeverity::Warning) {
                                Some(d)
                            } else {
                                None
                            }
                        })

Not sure if you had something more succinct in mind.

Implemented show_warnings
@robbym
Copy link
Contributor Author

robbym commented Jul 6, 2017

First time I've squashed and rebased something. Please tell me if I did it right.

@nrc
Copy link
Member

nrc commented Jul 6, 2017

First time I've squashed and rebased something. Please tell me if I did it right.

Yep, looks good to me!

@nrc nrc merged commit 14d4c7d into rust-lang:master Jul 6, 2017
@nrc
Copy link
Member

nrc commented Jul 6, 2017

I've merged and applied the filter_map fix - I wanted to rebase some of my work over this PR.

@robbym
Copy link
Contributor Author

robbym commented Jul 6, 2017

Cool. What should I work on next?

@nrc
Copy link
Member

nrc commented Jul 6, 2017

Cool. What should I work on next?

I think the extension I mentioned would be a good next thing to work on. It is very related to this, but you'll need to learn a little bit about the VFS (in the rls-vfs crate, you'll want to use file_is_synced, I think).

I think this should be under a different config option (always_show_diagnostics, or something similar) and should apply to errors as well as warnings.

A nice extension would be to only show warnings when a file is saved (i.e., when the file is being edited, suppress warnings, and when it is saved, show them). That would be a bit harder because you'd have to coordinate the state of a file (I think this is tracked in the VFS, but you should check) with the error handling.

@nrc
Copy link
Member

nrc commented Jul 6, 2017

BTW, I just pushed my changes to the config system so that configuration is handled by the client now

@robbym
Copy link
Contributor Author

robbym commented Jul 6, 2017

Awesome. I'll work on the extension then.

@nrc
Copy link
Member

nrc commented Jul 14, 2017

@robbym how's it going on the extension to this? Do you have any questions about anything?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants