-
Notifications
You must be signed in to change notification settings - Fork 321
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
Support Autosave for open buffers #3637
Conversation
9bc75e4
to
cba99e9
Compare
### `text/autoSave` | ||
|
||
This is a notification sent from the server to the clients to inform them of any | ||
successful auto-save action. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
timeoutCancellable: Cancellable | ||
): Receive = { | ||
case IOTimeout => | ||
replyTo ! SaveFailed(OperationTimeout) | ||
replyTo.foreach(_ ! SaveFailed(OperationTimeout)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replyTo
be None
and None.foreach
is a check to do nothing, I see.
engine/language-server/src/main/scala/org/enso/languageserver/text/CollaborativeBuffer.scala
Show resolved
Hide resolved
engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala
Outdated
Show resolved
Hide resolved
engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala
Outdated
Show resolved
Hide resolved
engine/language-server/src/main/scala/org/enso/languageserver/text/CollaborativeBuffer.scala
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that there is a text/openBuffer
command that creates an in-memory buffer. And we should not run the auto-save logic for buffers that were opened this way.
I think we can get away with an extra isInMemory
state in the CollaborativeBuffer
actor
This change adds the auto-save action that will be schedule after every edit request. If no edit happens after the auto-save delay, language server will automatically trigger file saving. This does not yet trigger propagate the information about the successful save to the sender of the last edit request.
Minor cleanup to avoid spurious messages.
f797a8f
to
0f67a00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Pull Request Description
This change adds Autosave action for open buffers. The action is scheduled
after every edit request and is cancelled by every explicit save file request, if
necessary. Successful autosave also notifies any active clients of the buffer.
Related to https://www.pivotaltracker.com/story/show/182721656
Important Notes
WIP
Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide dist
and./run ide watch
.