Skip to content

Avoid duplicate handling of response update#211

Merged
renkun-ken merged 2 commits intoREditorSupport:masterfrom
renkun-ken:duplicate-update
Feb 2, 2020
Merged

Avoid duplicate handling of response update#211
renkun-ken merged 2 commits intoREditorSupport:masterfrom
renkun-ken:duplicate-update

Conversation

@renkun-ken
Copy link
Copy Markdown
Member

@renkun-ken renkun-ken commented Jan 29, 2020

Closes #205

Some software may watch a folder and modifies the file on file change in the folder, which causes a new line in response.log to be handled multiple times.

One example is OneDrive software under both Windows and macOS. It is constantly syncing a OneDrive folder. If a workspace folder in the OneDrive folder is open in VSCode, any update of response.log will result in duplicate handling, e.g. View(mtcars) creates multiple tabs of the same data.

To avoid this, we record the number of lines of response.log on each scan of the file. We only handle the last line when the number of lines increase changes. As a result, if a new line is appended to response.log, and updateResponse is called multiple times due to the syncing may cause the file to be somehow updated multiple times, only the first time it is handled will take effect.

@renkun-ken
Copy link
Copy Markdown
Member Author

It seems we only need the number of lines to change rather than increase to trigger handling response update. When user removes historic lines, the number of lines decreases. And appending new lines should also work then.

@renkun-ken renkun-ken merged commit f056b39 into REditorSupport:master Feb 2, 2020
@Ikuyadeu
Copy link
Copy Markdown
Member

Ikuyadeu commented Feb 2, 2020

@renkun-ken Thank you for your changes.

From the next pull request, could you wait for the others review(me or @andycraig )?
In this time, I will clean up the whole of the project for future contributors.
The current code style is not fit the tslint style(white-space, console...) and each hunks or functions are too big.

@renkun-ken
Copy link
Copy Markdown
Member Author

@Ikuyadeu Thanks for your reminder!

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.

Duplicate handling of response update

2 participants