Skip to content

oneof<> parameter parsing with lists is incorrect #16445

Closed

Description

@Mrfiregem

Describe the bug

When using oneof<s, list<any>>, where s is a string-like type (string, path, glob), as the type annotation of a custom command's parameter, lists are incorrectly parsed as the type s.

Swapping the order of the two types in the oneof annotation correctly parses lists and single values, however.

How to reproduce

  1. Define the function with a parameter: def foo [s: oneof<glob, list<any>>] { $s | inspect }
  2. Run the command
> foo [foo bar baz] # Note that `[foo bar baz]` will be highlighted as a glob in the repl
╭─────────────┬──────╮
│ description │ glob │
├─────────────┴──────┤
│                    │
├────────────────────┤
│ [foo bar baz]      │
╰────────────────────╯

[foo bar baz]

Expected behavior

The value should be a list of three elements, to match the swapped version mentioned above; or at least bar and baz] should be treated as extra arguments and cause an error.

Configuration

key value
version 0.106.1
major 0
minor 106
patch 1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.88.0 (6b00bc388 2025-06-23) (built from a source tarball)
cargo_version cargo 1.88.0 (873a06493 2025-05-10)
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator standard
features default, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, reorder-cell-paths=false

Activity

  1. added
    status:needs-triage
    on Aug 16, 2025
  2. added
    A:parser
    A:type-system
    A:nuon-format
    and removed
    A:nuon-format
    on Aug 16, 2025
  3. ItsHarper commented on Aug 16, 2025

    @ItsHarper
    Contributor

    I think I've run into this before (just observed with the LSP).

    off-topic comment about the LSP

    The LSP is either quite buggy, or just exposes a lot of parser bugs. I haven't been reporting them because I'm not even sure which version of the LSP my new zed setup is using.

  4. blindFS commented on Aug 19, 2025

    @blindFS
    Contributor

    Same for other types

  5. blindFS commented on Aug 19, 2025

    @blindFS
    Contributor

    The LSP is either quite buggy, or just exposes a lot of parser bugs. I haven't been reporting them because I'm not even sure which version of the LSP my new zed setup is using.

    The version of nu-lsp upgrades with nu. I think you should report them.

  6. ItsHarper commented on Aug 19, 2025

    @ItsHarper
    Contributor

    The version of nu-lsp upgrades with nu. I think you should report them.

    I did know that, but I also know that zed likes to download LSPs on its own and I'm not sure if it's using my system's nu binary or not.

  7. blindFS commented on Aug 19, 2025

    @blindFS
    Contributor

    The version of nu-lsp upgrades with nu. I think you should report them.

    I did know that, but I also know that zed likes to download LSPs on its own and I'm not sure if it's using my system's nu binary or not.

    FYI https://github.com/zed-extensions/nu/blob/b8ed585150118b4c2f91d97e200b9972d775052c/src/nu.rs#L16-L24

  8. ItsHarper commented on Aug 19, 2025

    @ItsHarper
    Contributor

    Lovely, thank you! I'll definitely start reporting bugs then.

  9. added this to the v0.117.0 milestone on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:parserA:type-systemstatus:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions