-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add Execution Context control to Text.write #6459
Conversation
|
||
is_enabled = Context.Output.is_enabled | ||
|
||
if_existing = if is_enabled then on_existing_file else |
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 wonder if this logic might be moved into Existing_File_Behavior.
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.
yes, that's exactly what I expect to do as we build it out.
Will be cases we need special handling but this should work for writing text and bytes. Likewise for Table.write
with exception of Excel (which is odd).
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 agree that it would be good to move this to some common place. But OK with doing that later, once we actually have >1 place using it.
22df67e
to
0003277
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.
Accepted rs file
distribution/lib/Standard/Base/0.0.0-dev/src/System/File_Format.enso
Outdated
Show resolved
Hide resolved
Existing_File_Behavior.Error -> if actual.exists then Error.throw (File_Error.Already_Exists actual) else Existing_File_Behavior.Overwrite | ||
_ -> on_existing_file | ||
|
||
file = if is_enabled then actual else actual.create_dry_run_file copy_original=on_existing_file==Existing_File_Behavior.Append |
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.
This is getting complicated. But I appreciate this allows us to have quite sane dry-run behaviour, so I think it's ok. I hope we will not have to have these kinds of complications scattered around all of our write
methods, but hopefully will be able to encapsulate it in some single place.
But that's something to be done later, just noting the intentions.
distribution/lib/Standard/Base/0.0.0-dev/src/System/File/Write_Extensions.enso
Outdated
Show resolved
Hide resolved
std-bits/base/src/main/java/org/enso/base/DryRunFileManager.java
Outdated
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.
Looks good, I'm glad we will finally be able to test these in practice
84caa39
to
4acee30
Compare
- Adjusted Context.is_enabled to support default argument. - Made environment case-insensitive. - Add temporary file support. - Execution Context first pass in Text.write. - Added format drop down to `read`. - Renamed JSON_File to JSON_Format to be consistent.
- Add doc for Text.write. - Low level error for file writing. - Warning on dry run. - Fixes for File_Format drop down. - Fix for play button call.
- Fix encoding drop down. - Repair test issues from blocking writing operations. - Allow Examples to write.
Fix encoding drop down.
dd90e83
to
34b19c2
Compare
* develop: (34 commits) Continued Execution Context work and some little fixes (#6506) IDE's logging to a file (#6478) Fix application config (#6513) Cloud/desktop mode switcher (#6448) Fix doubled named arguments bug (#6422) Reimplement `enso_project` as a proper builtin (#6352) Fix layer ordering between dropdown and breadcrumbs backgrounds. (#6483) Multiflavor layers (#6477) DataflowAnalysis preserves dependencies order (#6493) Implement `create_database_table` for Database Table (#6467) Limit Dead Letter logging (#6482) More reliable shutdown of the EnsoContext to save resources (#6468) Make execution mode `live` default for CLI (#6496) Finishing Vector Editor (#6470) Proper handling of multiple list views. (#6461) Fix disappearing cached shapes (#6458) Add Execution Context control to Text.write (#6459) Change defaults for `Connection.tables` and ensure that `Connection.query` recognizes all available tables (#6443) Introducing @BuiltinMethod.needsFrame and InlineableNode (#6442) Hide profile button behind a feature flag (#6430) ...
Pull Request Description
Context.is_enabled
to support default argument (moved built in so can have defaults).environment
case-insensitive.Forbidden_Operation
error.File.create_temporary_file
which is deleted on exit of JVM.Text.write
.DryRunFileManager
which will create and manage the temporary files.format
dropdown toFile.read
andData.read
.JSON_File
toJSON_Format
to be consistent.(still to unit test).
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.