-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Autosave for open buffers (#3637)
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
- Loading branch information
Showing
13 changed files
with
592 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
engine/language-server/src/main/scala/org/enso/languageserver/boot/TimingsConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.enso.languageserver.boot | ||
|
||
import scala.concurrent.duration._ | ||
|
||
/** TimingsConfig encapsulates information about timings or delays in messages being sent between services. | ||
* | ||
* @param autoSave a request timeout | ||
* @param autoSave if non-empty value, determines the delay when auto-save should be triggered | ||
*/ | ||
class TimingsConfig( | ||
private[this] val timeout: FiniteDuration, | ||
private[this] var autoSave: Option[FiniteDuration] | ||
) { | ||
def this(timeout: FiniteDuration) = { | ||
this(timeout, None) | ||
} | ||
|
||
/** A request timeout. | ||
* | ||
* @return a duration to wait for the request to be handled | ||
*/ | ||
def requestTimeout: FiniteDuration = timeout | ||
|
||
/** Auto-save delay. | ||
* | ||
* @return if non-empty, determines the delay when auto-save should be triggered after the last edit | ||
*/ | ||
def autoSaveDelay: Option[FiniteDuration] = autoSave | ||
|
||
/** Sets the delay for auto-save action that should be triggered after the last edit action. | ||
* | ||
* @param delay delay for auto-save action | ||
* @return updated config | ||
*/ | ||
def withAutoSave(delay: FiniteDuration): TimingsConfig = { | ||
autoSave = Some(delay) | ||
this | ||
} | ||
} | ||
|
||
object TimingsConfig { | ||
def default(): TimingsConfig = new TimingsConfig(10.seconds) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.