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

notify opened files immediately if there are pending diagnostics #2211

Merged
merged 6 commits into from
Mar 2, 2023

Conversation

rchl
Copy link
Member

@rchl rchl commented Feb 26, 2023

Diagnostics are stored in Session and there might exist diagnostics for not-yet-opened files so notify Session Buffers immediately about those when creating new buffers.

This fixes somewhat obscure bug for servers that don't implement didOpen but also makes diagnostics show more quickly after opening files for other servers (in case diagnostics were already reported for those files).

Fixes #2200

Comment on lines 54 to 56
session_buffer = SessionBuffer(self, buffer_id, uri)
self._session_buffers[key] = session_buffer
self._session.register_session_buffer_async(session_buffer)
Copy link
Member Author

@rchl rchl Feb 26, 2023

Choose a reason for hiding this comment

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

Previously SessionBuffer registered itself in Session with:

self._session.register_session_buffer_async(self)

This caused crash as Session.register_session_buffer_async was called before self._session_buffers[key] = session_buffer and would crash depending on what we would want to do with SessionBuffer.

I think it makes more sense for SessionView to register SessionBuffer with Session as it is also responsible for creating SB.

@rchl rchl merged commit 6d96bd7 into main Mar 2, 2023
@rchl rchl deleted the fix/diagnostics branch March 2, 2023 20:06
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.

Does not cache diagnostics when switching between files
1 participant