Skip to content

Allow Custom Types to be used in type signatures - #19311

Merged
fdncred merged 9 commits into
nushell:mainfrom
ayax79:custom_type_lsp
Oct 23, 2026
Merged

fdncred merged 9 commits into
nushell:mainfrom
ayax79:custom_type_lsp

Conversation

@ayax79

@ayax79 ayax79 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Changes the way that custom types are exposed in order to allow them to be used in type signatures. This also enabled them to be resolved correctly in the LSP.

User-facing changes (Release notes)

Custom types in type signatures

Custom types, including those from all installed plugins, can now be used in type signatures and resolve correctly in the Nushell LSP. The following examples show custom types used in parameter and input/output type annotations:

def f [v: semver]: semver -> semver { $v }                              │

def ls-df [ ]: nothing -> polars_dataframe {
  ls | polars into-df 
}

Additional notes

closes #19315

@github-actions github-actions Bot added A:parser Issues related to parsing A:LSP Language Server Protocol (nu-lsp) labels Oct 21, 2026
@ayax79 ayax79 changed the title Custom type lsp Allow Custom Types to be used in types signatures Oct 21, 2026
@fdncred

fdncred commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

cool

@ayax79 ayax79 changed the title Allow Custom Types to be used in types signatures Allow Custom Types to be used in type signatures Oct 21, 2026

@fdncred fdncred left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review overview

🟡 Changes recommended

The new input check misses signatures that mix a custom type with other types, and which custom types can be named depends on what each plugin declares, so built-in and undeclared plugin types stay unknown while the LSP now suggests them.

Findings: 1 High severity · 2 Medium severity · 9 Low severity

Open (12)

Notes from my clanker, checked on 80e617f. Built nu and nu_plugin_custom_values from the branch and ran the snippets above with nu -n --plugins. The polars and LSP points come from reading the code.

Comment thread crates/nu-engine/src/eval_ir.rs Resolved
Comment thread crates/nu-protocol/src/syntax_shape.rs Resolved
Comment thread crates/nu-engine/src/eval_ir.rs Resolved
Comment thread crates/nu-protocol/src/ty.rs Resolved
Comment thread tests/plugins/custom_values.rs Resolved
@fdncred

fdncred commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

I think this will close #19315 too if we can make it work for all custom types.

@ayax79
ayax79 requested a review from fdncred October 22, 2026 22:13
@fdncred
fdncred merged commit 2563989 into nushell:main Oct 23, 2026
11 checks passed
@github-actions github-actions Bot added this to the v0.117.0 milestone Oct 23, 2026
@fdncred

fdncred commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Sounds good. thanks.

@fdncred fdncred added notes:ready Indicates Ready for Release notes notes:additions Noted in "Additions" section labels Oct 23, 2026
@ayax79
ayax79 deleted the custom_type_lsp branch November 13, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:LSP Language Server Protocol (nu-lsp) A:parser Issues related to parsing notes:additions Noted in "Additions" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

semver can not be used as a type for parameters

2 participants