nushell/crates/nu-protocol
zc he f46f8b286b
refactor(parser): use var_id for most constants in ResolvedImportPattern (#14920)
# Description

This PR replaces most of the constants in `ResolvedImportPattern` from
values to VarIds, this has benefits of:
1. less duplicated variables in state
2. precise span of variable, for example when calling `goto def` on a
const imported by the `use` command, this allows it to find the original
definition, instead of where the `use` command is.

Note that the logic is different here for nested submodules, not all
values are flattened and propagated to the outmost record variable, but
I didn't find any differences in real world usage.

I noticed that it was changed from `VarId` to `Value` in #10049.
Maybe @kubouch can find some edge cases where this PR fails to work as
expected.

In my view, the record constants for `ResolvedImportPattern` should even
reduced to single entry, if not able to get rid of.

# User-Facing Changes

# Tests + Formatting

# After Submitting
2025-01-26 15:43:34 +02:00
..
src refactor(parser): use var_id for most constants in ResolvedImportPattern (#14920) 2025-01-26 15:43:34 +02:00
tests Improve and fix filesize formatting/display (#14397) 2025-01-22 22:24:51 -08:00
Cargo.toml Improve and fix filesize formatting/display (#14397) 2025-01-22 22:24:51 -08:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00
README.md Add nu-protocol 2021-09-02 13:29:43 +12:00

nu-protocol

The nu-protocol crate holds the definitions of structs/traits that are used throughout Nushell. This gives us one way to expose them to many other crates, as well as make these definitions available to each other, without causing mutually recursive dependencies.