Skip to content

Fix number keyword not resolving #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions docs/en-US/about_Type_Signatures.help.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Type signatures are a custom query language built into PowerShell type expressio
* [`concrete`](#concrete)
* [`index`](#index)
* [`number`](#number)
* [`hasdefault`](#hasdefault)
* [`decoration`, `hasattr`](#decoration-hasattr)
* [`generic`](#generic)
* [Resolution Maps](#resolution-maps)
Expand Down Expand Up @@ -3242,6 +3243,76 @@ public readonly struct DateTime
</tr>
</table>

## `hasdefault`

<sup>([Back to Top](#keywords))</sup>

Matches only parameters with a default value.

<table>
<tr>
<td colspan="2" width="1000">

```powershell
Find-Member -ParameterType { [hasdefault] }
```

</td>
</tr>
<tr>
<th width="1">

</th>
<th>

Signature

</th>
</tr>
<tr>
<td width="1">

:x:

</td>
<td>

```csharp
void Example(string str);
```

</td>
</tr>
<tr>
<td width="1">

:heavy_check_mark:

</td>
<td>

```csharp
void Example(string str = "something");
```

</td>
</tr>
<tr>
<td width="1">

:heavy_check_mark:

</td>
<td>

```csharp
void Example(CancellationToken token = default);
```

</td>
</tr>
</table>

## `decoration`, `hasattr`

<sup>([Back to Top](#keywords))</sup>
Expand Down
7 changes: 6 additions & 1 deletion module/ClassExplorer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'ClassExplorer.psm1'

# Version number of this module.
ModuleVersion = '2.3.0'
ModuleVersion = '2.3.1'

# Supported PSEditions
CompatiblePSEditions = 'Desktop', 'Core'
Expand Down Expand Up @@ -78,6 +78,11 @@ PrivateData = @{

# ReleaseNotes of this module
ReleaseNotes = @'
## 2.3.1

* Fix `number` signature keyword not resolving
* Add help for `hasdefault` keyword

## 2.3.0

* Add `-Extension` parameter to `Find-Member`. This will find only extension methods
Expand Down
1 change: 1 addition & 0 deletions src/ClassExplorer/Signatures/SignatureParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public ITypeSignature ParseDefinition(
Keywords.any => new AnySignature(),
Keywords.generic => Consume(ParseGeneric(args, typeName), out argsConsumed),
Keywords.hasdefault => new HasDefaultSignature(),
Keywords.number => new NumberTypeSignature(),
Keywords.decoration or Keywords.hasattr => Consume(Decoration(args, typeName), out argsConsumed),
Keywords.pointer => Consume(ParsePointer(args, typeName), out argsConsumed),
_ => Default(typeName, args),
Expand Down
12 changes: 12 additions & 0 deletions tools/Signatures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,18 @@ keywords:
- match: false
sig: public readonly struct DateTime

- header: "`hasdefault`"
description: Matches only parameters with a default value.
examples:
- syntax: Find-Member -ParameterType { [hasdefault] }
signatures:
- match: false
sig: void Example(string str);
- match: true
sig: void Example(string str = "something");
- match: true
sig: void Example(CancellationToken token = default);

- header: "`decoration`, `hasattr`"
description: Matches parameters or types decorated with this attribute.
examples:
Expand Down