Repository navigation
Accept Command with args for BufferEditor - #630
Conversation
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for taking care of this!
Thanks for being considerate about breaking changes. In this case I think to make errors less likely I would be open to one.
To keep things simple and tidy, we could pass std::process::Command directly. It communicates the requirements very clearly, is Send/Sync, and you can add the file just by .arg() and then .spawn()
|
Personally I think just store a set of string is more flexible so reedline can implement its own feature like hints for argument (e.g. throw warning when call vscode without and I also agree that |
|
I think as a library reedline doesn't have to take full responsibility for that. If you want to implement additional checks for the editor you would also have to implement them on the nushell (or other app) side if there is any use of an editor. |
I don't think it's true.
|
|
Mhh fn with_buffer_editor(mut self, editor: Command, ....) -> SelfInstead of fn with_buffer_editor(mut self, editor: Command, tempfile: impl AsRef<OsStr>) -> Selfso the file name is not dependent on reedline and can be configured to please the application. But then the responsibility to deconflict multiple A strong argument for |
|
I get your point and now the new api only accepts
|
|
Thanks for the quick turnaround, with a I think, as we will bump the leading version number, we would be fine with just making the breaking change to
We could check that |
Codecov Report
@@ Coverage Diff @@
## main #630 +/- ##
=======================================
Coverage 49.80% 49.80%
=======================================
Files 41 41
Lines 7805 7821 +16
=======================================
+ Hits 3887 3895 +8
- Misses 3918 3926 +8
|
The old `with_buffer_editor` would have not set the file and `with_buffer_editor_command` had unclear semantics if you should provide the file to the command or not. Instead of going the route of deprecation let's just make the breaking change and update `with_buffer_editor` to a more practical signature. Expect a `Command` and a `PathBuf` for the file. If the file is not among the args push it.
|
I took the liberty to move the new flexible but explicit behavior into the Thanks for getting us in a good shape here @horasal! |
BufferEditorCommand with args for BufferEditor
use one temp file per instance Pull in recent reedline Fix to `with_buffer_editor` nushell/reedline#630
use one temp file per instance Pull in recent reedline Fix to `with_buffer_editor` nushell/reedline#630
use one temp file per instance Pull in recent reedline Fix to `with_buffer_editor` nushell/reedline#630
Thin pr contains the reedline-side change for nushell/nushell#10210
BufferEditorin current reedline only use a big string to represent editor and it's arguments, which is broken when editor's path contains any spaces. This pr makeBufferEditoralso acceptlist<string>from$nu.EDITORjust likeconfig env.(To avoid breaking current version of nushell, this pr add a new api
with_argumented_buffer_editorinstead of directly modifywith_buffer_editor.)