nushell/crates/nu-plugin/src
Devyn Cairns 2562e306b6
Improve handling of custom values in plugin examples (#12409)
# Description
Requested by @ayax79. This makes the custom value behavior more correct,
by calling the methods on the plugin to handle the custom values in
examples rather than the methods on the custom values themselves. This
helps for handle-type custom values (like what he's doing with
dataframes).

- Equality checking in `PluginTest::test_examples()` changed to use
`PluginInterface::custom_value_partial_cmp()`
- Base value rendering for `PluginSignature` changed to use
`Plugin::custom_value_to_base_value()`
- Had to be moved closer to `serve_plugin` for this reason, so the test
for writing signatures containing custom values was removed
- That behavior should still be tested to some degree, since if custom
values are not handled, signatures will fail to parse, so all of the
other tests won't work.

# User-Facing Changes

- `Record::sort_cols()` method added to share functionality required by
`PartialCmp`, and it might also be slightly faster
- Otherwise, everything should mostly be the same but better. Plugins
that don't implement special handling for custom values will still work
the same way, because the default implementation is just a pass-through
to the `CustomValue` methods.

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-04-05 21:57:20 -05:00
..
plugin Improve handling of custom values in plugin examples (#12409) 2024-04-05 21:57:20 -05:00
protocol Improve handling of custom values in plugin examples (#12409) 2024-04-05 21:57:20 -05:00
serializers Rename Value::CustomValue to Value::Custom (#12309) 2024-03-27 22:10:56 +01:00
util Make drop notification timing for plugin custom values more consistent (#12341) 2024-04-04 09:13:25 +02:00
lib.rs Make drop notification timing for plugin custom values more consistent (#12341) 2024-04-04 09:13:25 +02:00
sequence.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00