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

Diagnostics rework #754

Merged
merged 14 commits into from Nov 13, 2019
Merged

Diagnostics rework #754

merged 14 commits into from Nov 13, 2019

Conversation

tomv564
Copy link
Contributor

@tomv564 tomv564 commented Oct 15, 2019

The "Show diagnostics panel after saving" investigation (#748) showed the functionality could be "tacked" on, but would work better if components were set up in proper relations instead of querying global state.

In this PR, a DiagnosticsPresenter is introduced which gets access to DocumentHandler's events.

Clean ups:

Desired fixes:

  • Stop using global_events for pushing diagnostics updates to ui

  • Remove duplication of looping logic over diagnostics after an update: update_diagnostics_in_status_bar , update_diagnostics_panel, window_has_relevant_diagnostics, update_view_diagnostics (trying a strategy to update many things in a single walk through)

  • Remove duplication querying diagnostics at a point: point_diagnostics_by_config vs get_line_diagnostics (perhaps share a cache if cursor listener and bulb listener both want diagnostics?)

  • Try to remove the need for get_window_diagnostics / get_view_diagnostics - it should be easy to access the DiagnosticsStorage, and it should expose useful functions for accessing/filtering data.

self.invoke_each(lambda w: w.begin())

if diagnostics_by_file is not None:
if diagnostics_by_file:
Copy link
Member

Choose a reason for hiding this comment

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

Why the double if for diagnostics_by_file? :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, should have left a TODO there. The old update_diagnostics_panel had both checks and did nothing at all if diagnostics_by_file was None - I think that case can't happen anymore, so I'll remove the check!

@AmjadHD
Copy link
Contributor

AmjadHD commented Oct 22, 2019

Since this PR is a "rework" of diagnostics, would you consider adding unicode symbols, as such:
error: ❌
warning: ⚠
info: ⓘ
That makes diagnostics look prettier and match other editors.

@tomv564
Copy link
Contributor Author

tomv564 commented Nov 12, 2019

@AmjadHD this PR is more about refactoring code instead of UI polish - if we can do something that looks good in all fonts then I'd like to see an example.

@coveralls
Copy link

coveralls commented Nov 12, 2019

Coverage Status

Coverage decreased (-0.3%) to 34.869% when pulling 6a194b0 on diagnostics-rework into 2f64a44 on master.

@tomv564 tomv564 changed the title WIP: Diagnostics rework Diagnostics rework Nov 13, 2019
@tomv564 tomv564 merged commit c0bca2f into master Nov 13, 2019
@tomv564 tomv564 deleted the diagnostics-rework branch November 13, 2019 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants