Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Conversation

@MikhailArkhipov
Copy link

@MikhailArkhipov MikhailArkhipov commented Aug 24, 2019

Fixes #1466
Fixes #1449
Fixes #1425
Fixes #1353

Although text buffer updates come from the same thread, it does can be read concurrently by the analysis and Reset can be called as well (although this is probably extremely rare as we do not call Reset on user files when analysis completes).

Call for content by the parser or analyzer may cause conversion of the string builder to _content in the middle of the string builder update yielding odd partial results.

public string Text {
get {
lock (_lock) {
return _content ?? (_content = _sb?.ToString() ?? string.Empty);
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 case when _content == null and _sb == null?

Copy link
Author

Choose a reason for hiding this comment

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

Technically when something calls Text before initial Update

Copy link
Author

Choose a reason for hiding this comment

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

However, we can just create _sb at construction time for simplicity

@MikhailArkhipov MikhailArkhipov merged commit 9f4fb3e into microsoft:master Aug 26, 2019
@MikhailArkhipov MikhailArkhipov deleted the desync branch August 26, 2019 20:58
@haollhao
Copy link

I am using the latest version of the extension (2019.9.34911) and the synchronization problem still exists.

@MikhailArkhipov
Copy link
Author

LS version is unrelated to the extension version and is not tied to it. Which LS version do you see in the output? Something like 0.3.x or 0.4.x

@jakebailey
Copy link
Member

Please open an issue with your problem and the information we request in the template; if this PR didn't fix your issue, then it may be something else.

Note that the extension version is not the language server version. They are versioned separately.

jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
* Synchronize text buffer

* Simplify

* One more

* Use ??

* Typo

* Simplify
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

4 participants