Skip to content

Decouple saving and running the worksheet #5238

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

Merged
merged 2 commits into from
Oct 15, 2018

Conversation

smarter
Copy link
Member

@smarter smarter commented Oct 10, 2018

  • Do not automatically save the worksheet when the run command is
    executed.
  • Make it possible to save the worksheet without running it (by setting
    the configuration value dotty.runWorksheetOnSave to false)

@smarter smarter requested a review from Duhemm October 10, 2018 17:35
@smarter smarter force-pushed the worksheet-stuff-2 branch 2 times, most recently from 1b4b69c to 208af0b Compare October 10, 2018 17:36
this.removeRedundantBlankLines().then(_ => this.reset())
}

/**
* Run the worksheet in `document`, display a progress bar during the run.
*/
run(): Thenable<{}> {
this.prepareRun()
Copy link
Contributor

Choose a reason for hiding this comment

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

So you run the worksheet without it being saved, which will work because the compiler doesn't run it from the source that is in the file, but from the source that it received in textDocument/didChange, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

@Duhemm Duhemm assigned smarter and unassigned Duhemm Oct 11, 2018
- Do not automatically save the worksheet when the run command is
  executed.
- Make it possible to save the worksheet without running it (by setting
  the configuration value dotty.runWorksheetOnSave to false)
- Replaced removeRedundantBlankLines by removeRedundantBlankLinesEdit which
doesn't have side-effects but returns an array of TextEdit
- Fixed onWillSaveTextDocument to call event.waitUntil which is the only
way to actually apply changes synchronously.
- Removed the return in onDidSaveTextDocument, the result of the lambda
for an event isn't actually used for anything
- Changed Worksheet#run() to have a more precise result type and to only
run something if prepareRun() succeeded.
@Duhemm Duhemm merged commit 7087a6c into scala:master Oct 15, 2018
@Duhemm Duhemm deleted the worksheet-stuff-2 branch October 15, 2018 07:52
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.

2 participants