Skip to content

Prevent fallback to filename completion when avairable completions are none #26319

@teramako

Description

@teramako

Summary of the new feature / enhancement

I am currently developing PowerShell Module for external command completion using Register-ArgumentCompleter -NativeFallback (#25230) . I encountered a problem during development.
When completing a certain parameter, if there are no completion candidates and an empty IEnumerable<CompletionResult> is returned, it falls back to filename completion.

I would like to be able to control whether or not it falls back to filename completion.

Proposed technical implementation details (optional)

There are two ideas.

A)

During NativeFallback completion, do not fall back to filename completion.

If you want to perform filename completion, manually call [System.Management.Automation.CompletionCompleters]::CompleteFilename($wordToComplete).

B)

Stop completion when a special CompletionResult (*1) is received.

*1: like CompletionResult.Null (However, this is an internal access modifier and cannot be used externally)

/// <summary>
/// Gets the null instance of type CompletionResult.
/// </summary>
internal static CompletionResult Null
{
get { return s_nullInstance; }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions