mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 15:06:03 +02:00
Exposed the recursion limit value as a config option (#12308)
<!-- 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. --> Closes #12253. Exposes the option as "recursion_limit" under config. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> The config file now has a new option! # 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. --> Nothing else...? Do let me know if there's something I've missed!
This commit is contained in:
@ -61,6 +61,7 @@ pub struct Config {
|
||||
pub footer_mode: FooterMode,
|
||||
pub float_precision: i64,
|
||||
pub max_external_completion_results: i64,
|
||||
pub recursion_limit: i64,
|
||||
pub filesize_format: String,
|
||||
pub use_ansi_coloring: bool,
|
||||
pub quick_completions: bool,
|
||||
@ -133,6 +134,7 @@ impl Default for Config {
|
||||
completion_algorithm: CompletionAlgorithm::default(),
|
||||
enable_external_completion: true,
|
||||
max_external_completion_results: 100,
|
||||
recursion_limit: 50,
|
||||
external_completer: None,
|
||||
use_ls_colors_completions: true,
|
||||
|
||||
@ -753,6 +755,19 @@ impl Value {
|
||||
value,
|
||||
&mut errors);
|
||||
}
|
||||
"recursion_limit" => {
|
||||
if let Value::Int { val, internal_span } = value {
|
||||
if val > &mut 1 {
|
||||
config.recursion_limit = *val;
|
||||
} else {
|
||||
report_invalid_value("should be a integer greater than 1", span, &mut errors);
|
||||
*value = Value::Int { val: 50, internal_span: *internal_span };
|
||||
}
|
||||
} else {
|
||||
report_invalid_value("should be a integer greater than 1", span, &mut errors);
|
||||
*value = Value::Int { val: 50, internal_span: value.span() };
|
||||
}
|
||||
}
|
||||
// Catch all
|
||||
_ => {
|
||||
report_invalid_key(&[key], span, &mut errors);
|
||||
|
Reference in New Issue
Block a user