mirror of
https://github.com/nushell/nushell.git
synced 2025-02-22 13:31:34 +01:00
a2e335dcd7
6593 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
|
cce12efe48
|
Rename std/core to std/prelude (#14962)
`std/core` is always loaded by Nushell during startup, and the commands in it are always available. As such, it's renamed `std/prelude`. `scope modules` and `view files` now show `prelude` in place of `core`. |
||
|
aa62de78e6
|
Fix: Directories using a tilde to represent HOME will now be converted to an absolute-path before running an external (#14959)
Fixes #14780 - Directories using a tilde to represent HOME will now be converted to an absolute-path before running an external. |
||
|
08b5d5cce5
|
fix(completion): DotNuCompletion now completes nu scripts in const $NU_LIB_DIRS (#14955)
# Description For nu scripts completion with command `use`/`overlay use`/`source-env`, it now supports `nu --include-path`. Also fixes some irrelevant clippy complaints. # User-Facing Changes # Tests + Formatting # After Submitting |
||
|
03bb144150
|
Bump shadow-rs from 0.37.0 to 0.38.0 (#14952)
Bumps [shadow-rs](https://github.com/baoyachi/shadow-rs) from 0.37.0 to 0.38.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/baoyachi/shadow-rs/releases">shadow-rs's releases</a>.</em></p> <blockquote> <h2>v0.38.0</h2> <h2>What's Changed</h2> <ul> <li>fix: ignore false-positive clippy lint trigger by <a href="https://github.com/mchodzikiewicz"><code>@mchodzikiewicz</code></a> in <a href="https://redirect.github.com/baoyachi/shadow-rs/pull/196">baoyachi/shadow-rs#196</a></li> <li>Rename const define by <a href="https://github.com/baoyachi"><code>@baoyachi</code></a> in <a href="https://redirect.github.com/baoyachi/shadow-rs/pull/198">baoyachi/shadow-rs#198</a></li> <li>Update git2 to v0.20 by <a href="https://github.com/jewlexx"><code>@jewlexx</code></a> in <a href="https://redirect.github.com/baoyachi/shadow-rs/pull/200">baoyachi/shadow-rs#200</a></li> <li>Unit test ci by <a href="https://github.com/baoyachi"><code>@baoyachi</code></a> in <a href="https://redirect.github.com/baoyachi/shadow-rs/pull/202">baoyachi/shadow-rs#202</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/baoyachi/shadow-rs/compare/v0.37.0...v0.38.0">https://github.com/baoyachi/shadow-rs/compare/v0.37.0...v0.38.0</a></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|
080b501ba8
|
Fix cargo doc Warnings (#14948)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> As an avid `cargo doc` enjoyer I realized we had some doc warnings, so I fixed them. After this PR `cargo doc --workspace` should stop throwing warnings. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> No code changes. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> We could add a `cargo doc` CI pipeline but usually running a full `cargo doc` takes like forever, so maybe we don't want that. |
||
|
66bc0542e0
|
Refactor I/O Errors (#14927)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx
you can also mention related issues, PRs or discussions!
-->
# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.
Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->
As mentioned in #10698, we have too many `ShellError` variants, with
some even overlapping in meaning. This PR simplifies and improves I/O
error handling by restructuring `ShellError` related to I/O issues.
Previously, `ShellError::IOError` only contained a message string,
making it convenient but overly generic. It was widely used without
providing spans (#4323).
This PR introduces a new `ShellError::Io` variant that consolidates
multiple I/O-related errors (except for `ShellError::NetworkFailure`,
which remains distinct for now). The new `ShellError::Io` variant
replaces the following:
- `FileNotFound`
- `FileNotFoundCustom`
- `IOInterrupted`
- `IOError`
- `IOErrorSpanned`
- `NotADirectory`
- `DirectoryNotFound`
- `MoveNotPossible`
- `CreateNotPossible`
- `ChangeAccessTimeNotPossible`
- `ChangeModifiedTimeNotPossible`
- `RemoveNotPossible`
- `ReadingFile`
## The `IoError`
`IoError` includes the following fields:
1. **`kind`**: Extends `std::io::ErrorKind` to specify the type of I/O
error without needing new `ShellError` variants. This aligns with the
approach used in `std::io::Error`. This adds a second dimension to error
reporting by combining the `kind` field with `ShellError` variants,
making it easier to describe errors in more detail. As proposed by
@kubouch in [#design-discussion on
Discord](https://discord.com/channels/601130461678272522/615329862395101194/1323699197165178930),
this helps reduce the number of `ShellError` variants. In the error
report, the `kind` field is displayed as the "source" of the error,
e.g., "I/O error," followed by the specific kind of I/O error.
2. **`span`**: A non-optional field to encourage providing spans for
better error reporting (#4323).
3. **`path`**: Optional `PathBuf` to give context about the file or
directory involved in the error (#7695). If provided, it’s shown as a
help entry in error reports.
4. **`additional_context`**: Allows adding custom messages when the
span, kind, and path are insufficient. This is rendered in the error
report at the labeled span.
5. **`location`**: Sometimes, I/O errors occur in the engine itself and
are not caused directly by user input. In such cases, if we don’t have a
span and must set it to `Span::unknown()`, we need another way to
reference the error. For this, the `location` field uses the new
`Location` struct, which records the Rust file and line number where the
error occurred. This ensures that we at least know the Rust code
location that failed, helping with debugging. To make this work, a new
`location!` macro was added, which retrieves `file!`, `line!`, and
`column!` values accurately. If `Location::new` is used directly, it
issues a warning to remind developers to use the macro instead, ensuring
consistent and correct usage.
### Constructor Behavior
`IoError` provides five constructor methods:
- `new` and `new_with_additional_context`: Used for errors caused by
user input and require a valid (non-unknown) span to ensure precise
error reporting.
- `new_internal` and `new_internal_with_path`: Used for internal errors
where a span is not available. These methods require additional context
and the `Location` struct to pinpoint the source of the error in the
engine code.
- `factory`: Returns a closure that maps an `std::io::Error` to an
`IoError`. This is useful for handling multiple I/O errors that share
the same span and path, streamlining error handling in such cases.
## New Report Look
This is simulation how the I/O errors look like (the `open crates` is
simulated to show how internal errors are referenced now):

## `Span::test_data()`
To enable better testing, `Span::test_data()` now returns a value
distinct from `Span::unknown()`. Both `Span::test_data()` and
`Span::unknown()` refer to invalid source code, but having a separate
value for test data helps identify issues during testing while keeping
spans unique.
## Cursed Sneaky Error Transfers
I removed the conversions between `std::io::Error` and `ShellError` as
they often removed important information and were used too broadly to
handle I/O errors. This also removed the problematic implementation
found here:
|
||
|
ec1f7deb23
|
fix(help operators): include has and not-has operators (#14943)
# Description
Realized the recently `has`/`not-has` operators were not shown with
`help operators`.
|
||
|
45f9d03025
|
fix(explore): Fix esc immediately closing explore in expand and try view (#14941)
This fixes #14039 <!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> # User-Facing Changes Pressing `esc` or `q` in expand and try view no longer closes explore. This is not intentional <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
4bc28f1752
|
feat(lsp): show value on hover for const variables and CellPaths (#14940)
# Description e.g. <img width="299" alt="image" src="https://github.com/user-attachments/assets/3c16835a-6d4d-48ec-b7d6-68d5bdb88ea2" /> and `goto def` on cell paths now finds the specific cell (only for const) instead of doing nothing. # User-Facing Changes # Tests + Formatting # After Submitting |
||
|
a2705f9eb5
|
Fix reject regression (#14931)
This PR solves the regression introduced by #14622 (sorry about that). It also adds a test to cover the regression. Closes #14929. |
||
|
c0b4d19761
|
Polars upgrade to 0.46 (#14933)
Upgraded to Polars 0.46 |
||
|
b53271b86a
|
fix(parser): span of keyword expression (#14928)
# Description This PR fixes #14816 , so that expression-contains-position check won't need special treatment for keyword expressions. e.g. ```nushell overlay use foo as bar # |_______ cursor here if true { } else { } # |_______ here ``` as mentioned in #14924 # User-Facing Changes # Tests + Formatting # After Submitting |
||
|
5ca4e903c8
|
fix(lsp): goto/hover on module name in some commands (#14924)
# Description This PR enables basic goto def/hover features on module name in commands: 1. hide 2. overlay use 3. overlay hide ## Some pending issues 1. Somewhat related to #14816 ```nushell overlay use foo as bar # |_______ cursor here ``` fails to work, since the position of the cursor is outside of the whole span of this call expression. I'll try to fix #14816 later instead of implementing new weird workarounds. 2. references/renaming however is still buggy on overlays with `as`/`--prefix` features enabled. # User-Facing Changes # Tests + Formatting 3 more tests # After Submitting |
||
|
0ad5f4389c
|
nu_plugin_polars: add polars into-repr to display dataframe in portable repr format (#14917)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR adds a new command that outputs a NuDataFrame or NuLazyFrame in its repr format, which can then be ingested in another polars instance. Advantages of serializing a dataframe in this format are that it can be viewed as a table, carries type information, and can easily be copied to the clipboard. ```nushell # In Nushell > [[a b]; [2025-01-01 2] [2025-01-02 4]] | polars into-df | polars into-lazy | polars into-repr shape: (2, 2) ┌─────────────────────┬─────┐ │ a ┆ b │ │ --- ┆ --- │ │ datetime[ns] ┆ i64 │ ╞═════════════════════╪═════╡ │ 2025-01-01 00:00:00 ┆ 2 │ │ 2025-01-02 00:00:00 ┆ 4 │ └─────────────────────┴─────┘ ``` ```python # In python >>> import polars as pl >>> df = pl.from_repr(""" ... shape: (2, 2) ... ┌─────────────────────┬─────┐ ... │ a ┆ b │ ... │ --- ┆ --- │ ... │ datetime[ns] ┆ i64 │ ... ╞═════════════════════╪═════╡ ... │ 2025-01-01 00:00:00 ┆ 2 │ ... │ 2025-01-02 00:00:00 ┆ 4 │ ... └─────────────────────┴─────┘""") shape: (2, 2) ┌─────────────────────┬─────┐ │ a ┆ b │ │ --- ┆ --- │ │ datetime[ns] ┆ i64 │ ╞═════════════════════╪═════╡ │ 2025-01-01 00:00:00 ┆ 2 │ │ 2025-01-02 00:00:00 ┆ 4 │ └─────────────────────┴─────┘ >>> df.select(pl.col("a").dt.offset_by("12m")) shape: (2, 1) ┌─────────────────────┐ │ a │ │ --- │ │ datetime[ns] │ ╞═════════════════════╡ │ 2025-01-01 00:12:00 │ │ 2025-01-02 00:12:00 │ └─────────────────────┘ ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> A new command `polars into-repr` is added. No other commands are impacted by the changes in this PR. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Examples were added in the command definition. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
7ea4895513
|
Use ref-cast crate to remove some unsafe (#14897)
# Description In a few places, `nu-path` uses `unsafe` to do reference casts. This PR adds the [`ref-cast`](https://crates.io/crates/ref-cast) crate to do reference casts in a "safe" manner. |
||
|
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 |
||
|
f88ed6ecd5
|
Fix improperly escaped strings in stor update (#14921)
# Description Fixes #14909 with the same technique used in #12820 for `stor insert`. Single quotes (and others) now work properly in strings passed to `stor update`. Also did some minor refactoring on `stor insert` so it matches the changes in `stor update`. # User-Facing Changes Bug-fix. # Tests + Formatting Test added for this scenario. - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
||
|
a011791631
|
Fallback to file completer in custom/external completer (#14781)
# Description Closes #14595. This modifies the behavior of both custom and external completers so that if the custom/external completer returns an invalid value, completions are suppressed and an error is logged. However, if the completer returns `null` (which this PR treats as a special value), we fall back to file completions. Previously, custom completers and external completers had different behavior. Any time an external completer returned an invalid value (including `null`), we would fall back to file completions. Any time a custom completer returned an invalid value (including `null`), we would suppress completions. I'm not too happy about the implementation, but it's the least intrusive way I could think of to do it. I added a `fallback` field to `CustomCompletions` that's checked after calling its `fetch()` method. If `fallback` is true, then we use file completions afterwards. An alternative would be to make `CustomCompletions` no longer implement the `Completer` trait, and instead have its `fetch()` method return an `Option<Vec<Suggestion>>`. But that resulted in a teeny bit of code duplication. # User-Facing Changes For those using an external completer, if they want to fall back to file completions on invalid values, their completer will have to explicitly return `null`. Returning `"foo"` or something will no longer make Nushell use file completions instead. For those making custom completers, they now have the option to fall back to file completions. # Tests + Formatting Added some tests and manually tested that if the completer returns an invalid value or the completer throws an error, that gets logged and completions are suppressed. # After Submitting The documentation for custom completions and external completers will have to be updated after this. |
||
|
c783b07d58
|
Remove unsued types (#14916)
# Description `Type::Block` and `Type::Signature` do not correspond to any `Value` cases and should be able to be removed. |
||
|
e3e2554b3d
|
Link to Blog in the welcome banner (#14914)
# Description With the fragmentation and proliferation of social media platforms, we're attempting to consolidate our news and official Nushell communications to: * The Nushell website, with updates posted on the Blog * Discord * GitHub This PR replaces Twitter with the Nushell Blog in the welcome banner. The other links were already available. # User-Facing Changes Welcome banner # Tests + Formatting # After Submitting |
||
|
926b0407c5
|
seq date : generalize to allow any duration for --increment argument (#14903)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR seeks to generalize the `seq date` command so that it can receive any duration as an `--increment`. Whereas the current command can only output a list of dates spaced at least 1 day apart, the new command can output a list of datetimes that are spaced apart by any duration. For example: ``` > seq date --begin-date 2025-01-01 --end-date 2025-01-02 --increment 6hr --output-format "%Y-%m-%d %H:%M:%S" ╭───┬─────────────────────╮ │ 0 │ 2025-01-01 00:00:00 │ │ 1 │ 2025-01-01 06:00:00 │ │ 2 │ 2025-01-01 12:00:00 │ │ 3 │ 2025-01-01 18:00:00 │ │ 4 │ 2025-01-02 00:00:00 │ ╰───┴─────────────────────╯ ``` Note that the default behavior remains unchanged: ``` > seq date --begin-date 2025-01-01 --end-date 2025-01-02 ╭───┬────────────╮ │ 0 │ 2025-01-01 │ │ 1 │ 2025-01-02 │ ╰───┴────────────╯ ``` The default output format also remains unchanged: ``` > seq date --begin-date 2025-01-01 --end-date 2025-01-02 --increment 6hr ╭───┬────────────╮ │ 0 │ 2025-01-01 │ │ 1 │ 2025-01-01 │ │ 2 │ 2025-01-01 │ │ 3 │ 2025-01-01 │ │ 4 │ 2025-01-02 │ ╰───┴────────────╯ ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> ## Breaking Changes * The `--increment` argument no longer accepts just an integer and requires a duration ``` # NEW BEHAVIOR > seq date --begin-date 2025-01-01 --end-date 2025-01-02 --increment 1 Error: nu::parser::parse_mismatch × Parse mismatch during operation. ╭─[entry #13:1:68] 1 │ seq date --begin-date 2025-01-01 --end-date 2025-01-02 --increment 1 · ┬ · ╰── expected duration with valid units ╰──── ``` EDIT: Break Change is mitigated. `--increment` accepts either an integer or duration. ## Bug Fix * The `--days` argument had an off-by-one error and would print 1 too many elements in the output. For example, ``` # OLD BEHAVIOR > seq date -b 2025-01-01 --days 5 --increment 1 ╭───┬────────────╮ │ 0 │ 2025-01-01 │ │ 1 │ 2025-01-02 │ │ 2 │ 2025-01-03 │ │ 3 │ 2025-01-04 │ │ 4 │ 2025-01-05 │ │ 5 │ 2025-01-06 │ <-- Extra element ╰───┴────────────╯ # NEW BEHAVIOR > seq date -b 2025-01-01 --days 5 --increment 1day ╭───┬────────────╮ │ 0 │ 2025-01-01 │ │ 1 │ 2025-01-02 │ │ 2 │ 2025-01-03 │ │ 3 │ 2025-01-04 │ │ 4 │ 2025-01-05 │ ╰───┴────────────╯ ``` ## New Argument * A `--periods` argument is introduced to indicate the number of output elements, regardless of the `--increment` value. Importantly, the `--days` argument is ignored when `--periods` is set. ``` # NEW BEHAVIOR > seq date -b 2025-01-01 --days 5 --periods 10 --increment 1day ╭───┬────────────╮ │ 0 │ 2025-01-01 │ │ 1 │ 2025-01-02 │ │ 2 │ 2025-01-03 │ │ 3 │ 2025-01-04 │ │ 4 │ 2025-01-05 │ │ 5 │ 2025-01-06 │ │ 6 │ 2025-01-07 │ │ 7 │ 2025-01-08 │ │ 8 │ 2025-01-09 │ │ 9 │ 2025-01-10 │ ╰───┴────────────╯ ``` Note that the `--days` and `--periods` arguments differ in their functions. The `--periods` value determines the number of elements in the output that are always spaced `--increment` apart. The `--days` value determines the bookends `--begin-date` and `--end-date` when only one is set, though the number of elements may differ based on the `--increment` value. ``` # NEW BEHAVIOR > seq date -e 2025-01-01 --days 2 --increment 5hr --output-format "%Y-%m-%d %H:%M:%S" ╭───┬─────────────────────╮ │ 0 │ 2025-01-23 22:25:05 │ │ 1 │ 2025-01-24 03:25:05 │ │ 2 │ 2025-01-24 08:25:05 │ │ 3 │ 2025-01-24 13:25:05 │ │ 4 │ 2025-01-24 18:25:05 │ ╰───┴─────────────────────╯ ``` # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> I added several examples for each user-facing change in `generators/seq_date.rs` and some tests in `tests/commands/seq_date.rs`. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
22a01d7e76
|
Use single atom for fuzzy matching (fix #14904) (#14913)
# Description Closes #14904. The bug there was introduced by #14846, which replaced skim with Nucleo. It turns out that Nucleo's `Pattern::new` function doesn't treat the needle as a single atom - it splits on spaces and makes each word its own atom. This PR fixes the problem by creating a single `Atom` for the whole needle rather than creating a `Pattern`. Because of the bug, when you typed `lines <TAB>` (with a space at the end), the suggestion `lines` was also matched. This suggestion was shorter than the original typed needle, which would cause an out-of-bounds error. This also meant that if you typed `foo bar<TAB>`, `foo aaaaa bar` would be shown before `foo bar aaa`. At the time, I didn't realize that it was more intuitive to have `foo bar aaa` be put first. # User-Facing Changes Typing something like `lines <TAB>` should no longer cause a panic. # Tests + Formatting - Added a test to ensure spaces are respected when fuzzy matching - Updated a test with the changed sort order for subcommand suggestions # After Submitting No need to update docs. |
||
|
299453ecb7
|
feat(lsp): better completion item documentation (#14905)
# Description This PR adds those markdown doc strings (previously only available via hover) to completion items: <img width="676" alt="image" src="https://github.com/user-attachments/assets/58c44d7d-4b49-4955-b3f0-fa7a727a8bc0" /> It also refactors a bit, primarily to prevent namespace pollution. # User-Facing Changes # Tests + Formatting # After Submitting |
||
|
fd684a204c
|
non-HTTP(s) URLs now works with start (#14370)
# Description this PR should close #14315 This PR enhances the start command in Nushell to handle both files and URLs more effectively, including support for custom URL schemes. Previously, the start command only reliably opened HTTP and HTTPS URLs, and custom schemes like Spotify and Obsidian which were not handled earlier. 1. **Custom URL Schemes Support:** - Added support for opening custom URL schemes 2. **Detailed Error Messages:** - Improved error reporting for failed external commands. - Captures and displays error output from the system to aid in debugging. **Example** **Opening a custom URL scheme (e.g., Spotify):** ```bash start spotify:track:4PTG3Z6ehGkBFwjybzWkR8?si=f9b4cdfc1aa14831 ``` Opens the specified track in the Spotify application. **User-Facing Changes** - **New Feature:** The start command now supports opening URLs with custom schemes |
||
|
cdbb3ee7b9
|
add version check command (#14880)
# Description This PR supersedes https://github.com/nushell/nushell/pull/14813 by making it a built-in command instead of checking for the latest version at some interval when nushell starts. This is what it looks like.  This example shows the output when the running version was 0.101.1-nightly.10  Description from old PR. One key functionality that I thought was interesting with this and that I worked with @hustcer on was to try and make sure it works with nightlies. So, it should tell you when there's a new nightly version that is available to download. This way, you can know about it without checking. What's key from a nightly perspective is (1) the tags are now semver compliant and (2) hustcer now updates the Cargo.toml package.version version number prior to compilation so you can know you're running a nightly version, and this PR uses that information to know whether to check the nightly repo or the nushell repo for updates. This uses the [update-informer](https://docs.rs/update-informer/latest/update_informer/) crate. NOTE that this _informs_ you of updates but does not automatically update. I kind of see this as the first step to eventually having an auto updater. There was caching of the version in the old PR since it ran on every nushell startup. Since this PR makes it a command and therefore always runs on-demand, I've removed the caching so that it always checks when you run it. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
f0f6b3a3e5
|
feat(lsp): document highlight (#14898)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This is a minor feature that highlights all occurrences of current variable/command in current file: <img width="346" alt="image" src="https://github.com/user-attachments/assets/f1078e79-d02e-480e-b84a-84efb222c9a4" /> Since this kind of request happens a lot with fixed document content, to avoid unnecessary parsing, this PR caches the `StateDelta` to the server. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Can be disabled on the client side. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Implementation is directly borrowed from `references`, only one simple test case added. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
93e121782c
|
Improve and fix filesize formatting/display (#14397)
# Description This PR cleans up the code surrounding formatting and displaying file sizes. - The `byte_unit` crate we use for file size units displays kilobytes as `KB`, which is not the SI or ISO/IEC standard. Rather it should be `kB`, so this fixes #8872. On some systems, `KB` actually means `KiB`, so this avoids any potential confusion. - The `byte_unit` crate, when displaying file sizes, casts integers to floats which will lose precision for large file sizes. This PR adds a custom `Display` implementation for `Filesize` that can give an exact string representation of a `Filesize` for metric/SI units. - This PR also removes the dependency on the `byte_unit` crate which brought in several other dependencies. Additionally, this PR makes some changes to the config for filesize formatting (`$env.config.filesize`). - The previous filesize config had the `metric` and `format` options. If a metric (SI) unit was set in `format`, but `metric` was set to false, then the `metric` option would take precedence and convert `format` to the corresponding binary unit (or vice versa). E.g., `{ format: kB, metric: false }` => `KiB`. Instead, this PR adds the `unit` option to replace the `format` and `metric` options. `unit` can be set to a fixed file size unit like `kB` or `KiB`, or it can be set to one of the special options: `binary` or `metric`. These options tells nushell to format file sizes using an appropriately scaled metric or binary unit (examples below). ```nushell # precision = null # unit = kB 1kB # 1 kB 1KiB # 1.024 kB # unit = KiB 1kB # 0.9765625 KiB 1KiB # 1 KiB # unit = metric 1000B # 1 kB 1024B # 1.024 kB 10_000MB # 10 GB 10_240MiB # 10.73741824 GB # unit = binary 1000B # 1000 B 1024B # 1 KiB 10_000MB # 9.313225746154785 GiB 10_240MiB # 10 GiB ``` - In addition, this PR also adds the `precision` option to the filesize config. It determines how many digits to show after the decimal point. If set to null, then everything after the decimal point is shown. - The default filesize config is `{ unit: metric, precision: 1 }`. # User-Facing Changes - Commands that use the config to format file sizes will follow the changes described above (e.g., `table`, `into string`, `to text`, etc.). - The file size unit/format passed to `format filesize` is now case sensitive. An error with the valid units is shown if the case does not match. - `$env.config.filesize.format` and `$env.config.filesize.metric` are deprecated and replaced by `$env.config.filesize.unit`. - A new `$env.config.filesize.precision` option was added. # Tests + Formatting Mostly updated test expected outputs. # After Submitting This PR does not change the way NUON serializes file sizes, because that would require changing the nu parser to be able to losslessly decode the new, exact string representation introduced in this PR. Similarly, this PR also does not change the file size parsing in any way. Although the file size units provided to `format filesize` or the filesize config are now case-sensitive, the same is not yet true for file size literals in nushell code. |
||
|
befeddad59
|
Add correct path from data-dir (#14894)
Fix issue in #14879 with incorrect subdirectory. Before: Appended `vendor/autoload` After: Appends `nushell/vendor/autoload` |
||
|
73c08fcb2b
|
fix(parser): missing span of the entire block of a module file (#14889)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> A simple method found by @tmillr to solve [this issue](https://github.com/nushell/nushell/discussions/14854) # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> I didn't find a suitable place in `nu-parser` to add the test case, placed in `nu-lsp` instead. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
9a0ae7c4c0
|
Fix #14842 (#14885)
Sorry was a little bit busy close #14842 I've added a test but I'd check if it solved it. cc: @fdncred __________________________ **Unrelated** Recently got a pretty good format idea (https://github.com/zhiburt/tabled/issues/472) Just wanna highlight that we could probably experiment with it, if it being a bit elaborated. It's sort of KV table which nushell already has, But it's more for a default table where each row/record being rendered as a KV table. It's not something super nice I guess but maybe it could get some appliance. So yes pointing it out just in case. Like these. ``` ┌──────────────┬───────────────────────────────────────────────┐ │ Field │ Value │ ├──────────────┼───────────────────────────────────────────────┤ │ Company │ INTEL CORP │ ├──────────────┼───────────────────────────────────────────────┤ │ Street │ 2200 MISSION COLLEGE BLVD, RNB-4-151 │ ├──────────────┼───────────────────────────────────────────────┤ │ City │ SANTA CLARA │ ├──────────────┼───────────────────────────────────────────────┤ │ ZIP code │ 95054 │ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ │ Company │ Apple Inc. │ ├──────────────┼───────────────────────────────────────────────┤ │ Street │ ONE APPLE PARK WAY │ ├──────────────┼───────────────────────────────────────────────┤ │ City │ CUPERTINO │ ├──────────────┼───────────────────────────────────────────────┤ │ ZIP code │ 95014 │ └──────────────┴───────────────────────────────────────────────┘ ┌──────────────────────────────────────────────────────────────┐ │ INTEL CORP │ ├──────────────┬───────────────────────────────────────────────┤ │ Street │ 2200 MISSION COLLEGE BLVD, RNB-4-151 │ ├──────────────┼───────────────────────────────────────────────┤ │ City │ SANTA CLARA │ ├──────────────┼───────────────────────────────────────────────┤ │ ZIP code │ 95054 │ ├──────────────┴───────────────────────────────────────────────┤ │ Apple Inc. │ ├──────────────┬───────────────────────────────────────────────┤ │ Street │ ONE APPLE PARK WAY │ ├──────────────┼───────────────────────────────────────────────┤ │ City │ CUPERTINO │ ├──────────────┼───────────────────────────────────────────────┤ │ ZIP code │ 95014 │ └──────────────┴───────────────────────────────────────────────┘ ``` PS: Now thinking about it, it's sort of like doing a iteration over rows and building a current KV table, Which is interesting cause we could do it row by row, in which case doing CTRLC would not ruin build but got some data rendered. All though it's a different kind of approach. Just saying. |
||
|
28ca0e7116
|
Bump similar from 2.6.0 to 2.7.0 (#14888)
Bumps [similar](https://github.com/mitsuhiko/similar) from 2.6.0 to 2.7.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md">similar's changelog</a>.</em></p> <blockquote> <h2>2.7.0</h2> <ul> <li>Add optional support for <code>web-time</code> to support web WASM targets. <a href="https://redirect.github.com/mitsuhiko/similar/issues/73">#73</a></li> <li>Crate will no longer panic wheh deadlines are used in WASM. At worst deadlines are silently ignored. To enforce deadlines enable the <code>wasm32_web_time</code> feature. <a href="https://redirect.github.com/mitsuhiko/similar/issues/74">#74</a></li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|
84c720daf5
|
fix(lsp): renaming of flag variables (#14890)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR fixes a bug: renaming on a flag variable removes the leading `--` in the signature. <img width="257" alt="image" src="https://github.com/user-attachments/assets/767c62de-f3a0-4a07-9786-61b21e8cfcb6" /> Gets the following before this PR: ```nushell export def foooo [ p: int ] { $p } ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
cdb082e92d
|
Improve example for epoch -> datetime (#14886)
Better example for `into datetime` with Unix epoch |
||
|
0666b3784f
|
Use $nu.data-dir as last directory for vendor autoloads on all platforms (#14879)
# Description Should fix #14872. ## Before The vendor autoload code in #13382 used `dirs::data_dir()` (from the `dirs` crate), leading to a different behavior when `XDG_DATA_HOME` is set on each platform. * On Linux, the `dirs` crate automatically uses `XDG_DATA_HOME` for `dirs::data_dir()`, so everything worked as expected. * On macOS, `dirs` doesn't use the XDG spec, but the vendor autoload code from #13382 specifically added `XDG_DATA_HOME`. However, even if `XDG_DATA_HOME` was set, vendor autoloads would still use the `dirs` version *as well*. * On Windows, `XDG_DATA_HOME` was ignored completely by vendor autoloads, even though `$nu.data-dirs` was respecting it. ## After This PR uses `nu::data_dirs()` on all platforms. `nu::data_dirs()` respects `XDG_DATA_HOME` (if set) on all platforms. # User-Facing Changes Might be a breaking change if someone was depending on the old behavior, but the doc already specified the behavior in this PR. |
||
|
379d89369c
|
into cell-path : noop when input is cell-path (#14881)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> https://github.com/nushell/nushell/pull/14845#issuecomment-2596371878 When the input to `into cell-path` is a cell-path, it will return it like other into commands. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Before, using `into cell-path` with a cell-path as input would return an error, now it will return the input. <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
2bd345c367
|
into glob : noop when input is glob (#14882)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> https://github.com/nushell/nushell/pull/14845#issuecomment-2596371878 When the input to `into glob` is a glob, it will return it like other into commands. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Before, using `into glob` with a glob as input would return an error, now it will return the input. <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
0e418688d4
|
Rename fmt to format number (#14875)
# Description This PR renames `fmt` to `format number`, to bring it in line with similar value formatting commands and make it more discoverable. # User-Facing Changes * The `fmt` command is now `format number`. A deprecation warning will be thrown if you use `fmt`. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
||
|
b97d89adb6
|
Fix retrieval of config directory for user autoloads (#14877)
# Description Fixes an issue with #14669 - I mistakenly used `dirs::config_dir()` when it should be `nu_path::config_dir()`. This allows `XDG_CONFIG_DIR` to specify the location properly. # User-Facing Changes Fix: If `XDG_CONFIG_DIR` is set, it will be used for the `autoload` location. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
||
|
ee84435a0e
|
fix(lsp): missing references in use command (#14861)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR fixes the issue of the missing references in `use` command <img width="832" alt="image" src="https://github.com/user-attachments/assets/f67cd4b3-2e50-4dda-b2ed-c41aee86d3e9" /> However, as described in [this discussion](https://github.com/nushell/nushell/discussions/14854), the returned reference list is still not complete due to the inconsistent IDs. As a side effect, `hover/goto def` now also works on the `use` command arguments <img width="752" alt="image" src="https://github.com/user-attachments/assets/e0abdc9e-097a-44c2-9084-8d7905ae1d5e" /> Actions including `goto def/hover/references/rename` now work with module (maybe some edge cases of `overlay` are not covered) <img width="571" alt="image" src="https://github.com/user-attachments/assets/b4edb9b7-1540-4c52-bf8b-145bc6a1ad4a" /> # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Added 1. the test for heavy requests cancellation. 2. expected Edit for the missing ref of `use` to the existing rename test. 3. `goto/hover` on module name # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
3f5ebd75b6
|
feat(lsp): cancellable heavy requests (#14851)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> `tower-lsp` seems not well-maintained, I ended up with a dedicated thread for heavy computing and message passing to cancel it on any new request. During the progress, interrupting with edits or new requests. <img width="522" alt="image" src="https://github.com/user-attachments/assets/b263d73d-8ea3-4b26-a7b7-e0b30462d1af" /> Goto references are still blocking, with a hard timeout of 5 seconds. Only locations found within the time limit are returned. Technically, reference requests allow for responses with partial results, which means instant responsiveness. However, the `lsp_types` crate hasn’t enabled this. I believe I can still enable it with some JSON manipulation, but I’ll leave it for future work. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Need some clever way to test the cancellation, no test cases added yet. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
75105033b2
|
Use nucleo instead of skim for completions (#14846)
# Description This PR replaces `SkimMatcherV2` from the [fuzzy-matcher](https://docs.rs/fuzzy-matcher/latest/fuzzy_matcher/) crate with the [nucleo-matcher](https://docs.rs/nucleo-matcher/latest/nucleo_matcher/) crate for doing fuzzy matching. This touches both our completion code in `nu-cli` and symbol filtering in `nu-lsp`. Nucleo should give us better performance than Skim. In the event that we decide to use the Nucleo frontend ([crate docs](https://docs.rs/nucleo/latest/nucleo/)) too, it also works on Windows, unlike [Skim](https://github.com/skim-rs/skim), which appears to only support Linux and MacOS. Unfortunately, we still have an indirect dependency on `fuzzy-matcher`, because the [`dialoguer`](https://github.com/console-rs/dialoguer) crate uses it. # User-Facing Changes No breaking changes. Suggestions will be sorted differently, because Nucleo uses a different algorithm from Skim for matching/scoring. Hopefully, the new sorting will generally make more sense. # Tests + Formatting In `nu-cli`, modified an existing test, but didn't test performance. I haven't tested `nu-lsp` manually, but existing tests pass. I did manually do `ls /nix/store/<TAB>`, `ls /nix/store/d<TAB>`, etc., but didn't notice Nucleo being faster (my `/nix/store` folder has 34136 items at the time of writing). |
||
|
8759936636
|
Fix variable names that end in a duration suffix can't be on the right part of a range (#14848)
# Description Fixes: #14844 The issue occurs when nushell is parsing a value with `SyntaxShape::Any`, it checks `Duration` and `Filesize` first, then `Range`. Nushell raises errors too early while parsing `Duration/Filesize`. This pr changes the order of parsing to fix the issue. # User-Facing Changes The following code should be able to run after this pr ```nushell let runs = 10; 1..$runs ``` # Tests + Formatting Added 2 tests, one for filesize, one for duration. # After Submitting NaN |
||
|
4dcaf2a201
|
Rename/deprecate range to slice (#14825)
# Description As the `range` command has an ambiguous name (does it construct a range type?, does it iterate a range like `seq`) replace it with a more descriptive verb of what it does: `slice` Closes #14130 # User-Facing Changes `range` is now deprecated and replaced in whole by `slice` with the same behavior. `range` will be removed in `0.103.0` # Tests + Formatting Tests have been updated to use `slice` # After submitting - [ ] prepare PR for `nu_scripts` (several usages of `range` to be fixed) - [ ] update documentation usages of `range` after release |
||
|
089c5221cc
|
Add new operators has and not-has (#14841)
# Description This PR add 2 new operators, `has` and `not-has`. They are basically `in` and `not-in` with the order of operands swapped. Motivation for this was the awkward way of searching for rows that contain an item using `where` ```nushell [[name, children]; [foo, [a, b, c]], [bar [d, e, f]]] | where ("e" in $it.children) ``` vs ```nushell [[name, children]; [foo, [a, b, c]], [bar [d, e, f]]] | where children has "e" ``` # User-Facing Changes Added `has` and `not-has` operators, mirroring `in` and `not-in`. # Tests + Formatting - 🟢 toolkit fmt - 🟢 toolkit clippy - 🟢 toolkit test - 🟢 toolkit test stdlib # After Submitting |
||
|
0587308684
|
into datetime : noop when input is a datetime (#14845)
# Description - Closes #14839 When the input to `into datetime` is a datetime, it will return it like other `into` commands. # User-Facing Changes Before, using `into datetime` with a datetime as input would return an error, now it will return the input. # Tests + Formatting Added test `takes_datetime`. # After Submitting Doc file is automatically generated. |
||
|
6eff420e17
|
fix error propagation in export-env (#14847)
- fixes #14801 # Description - Fixed the issue - Added some comments mirroring the ones used in `export-env` handling in `use` - Added two tests to prevent regressions # User-Facing Changes # Tests + Formatting - 🟢 toolkit fmt - 🟢 toolkit clippy - 🟢 toolkit test - 🟢 toolkit test stdlib # After Submitting |
||
|
d66f8cca40
|
feat(lsp): workspace wide operations: rename/goto references (#14837)
# Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> <!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> goto reference: <img width="885" alt="image" src="https://github.com/user-attachments/assets/6f85cd10-0c2d-46b2-b99e-47a9bbf90822" /> rename: <img width="483" alt="image" src="https://github.com/user-attachments/assets/828e7586-c2b7-414d-9085-5188b10f5f5f" /> Caveats: 1. Module reference/rename is not supported yet 2. names in `use` command should also be renamed, which is not handled now 3. workspace wide actions can be time-consuming, as it requires parsing of all `**/*.nu` files in the workspace (if its text contains the name). Added a progress bar for such requests. 4. In case these requests are triggered accidentally in a root folder with a large depth, I hard-coded the max depth to search to 5 right now. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Limited test cases # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
06938659d2
|
Remove required positional arguments from run-external and exec (#14765)
# Description This PR removes the required positional argument from `run-external` and `exec` in favor of the rest arguments, meaning lists of external commands can be spread directly into `run-external` and `exec`. This does have the drawback of making calling `run-external` and `exec` with no arguments a run-time error rather than a parse error, but I don't imagine that is an issue. Before (for both `run-external` and `exec`): ```nushell run-external # => Error: nu::parser::missing_positional # => # => × Missing required positional argument. # => ╭─[entry #9:1:13] # => 1 │ run-external # => ╰──── # => help: Usage: run-external <command> ...(args) . Use `--help` for more # => information. let command = ["cat" "hello.txt"] run-external ...$command # => Error: nu::parser::missing_positional # => # => × Missing required positional argument. # => ╭─[entry #11:1:14] # => 1 │ run-external ...$command # => · ▲ # => · ╰── missing command # => ╰──── # => help: Usage: run-external <command> ...(args) . Use `--help` for more # => information. run-external ($command | first) ...($command | skip 1) # => hello world! ``` After (for both `run-external` and `exec`): ```nushell run-external # => Error: nu:🐚:missing_parameter # => # => × Missing parameter: no command given. # => ╭─[entry #2:1:1] # => 1 │ run-external # => · ──────┬───── # => · ╰── missing parameter: no command given # => ╰──── # => let command = ["cat" "hello.txt"] run-external ...$command # => hello world! ``` # User-Facing Changes Lists can now be spread directly into `run-external` and `exec`: ```nushell let command = [cat hello.txt] run-external ...$command # => hello world! ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
||
|
46566296c0
|
Use non-canonicalized paths in shell integrations (#14832)
This simply replaces uses of the deprecated function `current_dir_str` with `EngineState::cwd_as_string` in `run_shell_integration_*` functions. The main difference being that the latter does not canonicalize paths. Fixes #14619 |
||
|
b99a8c9d80
|
Bump tokio from 1.42.0 to 1.43.0 (#14829)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.42.0 to 1.43.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/tokio-rs/tokio/releases">tokio's releases</a>.</em></p> <blockquote> <h2>Tokio v1.43.0</h2> <h1>1.43.0 (Jan 8th, 2025)</h1> <h3>Added</h3> <ul> <li>net: add <code>UdpSocket::peek</code> methods (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7068">#7068</a>)</li> <li>net: add support for Haiku OS (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7042">#7042</a>)</li> <li>process: add <code>Command::into_std()</code> (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7014">#7014</a>)</li> <li>signal: add <code>SignalKind::info</code> on illumos (<a href="https://redirect.github.com/tokio-rs/tokio/issues/6995">#6995</a>)</li> <li>signal: add support for realtime signals on illumos (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7029">#7029</a>)</li> </ul> <h3>Fixed</h3> <ul> <li>io: don't call <code>set_len</code> before initializing vector in <code>Blocking</code> (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7054">#7054</a>)</li> <li>macros: suppress <code>clippy::needless_return</code> in <code>#[tokio::main]</code> (<a href="https://redirect.github.com/tokio-rs/tokio/issues/6874">#6874</a>)</li> <li>runtime: fix thread parking on WebAssembly (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7041">#7041</a>)</li> </ul> <h3>Changes</h3> <ul> <li>chore: use unsync loads for <code>unsync_load</code> (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7073">#7073</a>)</li> <li>io: use <code>Buf::put_bytes</code> in <code>Repeat</code> read impl (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7055">#7055</a>)</li> <li>task: drop the join waker of a task eagerly (<a href="https://redirect.github.com/tokio-rs/tokio/issues/6986">#6986</a>)</li> </ul> <h3>Changes to unstable APIs</h3> <ul> <li>metrics: improve flexibility of H2Histogram Configuration (<a href="https://redirect.github.com/tokio-rs/tokio/issues/6963">#6963</a>)</li> <li>taskdump: add accessor methods for backtrace (<a href="https://redirect.github.com/tokio-rs/tokio/issues/6975">#6975</a>)</li> </ul> <h3>Documented</h3> <ul> <li>io: clarify <code>ReadBuf::uninit</code> allows initialized buffers as well (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7053">#7053</a>)</li> <li>net: fix ambiguity in <code>TcpStream::try_write_vectored</code> docs (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7067">#7067</a>)</li> <li>runtime: fix <code>LocalRuntime</code> doc links (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7074">#7074</a>)</li> <li>sync: extend documentation for <code>watch::Receiver::wait_for</code> (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7038">#7038</a>)</li> <li>sync: fix typos in <code>OnceCell</code> docs (<a href="https://redirect.github.com/tokio-rs/tokio/issues/7047">#7047</a>)</li> </ul> <p><a href="https://redirect.github.com/tokio-rs/tokio/issues/6874">#6874</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/6874">tokio-rs/tokio#6874</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/6963">#6963</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/6963">tokio-rs/tokio#6963</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/6975">#6975</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/6975">tokio-rs/tokio#6975</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/6986">#6986</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/6986">tokio-rs/tokio#6986</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/6995">#6995</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/6995">tokio-rs/tokio#6995</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7014">#7014</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7014">tokio-rs/tokio#7014</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7029">#7029</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7029">tokio-rs/tokio#7029</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7038">#7038</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7038">tokio-rs/tokio#7038</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7041">#7041</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7041">tokio-rs/tokio#7041</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7042">#7042</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7042">tokio-rs/tokio#7042</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7047">#7047</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7047">tokio-rs/tokio#7047</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7053">#7053</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7053">tokio-rs/tokio#7053</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7054">#7054</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7054">tokio-rs/tokio#7054</a> <a href="https://redirect.github.com/tokio-rs/tokio/issues/7055">#7055</a>: <a href="https://redirect.github.com/tokio-rs/tokio/pull/7055">tokio-rs/tokio#7055</a></p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|
b34547334a
|
Bump data-encoding from 2.6.0 to 2.7.0 (#14831)
Bumps [data-encoding](https://github.com/ia0/data-encoding) from 2.6.0 to 2.7.0. <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/ia0/data-encoding/commits">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
d9bfcb4c09
|
Bump uuid from 1.11.0 to 1.12.0 (#14830)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.11.0 to 1.12.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/uuid-rs/uuid/releases">uuid's releases</a>.</em></p> <blockquote> <h2>1.12.0</h2> <h2>What's Changed</h2> <ul> <li>feat: Add <code>NonZeroUuid</code> type for optimized <code>Option<Uuid></code> representation by <a href="https://github.com/ab22593k"><code>@ab22593k</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/779">uuid-rs/uuid#779</a></li> <li>Finalize <code>NonNilUuid</code> by <a href="https://github.com/KodrAus"><code>@KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/783">uuid-rs/uuid#783</a></li> <li>Prepare for 1.12.0 release by <a href="https://github.com/KodrAus"><code>@KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/784">uuid-rs/uuid#784</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/ab22593k"><code>@ab22593k</code></a> made their first contribution in <a href="https://redirect.github.com/uuid-rs/uuid/pull/779">uuid-rs/uuid#779</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/uuid-rs/uuid/compare/1.11.1...1.12.0">https://github.com/uuid-rs/uuid/compare/1.11.1...1.12.0</a></p> <h2>1.11.1</h2> <h2>What's Changed</h2> <ul> <li>Finish cut off docs by <a href="https://github.com/KodrAus"><code>@KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/777">uuid-rs/uuid#777</a></li> <li>Fix links in CONTRIBUTING.md by <a href="https://github.com/jacobggman"><code>@jacobggman</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/778">uuid-rs/uuid#778</a></li> <li>Update rust toolchain before building by <a href="https://github.com/KodrAus"><code>@KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/781">uuid-rs/uuid#781</a></li> <li>Prepare for 1.11.1 release by <a href="https://github.com/KodrAus"><code>@KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/782">uuid-rs/uuid#782</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/jacobggman"><code>@jacobggman</code></a> made their first contribution in <a href="https://redirect.github.com/uuid-rs/uuid/pull/778">uuid-rs/uuid#778</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/uuid-rs/uuid/compare/1.11.0...1.11.1">https://github.com/uuid-rs/uuid/compare/1.11.0...1.11.1</a></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|
8ce14a7c86
|
replace icons in grid with devicons + color (#14827)
# Description This PR replaces the home-grown icons in the `grid` command with the `devicons` crate. ### Before  ### After  # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
301d1370c4
|
Add input support to generate (#14804)
- closes #8523 # Description This PR adds pipeline input support to `generate`. - Without input, `generate` keeps its current behavior. - With input, each invocation of the closure is provided an item from the input stream as pipeline input (`$in`). If/when the input stream runs out, `generate` also stops. Before this PR, there is no filter command that is both stateful _and_ streaming. This PR also refactors `std/iter scan` to use `generate`, making it streaming and more performant over larger inputs. # User-Facing Changes - `generate` now supports pipeline input, passing each element to the closure as `$in` until it runs out - `std/iter scan` is now streaming # Tests + Formatting Added tests to validate the new feature. - 🟢 toolkit fmt - 🟢 toolkit clippy - 🟢 toolkit test - 🟢 toolkit test stdlib # After Submitting N/A |
||
|
306e305b65
|
Add help pipe-and-redirect command. (#14821)
# Description This pr is going to add a new command named `help pipe-and-redirect`. So user can detect such feature easier. # User-Facing Changes Here is the output of this command: ``` ╭───┬────────┬──────────────────────────────────────┬──────────────────────────────────────────────────────────────┬─────────────────────╮ │ # │ symbol │ name │ description │ example │ ├───┼────────┼──────────────────────────────────────┼──────────────────────────────────────────────────────────────┼─────────────────────┤ │ 0 │ | │ pipe │ pipeline stdout of a command to another command │ ^cmd1 | ^cmd2 │ │ 1 │ e>| │ stderr pipe │ pipeline stderr of a command to another command │ ^cmd1 e>| ^cmd2 │ │ 2 │ o+e>| │ stdout and stderr pipe │ pipeline stdout and stderr of a command to another command │ ^cmd1 o+e>| ^cmd2 │ │ 3 │ o> │ redirection │ redirect stdout of a command, overwriting a file │ ^cmd1 o> file.txt │ │ 4 │ e> │ stderr redirection │ redirect stderr of a command, overwriting a file │ ^cmd1 e> file.txt │ │ 5 │ o+e> │ stdout and stderr redirection │ redirect stdout and stderr of a command, overwriting a file │ ^cmd1 o+e> file.txt │ │ 6 │ o>> │ redirection append │ redirect stdout of a command, appending to a file │ ^cmd1 o> file.txt │ │ 7 │ e>> │ stderr redirection append │ redirect stderr of a command, appending to a file │ ^cmd1 e> file.txt │ │ 8 │ o+e>> │ stdout and stderr redirection append │ redirect stdout and stderr of a command, appending to a file │ ^cmd1 o+e> file.txt │ │ 9 │ o>| │ │ Unsupported, it's the same to `|`, use it instead │ │ ├───┼────────┼──────────────────────────────────────┼──────────────────────────────────────────────────────────────┼─────────────────────┤ │ # │ symbol │ name │ description │ example │ ╰───┴────────┴──────────────────────────────────────┴──────────────────────────────────────────────────────────────┴─────────────────────╯ ``` # Tests + Formatting # After Submitting Should update more examples in [nushell doc](https://www.nushell.sh/lang-guide/chapters/pipelines.html) to fill more examples |
||
|
e117706518
|
fix(parser): span of $it /$in set to the first character of its scope (#14817)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Follow-up PR of #14789 The span of `$it/$in` is set to a 0-width one with start/end pointing to the start of its scope, mainly for error messages positioning. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
737ea3940e
|
finish removing terminal_size dep (#14819)
# Description This PR is a follow on to https://github.com/nushell/nushell/pull/14423 and finishes removing the `terminal_size` crate in favor of `crossterm`'s `size()`. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
e5337b50a9
|
fix(lsp): goto definition on variables in match guard (#14818)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx
you can also mention related issues, PRs or discussions!
-->
# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.
Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->
This PR fixes a corner case of goto definition in lsp server.
```nushell
let foo = 1
match $foo {
_ if $foo == 1 => 1
# |_______________ goto definition does not work here
_ => 2
}
```
Since `match_pattern.guard` is not handled in this function (which could
be another issue).
|
||
|
23dc1b600a
|
feat(lsp): inlay hints of types in assignments (#14809)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This is a complementary PR of #14802 <img width="418" alt="image" src="https://github.com/user-attachments/assets/ddf945e4-7ef0-4c73-a9fd-e68591efce03" /> # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> new relative test cases # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
f05162811c
|
Implementing ByteStream interuption on infinite stream (#13552)
# Description This PR should address #13530 by explicitly handling ByteStreams. The issue can be replicated easily on linux by running: ```nushell open /dev/urandom | into binary | bytes at ..10 ``` Would leave the output hanging and with no way to cancel it, this was likely because it was trying to collect the input stream and would not complete. I have also put in an error to say that using negative offsets for a bytestream without a length cannot be used. ```nushell ~/git/nushell> open /dev/urandom | into binary | bytes at (-1).. Error: nu:🐚:incorrect_value × Incorrect value. ╭─[entry #3:1:35] 1 │ open /dev/urandom | into binary | bytes at (-1).. · ────┬─── ───┬── · │ ╰── encountered here · ╰── Negative range values cannot be used with streams that don't specify a length ╰──── ``` # User-Facing Changes No operation changes, only the warning you get back for negative offsets # Tests + Formatting Ran `toolkit check pr ` with no errors or warnings Manual testing of the example commands above --------- Co-authored-by: Ian Manske <ian.manske@pm.me> Co-authored-by: Simon Curtis <simon.curtis@candc-uk.com> |
||
|
0b71eb201c
|
fix(lsp): PWD env_var (#14805)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR fixes an issue introduced by #14770 , as shown in https://github.com/nushell/nushell/pull/14802#issuecomment-2585270161 # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
707ab1df6a
|
bump to rust version 1.82 (#14795)
# Description The PR follows our standard of bumping the rust compiler when a new one is released. /cc @ayax79 @sholderbach # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
c811d86dbd
|
feat(lsp): inlay hints of variable types and command params (#14802)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR adds inlay hints of variable types and parameter names to lsp-server <img width="547" alt="image" src="https://github.com/user-attachments/assets/07a0dd84-5ecc-47df-a8a7-732631715662" /> Some design choices I made: * for composite types like `record<foo: <record ...>>`, only a short name displayed. Full signature already available through `hover` * only parameter names of user defined commands are returned, feels too much distraction if enabled for all builtins * some information are lost in flattened expressions, so I implemented my AST traversing functions, which may seem unnecessary, but I can't find alternatives from the existing code. * another minor change: added a line separator to current hover markdown message. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Users who think this feature annoying now have to manually turn it off (or config the lsp client capabilities). # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
827e31191d
|
fix: unknown span for special variables $in/$it (#14789)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR addresses the issue of inconsistent spans of special variables of `$in/$in`, as discussed in https://github.com/nushell/nushell/pull/14770#discussion_r1908729364. Instead of making the `declaration_span` to be Option, which will cause too many changes that we may want to avoid, this PR set the spans to be `unknown`. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> No # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
b9b3101bd9
|
Let table only check for use_ansi_coloring config value (#14798)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR removes the `std::io::stdout().is_terminal()` check in `table` again. To ensure that in the future this doesn't happen again, I added a comment and a test. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Resets the behavior of `table` to #14647 again, after #14415 included it again. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Added a new test to check for these color outputs. - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
8e8a60a432
|
Add "whereis" and "get-command" to which search terms (#14797)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Today i saw in the general discord channel someone ask what is the nushell equivalent of `whereis` or `get-command`. I wanted to tell the user to use our great search via F1 but then I realized that typing in `whereis` or `get-command` wouldn't really find you something. So I added these two search terms. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> None. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> I don't think that really needs testing here :D # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
72d50cf8b7
|
Convert Path to list in main and preserve case (#14764)
# Description Fixes multiple issues related to `ENV_CONVERSION` and path-conversion-to-list. * #14681 removed some calls to `convert_env_values()`, but we found that this caused `nu -n` to no longer convert the path properly. * `ENV_CONVERSIONS` have apparently never preserved case, meaning a conversion with a key of `foo` would not update `$env.FOO` but rather create a new environment variable with a different case. * There was a partial code-path that attempted to solve this for `PATH`, but it only worked for `PATH` and `Path`. * `convert_env_values()`, which handled `ENV_CONVERSIONS` was called in multiple places in the startup depending on flags. This PR: * Refactors the startup to handle the conversion in `main()` rather than in each potential startup path * Updates `get_env_var_insensitive()` functions added in #14390 to return the name of the environment variable with its original case. This allows code that updates environment variables to preserve the case. * Makes use of the updated function in `ENV_CONVERSIONS` to preserve the case of any updated environment variables. The `ENV_CONVERSION` key itself is still case **insensitive**. * Makes use of the updated function to preserve the case of the `PATH` environment variable (normally handled separately, regardless of whether or not there was an `ENV_CONVERSION` for it). ## Before `env_convert_values` was run: * Before the user `env.nu` ran, which included `nu -c <commandstring>` and `nu <script.nu>` * Before the REPL loaded, which included `nu -n` ## After `env_convert_values` always runs once in `main()` before any config file is processed or the REPL is started # User-Facing Changes Bug fixes # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` Added additional tests to prevent future regression. # After Submitting There is additional cleanup that should probably be done in `convert_env_values()`. This function previously handled `ENV_CONVERSIONS`, but there is no longer any need for this since `convert_env_vars()` runs whenever `$env.ENV_CONVERSIONS` changes now. This means that the only relevant task in the old `convert_env_values()` is to convert the `PATH` to a list, and ensure that it is a list of strings. It's still calling the `from_string` conversion on every variable (just once) even though there are no `ENV_CONVERSIONS` at this point. Leaving that to another PR though, while we get the core issue fixed with this one. |
||
|
3a1601de8e
|
Add flag to debug profile to output duration field as Value::Duration (#14749)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR adds a flag to `debug profile` to output the duration field as Value::Duration. Without the flag, the behavior is same as before: a column named `duration_ms` which is `Value::Float`. With the flag, there is instead a column named just `duration` which is `Value::Duration`. Additionally, this PR changes the time tracking to use nanoseconds instead of float seconds, so it can be output as either milliseconds or `Duration` (which uses nanoseconds internally). I don't think overflow is a concern here, because the maximum amount of time a `Duration` can store is over 292 years, and if a Nushell instruction takes longer than that to run then I think we might have bigger issues. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> * Adds a flag `--duration-values` to `debug profile` which the `duration_ms` field in `debug profile` to a `duration` field which uses proper `duration` values. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> N/A |
||
|
3f8dd1b705
|
feat(lsp): document_symbols and workspace_symbols (#14770)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR adds symbols related features to lsp <img width="940" alt="image" src="https://github.com/user-attachments/assets/aeaed338-133c-430a-b966-58a9bc445211" /> Notice that symbols of type variable may got filtered by client side plugins <img width="906" alt="image" src="https://github.com/user-attachments/assets/e031b3dc-443a-486f-8a35-4415c07196d0" /> # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
79f19f2fc7
|
Enable conditional source and use patterns by allowing null as a no-op module (#14773)
Related: - #14329 - #13872 - #8214 # Description & User-Facing Changes This PR allows enables the following uses, which are all no-op. ```nushell source null source-env null use null overlay use null ``` The motivation for this change is conditional sourcing of files. For example, with this change `login.nu` may be deprecated and replaced with the following code in `config.nu` ```nushell const login_module = if $nu.is-login { "login.nu" } else { null } source $login_module ``` # Tests + Formatting I'm hoping for CI to pass 😄 # After Submitting Add a part about the conditional sourcing pattern to the website. |
||
|
5cf6dea997
|
Remove file accidentally re-introduced by merge (#14785)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Re-removes the tests for `split_by`, which was removed in #14726 and accidentally re-introduced by #14741 cc @fdncred # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> N/A # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> N/A # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> N/A |
||
|
214714e0ab
|
Add run-time type checking for command pipeline input (#14741)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR adds type checking of all command input types at run-time. Generally, these errors should be caught by the parser, but sometimes we can't know the type of a value at parse-time. The simplest example is using the `echo` command, which has an output type of `any`, so prefixing a literal with `echo` will bypass parse-time type checking. Before this PR, each command has to individually check its input types. This can result in scenarios where the input/output types don't match the actual command behavior. This can cause valid usage with an non-`any` type to become a parse-time error if a command is missing that type in its pipeline input/output (`drop nth` and `history import` do this before this PR). Alternatively, a command may not list a type in its input/output types, but doesn't actually reject that type in its code, which can have unintended side effects (`get` does this on an empty pipeline input, and `sort` used to before #13154). After this PR, the type of the pipeline input is checked to ensure it matches one of the input types listed in the proceeding command's input/output types. While each of the issues in the "before this PR" section could be addressed with each command individually, this PR solves this issue for _all_ commands. **This will likely cause some breakage**, as some commands have incorrect input/output types, and should be adjusted. Also, some scripts may have erroneous usage of commands. In writing this PR, I discovered that `toolkit.nu` was passing `null` values to `str join`, which doesn't accept nothing types (if folks think it should, we can adjust it in this PR or in a different PR). I found some issues in the standard library and its tests. I also found that carapace's vendor script had an incorrect chaining of `get -i`: ```nushell let expanded_alias = (scope aliases | where name == $spans.0 | get -i 0 | get -i expansion) ``` Before this PR, if the `get -i 0` ever actually did evaluate to `null`, the second `get` invocation would error since `get` doesn't operate on `null` values. After this PR, this is immediately a run-time error, alerting the user to the problematic code. As a side note, we'll need to PR this fix (`get -i 0 | get -i expansion` -> `get -i 0.expansion`) to carapace. A notable exception to the type checking is commands with input type of `nothing -> <type>`. In this case, any input type is allowed. This allows piping values into the command without an error being thrown. For example, `123 | echo $in` would be an error without this exception. Additionally, custom types bypass type checking (I believe this also happens during parsing, but not certain) I added a `is_subtype` method to `Value` and `PipelineData`. It functions slightly differently than `get_type().is_subtype()`, as noted in the doccomments. Notably, it respects structural typing of lists and tables. For example, the type of a value `[{a: 123} {a: 456, b: 789}]` is a subtype of `table<a: int>`, whereas the type returned by `Value::get_type` is a `list<any>`. Similarly, `PipelineData` has some special handling for `ListStream`s and `ByteStream`s. The latter was needed for this PR to work properly with external commands. Here's some examples. Before: ```nu 1..2 | drop nth 1 Error: nu::parser::input_type_mismatch × Command does not support range input. ╭─[entry #9:1:8] 1 │ 1..2 | drop nth 1 · ────┬─── · ╰── command doesn't support range input ╰──── echo 1..2 | drop nth 1 # => ╭───┬───╮ # => │ 0 │ 1 │ # => ╰───┴───╯ ``` After this PR, I've adjusted `drop nth`'s input/output types to accept range input. Before this PR, zip accepted any value despite not being listed in its input/output types. This caused different behavior depending on if you triggered a parse error or not: ```nushell 1 | zip [2] # => Error: nu::parser::input_type_mismatch # => # => × Command does not support int input. # => ╭─[entry #3:1:5] # => 1 │ 1 | zip [2] # => · ─┬─ # => · ╰── command doesn't support int input # => ╰──── echo 1 | zip [2] # => ╭───┬───────────╮ # => │ 0 │ ╭───┬───╮ │ # => │ │ │ 0 │ 1 │ │ # => │ │ │ 1 │ 2 │ │ # => │ │ ╰───┴───╯ │ # => ╰───┴───────────╯ ``` After this PR, it works the same in both cases. For cases like this, if we do decide we want `zip` or other commands to accept any input value, then we should explicitly add that to the input types. ```nushell 1 | zip [2] # => Error: nu::parser::input_type_mismatch # => # => × Command does not support int input. # => ╭─[entry #3:1:5] # => 1 │ 1 | zip [2] # => · ─┬─ # => · ╰── command doesn't support int input # => ╰──── echo 1 | zip [2] # => Error: nu:🐚:only_supports_this_input_type # => # => × Input type not supported. # => ╭─[entry #14:2:6] # => 2 │ echo 1 | zip [2] # => · ┬ ─┬─ # => · │ ╰── only list<any> and range input data is supported # => · ╰── input type: int # => ╰──── ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> **Breaking change**: The type of a command's input is now checked against the input/output types of that command at run-time. While these errors should mostly be caught at parse-time, in cases where they can't be detected at parse-time they will be caught at run-time instead. This applies to both internal commands and custom commands. Example function and corresponding parse-time error (same before and after PR): ```nushell def foo []: int -> nothing { print $"my cool int is ($in)" } 1 | foo # => my cool int is 1 "evil string" | foo # => Error: nu::parser::input_type_mismatch # => # => × Command does not support string input. # => ╭─[entry #16:1:17] # => 1 │ "evil string" | foo # => · ─┬─ # => · ╰── command doesn't support string input # => ╰──── # => ``` Before: ```nu echo "evil string" | foo # => my cool int is evil string ``` After: ```nu echo "evil string" | foo # => Error: nu:🐚:only_supports_this_input_type # => # => × Input type not supported. # => ╭─[entry #17:1:6] # => 1 │ echo "evil string" | foo # => · ──────┬────── ─┬─ # => · │ ╰── only int input data is supported # => · ╰── input type: string # => ╰──── ``` Known affected internal commands which erroneously accepted any type: * `str join` * `zip` * `reduce` # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> * Play whack-a-mole with the commands and scripts this will inevitably break |
||
|
d894c8befe
|
Bump typos workflow to 1.29.4 (#14782)
Fix garbage name to snakecase Supersedes #14779 |
||
|
cc4d4acc6b
|
Bump git2 from 0.19.0 to 0.20.0 (#14776) | ||
|
dc52a6fec5
|
Handle permission denied error at nu_engine::glob_from (#14679)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> #14528 mentioned that trying to `open` a file in a directory where you don't have read access results in a "file not found" error. I investigated the error and could find the root issue in the `nu_engine::glob_from` function. It uses `std::path::Path::canonicalize` some layers down and that may return an `std::io::Error`. All these errors were handled as "directory not found" which will be translated to "file not found" in the `open` command. To fix this, I handled the `PermssionDenied` error kind of the io error and passed that down. Now trying to `open` a file from a directory with no permissions returns a "permission denied" error. Before/After:  # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> That error is fixed, so correct error message. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> fixes #14528 |
||
|
16e174be7e
|
fix nuon conversions of range values (#14687)
# Description Currently the step size of range values are discarded when converting to nuon. This PR fixes that and makes `to nuon | from nuon` round trips work. # User-Facing Changes `to nuon` conversion of `range` values now include the step size # Tests + Formatting Added some additional tests to cover inclusive/exclusive integer/float and step size cases. |
||
|
8e41a308cd
|
fix(explore): handle zero-size cursor in binary viewer (#14592)
# Description Fix cursor panic when handling size zero in binary viewer. Previously, the cursor would panic with arithmetic overflow when handling size 0. This PR fixes this by using `saturating_sub` to safely handle the edge case of size 0. Fixes #14589 # User-Facing Changes - Fixed panic when viewing very small binary inputs in the explore command (when using `0x[f] | explore`) # Tests + Formatting Added tests to verify: - Cursor handling of size 0 - Safe movement operations with size 0 - Edge case handling with size 1 ✅ Verified all checks pass: - `cargo fmt --all -- --check` - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` - `cargo test --package nu-explore --lib cursor` |
||
|
787f292ca7
|
Custom completions: Inherit case_sensitive option from $env.config (#14738)
# Description Currently, if a custom completer returns a record containing an `options` field, but these options don't specify `case_sensitive`, `case_sensitive` will be true. This PR instead makes the default value whatever the user specified in `$env.config.completions.case_sensitive`. The match algorithm option already does this. `positional` is also inherited from the global config, although user's can't actually specify that one themselves in `$env.config` (I'm planning on getting rid of `positional` in a separate PR). # User-Facing Changes For those making custom completions, if they need matching to be done case-sensitively and: - their completer returns a record rather than a list, - and the record contains an `options` field, - and the `options` field is a record, - and the record doesn't contain a `case_sensitive` option, then they will need to specify `case_sensitive: true` in their custom completer's options. Otherwise, if the user sets `$env.config.completions.case_sensitive = false`, their custom completer will also use case-insensitive matching. Others shouldn't have to make any changes. # Tests + Formatting Updated tests to check if `case_sensitive`. Basically rewrote them, actually. I figured it'd be better to make a single helper function that takes completer options and completion suggestions and generates a completer from that rather than having multiple fixtures providing different completers. # After Submitting Probably needs to be noted in the release notes, but I don't think the [docs](https://www.nushell.sh/book/custom_completions.html#options-for-custom-completions) need to be updated. |
||
|
dad956b2ee
|
more closure serialization (#14698)
# Description This PR introduces a switch `--serialize` that allows serializing of types that cannot be deserialized. Right now it only serializes closures as strings in `to toml`, `to json`, `to nuon`, `to text`, some indirect `to html` and `to yaml`. A lot of the changes are just weaving the engine_state through calling functions and the rest is just repetitive way of getting the closure block span and grabbing the span's text. In places where it has to report `<Closure 123>` I changed it to `closure_123`. It always seemed like the `<>` were not very nushell-y. This is still a breaking change. I think this could also help with systematic translation of old config to new config file. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
1f477c8eb1
|
fix stor reset when there are foreign keys (#14772)
# Description This PR fixes a problem with `stor reset`. That problem was that it called drop_all_tables which just iterated through the tables and dropped them one by one. This works as long as there are no foreign keys or if the tables are dropped in the "right" order. It doesn't work in most cases since you have to know what order to drop tables in. So, this PR turns off foreign key constraints, then drops all the tables, then turns the foreign key constraints back on, which seems to work well... so far. :) # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
6260fa9f07
|
expand custom values on table display (#14760)
# Description Presently, when custom values are displayed in a table, the entire object is stringified. e.g., a custom value that encodes a DNS message gets displayed as: ``` ❯ : dns query --timeout 30sec dead10ck.dev ╭───┬─────────────────────────────────────────────────────────────────────╮ │ 0 │ {header: {id: 58404, message_type: RESPONSE, op_code: QUERY, │ │ │ authoritative: false, truncated: false, recursion_desired: true, │ │ │ recursion_available: true, authentic_data: true, response_code: No │ │ │ Error, query_count: 1, answer_count: 2, name_server_count: 0, │ │ │ additional_count: 1}, question: {name: dead10ck.dev., type: AAAA, │ │ │ class: IN}, answer: [{name: dead10ck.dev., type: AAAA, class: IN, │ │ │ ttl: 1hr, rdata: 2600:1f18:6af3:9f05:f526:3a1a:611:6b22, proof: │ │ │ indeterminate}, {name: dead10ck.dev., type: RRSIG, class: IN, ttl: │ │ │ 1hr, rdata: AAAA ECDSAP256SHA256 2 3600 1736139412 1736128612 54894 │ │ │ dead10ck.dev. HIkACE70hxznmFTJhOZSmm42KpLC6a+qHchszMyhYjqtG6eP6bzc │ │ │ +XYYjC+UKMaf56SlwBwnpF1tetmrDwyUHw==, proof: indeterminate}], │ │ │ authority: [], additional: [], edns: {rcode_high: 0, version: 0, │ │ │ flags: {dnssec_ok: true}, max_payload: 1.2 KiB, opts: {}}, size: │ │ │ 177 B} │ ``` With this change, expansion to a native nushell value happens earlier so that they get displayed as any other value does. ``` ❯ : ./target/debug/nu -c 'dns query --timeout 30sec dead10ck.dev | table -- expand' ╭───┬────────────────────────────────────┬──────────────────────────┬─────╮ │ # │ header │ question │ ... │ ├───┼────────────────────────────────────┼──────────────────────────┼─────┤ │ 0 │ ╭─────────────────────┬──────────╮ │ ╭───────┬──────────────╮ │ ... │ │ │ │ id │ 37707 │ │ │ name │ dead10ck.dev │ │ │ │ │ │ message_type │ RESPONSE │ │ │ │ . │ │ │ │ │ │ op_code │ QUERY │ │ │ type │ AAAA │ │ │ │ │ │ authoritative │ false │ │ │ class │ IN │ │ │ │ │ │ truncated │ false │ │ ╰───────┴──────────────╯ │ │ │ │ │ recursion_desired │ true │ │ │ │ │ │ │ recursion_available │ true │ │ │ │ │ │ │ authentic_data │ true │ │ │ │ │ │ │ response_code │ No Error │ │ │ │ │ │ │ query_count │ 1 │ │ │ │ │ │ │ answer_count │ 2 │ │ │ │ │ │ │ name_server_count │ 0 │ │ │ │ │ │ │ additional_count │ 1 │ │ │ │ │ │ ╰─────────────────────┴──────────╯ │ │ │ ``` # User-Facing Changes Custom values are displayed as their native Nushell value. # Tests + Formatting Manual |
||
|
88f44701a9
|
Add doccomments to find functions in EngineState and StateWorkingSet (#14750)
# Description Adds some doccomments to some of the methods in `engine_state.rs` and `state_working_set.rs`. Also grouped together some of the `find` methods in `engine_state.rs`, but didn't do so in `state_working_set.rs` since they seem to already be grouped according to decl/overlay/module. Follow-up to #14490. # User-Facing Changes None # Tests + Formatting N/A # After Submitting N/A |
||
|
9ed944312f
|
auto cd should not canonicalize symbolic path (#14708)
# Description Fixes: #13158 To fix the issue for auto-cd feature, just need to use `EngineState::cwd` instead of `nu_engine::env::current_dir_str` # User-Facing Changes ## Before ```shell > cd ~ > ln -s /tmp test_link; cd test_link > .. > $env.PWD / ``` ## After ```shell > cd ~ > ln -s /tmp test_link; cd test_link > .. > $env.PWD # it should output home directory. ``` # Tests + Formatting Update a test under `auto_cd_symlink` |
||
|
6eb14522b6
|
Remove deprecated commands (#14726)
# Description Remove commands which were deprecated in 0.101: * `split-by` (#14019) * `date to-record` and `date to-table` (#14319) # User-Facing Changes - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting TODO: `grep` (`ag`) doc repo for any usage of these commands |
||
|
ac12b02437
|
fix wrong error msg of save command on windows (#14699)
fixes #14664 # Description Now, ```nu "aaa" | save -f .. ``` returns correct error message on windows. Note that the fix introduces a TOCTOU problem, which only effects the error message. It won't break any workload. # User-Facing Changes The fix won't break any workload. # Tests + Formatting I have run tests **only on windows**. # After Submitting The fix doesn't need to change documentation. |
||
|
9ed2ca792f
|
Fix extra newline on empty lists when $env.config.table.show_empty is… (#14766)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> I just noticed that #14758 adds an extra newline when `$env.config.table.show_empty = false`. This PR makes sure the placeholder text is non-empty before adding the newline. Before #14758: ```nushell $env.config.table.show_empty = false print ([]) text # => text echo [] ``` Before PR: ```nushell $env.config.table.show_empty = false print ([]) text # => # => text echo [] # => ``` After PR: ```nushell $env.config.table.show_empty = false print ([]) text # => text echo [] ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> None, fix to #14758 which has not been included in a release # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> N/A |
||
|
ebabca575c
|
small, backwards compatible enhancements to std (#14763)
# Description Small, backwards compatible enhancements to the standard library. # User-Facing Changes - changed `iter find`, `iter find-index`: Only consume the input stream up to the first match. - added `log set-level`: a small convenience command for setting the log level - added `$null_device`: `null-device` as a const variable, would allow conditional sourcing if #13872 is fixed # Tests + Formatting - 🟢 toolkit fmt - 🟢 toolkit clippy - 🟢 toolkit test - 🟢 toolkit test stdlib # After Submitting N/A |
||
|
b60f91f722
|
Don't expand ndots if prefixed with ./ (#14755)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description Prevents ndots from being expanded if they are prefixed with `./`, as the agreed resolution to #13303. Only applies to externals, mirroring the fix from #13218. I did [attempt](https://github.com/132ikl/nushell/tree/internal-ndots-attempt) to apply the fix for internal commands as well, but it seems like the path is expanded too aggressively and I haven't investigated it further yet. `./...` gets normalized into `<pwd>/./...`, which gets normalized into `<pwd>/...` before being handed to `expand_ndots`, and at that point it just looks like a normal n-dots so we can't tell we shouldn't expand. (Fixes #13303) # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> * N-dots are no longer expanded to external command calls when prefixed with `./`. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Added tests to prevent regression. - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> N/A |
||
|
2b4c54d383
|
Add newline to empty list output (#14758)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Adds a newline to the empty list output. Fixes #14748. This does not affect the `[empty list]` text output in the REPL, just the `print` output (to be honest, I'm not certain why, but I'm guessing the REPL was adding an extra newline somewhere to compensate). The `bytes.push('\n')` replicates the code from the below `convert_table_to_output` function, which is bypassed for empty lists. Before: ```nushell [] # => ╭────────────╮ # => │ empty list │ # => ╰────────────╯ print ([]) text # => ╭────────────╮ # => │ empty list │ # => ╰────────────╯text ``` After: ```nushell [] # => ╭────────────╮ # => │ empty list │ # => ╰────────────╯ print ([]) text # => ╭────────────╮ # => │ empty list │ # => ╰────────────╯ # => text ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> * Fixes "empty list" placeholder text output when using the `print` command # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> N/A |
||
|
ed1381adc4
|
Change PipelineData::into_value to use internal Value 's span before passed in span (#14757)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Changes the `Value` variant match arm of `PipelineData::into_value` to use the internal `Value`'s span instead of the span passed in by the user. This aligns more closely with the `ListStream` and `ByteStream` match arms, which already use their internal span, and allows errors to provide better diagnostics since the span information doesn't get lost when `into_value` is called. At the suggestion of @cptpiepmatz, if the `Value` has `Span::unknown` for some reason, then we replace the `Value`'s span with the passed in span. Before: ```nushell {} | get foo bar # => Error: nu:🐚:column_not_found # => # => × Cannot find column 'foo' # => ╭─[entry #43:2:6] # => 2 │ {} | get foo bar # => · ─┬─ ─┬─ # => · │ ╰── cannot find column 'foo' # => · ╰── value originates here # => ╰──── ``` After: ```nushell {} | get foo bar # => Error: nu:🐚:column_not_found # => # => × Cannot find column 'foo' # => ╭─[entry #2:2:1] # => 2 │ {} | get foo bar # => · ─┬ ─┬─ # => · │ ╰── cannot find column 'foo' # => · ╰── value originates here # => ╰──── ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> * Some errors may have more accurate info about where the value originates from # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> N/A |
||
|
1b7fabd1fd
|
Fix config reset to use scaffold config files (#14756)
In #14249, `config reset` wasn't updated to use the scaffold config files, so running `config reset` would accidentally reset the user's config to the internal defaults. This PR updates it to use the scaffold files. |
||
|
87a562e24b
|
Fix root directory traversal issue (#14747)
fixes : #13729 During dot expansion, the "parent" was added even if it was after the root (`/../../`). Added additional check that skips appending elements to the path representation if the parent folder is the root folder. |
||
|
b5ff46db6a
|
feat(lsp): use lsp-textdocument to handle utf16 position (#14742)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> This PR replaces `ropey` with `lsp-textdocument` for easier utf16 position handling. As a side effect, if fixes the following crashing bug: 1. create a `foo.nu` file with errors in it 2. in `bar.nu`, add code `use foo.nu *` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> * <s>Diagnostics are now triggered only with document open/save, that's my personal preference. Changing back to previous behavior is easy if you guys have other concerns.</s> * UTF-8 position encoding is not supported by lsp-textdocument, but that's not an issue, since the previous utf-8 ropey implementation is buggy when used in real scenarios in a text editor. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> No new tests added, removed some utf-8 related ones. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> |
||
|
8b086d3613
|
Make get const (#14751)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Makes `get` const # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> `get` is now a const command. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> N/A |
||
|
d702c4605a
|
Increment SHLVL before run_repl() (#14732)
# Description A follow-on to #14727: * Instead of using `is-interactive` as the trigger for incrementing `SHLVL`, this change puts the increment logic just before `run_repl()` is called. * Tests are changed to use `-e` * Moves the `confirm_stdin_is_terminal()` call immediately **after** the `prerun_cmd` (which executes `--execute (-e) <commandstring>`. The fact that it was **before** that call seems to be a bug, since the error message says *"or provide arguments to invoke a script"* even if `--execute` was used. This change enables REPL testing using `--execute (-e)`. * Added a test to ensure `-c` does *not* increment SHLVL. # User-Facing Changes `$env.SHLVL` runs before the REPL is started, rather than when `is-interactive` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
||
|
25d90fa603
|
Use Value::coerce_bool in into bool (#14731)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> I realized that the `into bool` command somehow implements a conversion into a boolean value which was very similar to my implementation of ~`Value::as_env_bool`~ `Value::coerce_bool`. To streamline that behavior a bit, I replaced most of the implementation of `into bool` with my ~`Value::as_env_bool`~ `Value::coerce_bool` method. Also I added a new flag called `--relaxed` which lets the command behave more closely to the ~`Value::as_env_bool`~ `Value::coerce_bool` method as it allows null values and is more loose to strings. ~Which now begs the question, should I rename `Value::as_env_bool` just to `Value::coerce_bool` which would fit the `Value::coerce_str` method name?~ (Renamed that.) # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> The `into bool` command behaves the same but with `--relaxed` you can also throw a `null` or some more strings at it which makes it more ergonomic for env conversions. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> I added some more tests to see that the strict handling works and added some more examples to the command to showcase the `--relaxed` flag which also gets tested. - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> @Bahex mentioned in #14704 that it broke the zoxide script, this PR should help to fix the issue. |
||
|
461eb43d9d
|
Add user autoload directory (#14669)
# Description Adds a user-level (non-vendor) autoload directory: ``` ($nu.default-config-dir)/autoload ``` Currently this is the only directory. We can consider adding others if needed. Related: As a separate PR, I'm going to try to restore the ability to set `$env.NU_AUTOLOAD_DIRS` during startup. # User-Facing Changes Files in `$nu.default-config-dir/autoload` will be autoload at startup. These files will be loaded after any vendor autoloads, so that a user can override the vendor settings. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting TODO; add a `$nu.user-autoload-dirs` constant. Doc updates |
||
|
df3892f323
|
Provide the ability to split strings in columns via polars str-split (#14723)
# Description Provides the ability to split string columns. This will change the column type to list<str>. ```nushell > ❯ : [[a]; ["one,two,three"]] | polars into-df | polars select (polars col a | polars str-split ",") | polars collect ╭───┬───────────────╮ │ # │ a │ ├───┼───────────────┤ │ 0 │ ╭───┬───────╮ │ │ │ │ 0 │ one │ │ │ │ │ 1 │ two │ │ │ │ │ 2 │ three │ │ │ │ ╰───┴───────╯ │ ╰───┴───────────────╯ > ❯ : [[a]; ["one,two,three"]] | polars into-df | polars select (polars col a | polars str-split ",") | polars schema ╭───┬───────────╮ │ a │ list<str> │ ╰───┴───────────╯ ``` # User-Facing Changes - Introduces new command `polars str-split` |
||
|
0d3f76ddef
|
Remove no-longer-needed convert_env_values calls (#14681)
# Description Takes advantage of #14591 to remove the now-necessary calls to `convert_env_values()` that I added in #14249. The function is now just called once to convert `PATH`. Also removed the Windows-build-time checks for `ensure_path`, since previous case-insensitivity fixes make this unnecessary as well. # User-Facing Changes None - #14591 now handles conversion 'on-demand'. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
||
|
816b9a6953
|
stop the prompt from removing the last newline (#14590)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> I tried to setup a multiline prompt like this. <img width="175" alt="スクリーンショット 2024-12-15 17 45 06" src="https://github.com/user-attachments/assets/8d00a203-b341-45ce-8427-b4d5a9d3d7c3" /> But when I set PROMT_COMMAND like this, ```nu $env.PROMPT_COMMAND = {|| $"(ansi reset)(ansi magenta)(date now | format date "%Y-%m-%dT%H:%M:%S%z")\n(pwd)\n" } ``` The result is like this, due to dropping `\n` and `\r` on `prompt_update.rs`. <img width="185" alt="スクリーンショット 2024-12-15 17 54 21" src="https://github.com/user-attachments/assets/5ead998e-6f87-479f-b2de-e267f0cc3acd" /> Currently, adding two newlines can detour the drop. I think this drop newline makes little sense, so I removed it on this PR. If you don't like it, feel free to close it. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Trailing newline of PROMPT_COMMAND is not dropped anymore. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> This is a subtle change just on prompt string, so I think particular test is not so necessary. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> As far as I read https://www.nushell.sh/book/coloring_and_theming.html#prompt-configuration-and-coloring , the behavior seems undocumented. |