nushell/tests/plugins
Devyn Cairns 73f3c0b60b
Support for all custom value operations on plugin custom values (#12088)
# Description

Adds support for the following operations on plugin custom values, in
addition to `to_base_value` which was already present:

- `follow_path_int()`
- `follow_path_string()`
- `partial_cmp()`
- `operation()`
- `Drop` (notification, if opted into with
`CustomValue::notify_plugin_on_drop`)

There are additionally customizable methods within the `Plugin` and
`StreamingPlugin` traits for implementing these functions in a way that
requires access to the plugin state, as a registered handle model such
as might be used in a dataframes plugin would.

`Value::append` was also changed to handle custom values correctly.

# User-Facing Changes

- Signature of `CustomValue::follow_path_string` and
`CustomValue::follow_path_int` changed to give access to the span of the
custom value itself, useful for some errors.
- Plugins using custom values have to be recompiled because the engine
will try to do custom value operations that aren't supported
- Plugins can do more things 🎉 

# Tests + Formatting
Tests were added for all of the new custom values functionality.

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting
- [ ] Document protocol reference `CustomValueOp` variants:
  - [ ] `FollowPathInt`
  - [ ] `FollowPathString`
  - [ ] `PartialCmp`
  - [ ] `Operation`
  - [ ] `Dropped`
- [ ] Document `notify_on_drop` optional field in `PluginCustomValue`
2024-03-12 10:37:08 +01:00
..
formats Correct line folding in from ics/from vcf (#10577) 2023-10-03 19:11:16 +02:00
config.rs Allow plugins to receive configuration from the nushell configuration (#10955) 2024-01-15 16:59:47 +08:00
core_inc.rs Plugin explicit flags (#11581) 2024-01-22 15:00:43 -06:00
custom_values.rs Support for all custom value operations on plugin custom values (#12088) 2024-03-12 10:37:08 +01:00
mod.rs Bidirectional communication and streams for plugins (#11911) 2024-02-25 16:32:50 -06:00
register.rs Show plugin extra usage and search terms (#10952) 2023-11-04 15:12:58 -05:00
stream.rs Add support for engine calls from plugins (#12029) 2024-03-09 11:26:30 -06:00