Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,18 @@ internal void AddMembersByInferredTypeDefinitionAst(
}

var baseTypeDefinitionAst = baseTypeName._typeDefinitionAst;
results.AddRange(GetMembersByInferredType(new PSTypeName(baseTypeDefinitionAst), isStatic, filterToCall));
if (baseTypeDefinitionAst is null)
{
var baseReflectionType = baseTypeName.GetReflectionType();
if (baseReflectionType is not null)
{
results.AddRange(GetMembersByInferredType(new PSTypeName(baseReflectionType), isStatic, filterToCall));
}
}
else
{
results.AddRange(GetMembersByInferredType(new PSTypeName(baseTypeDefinitionAst), isStatic, filterToCall));
}
}

// Add stuff from our base class System.Object.
Expand Down
11 changes: 11 additions & 0 deletions 11 test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,17 @@ Verb-Noun -Param1 Hello ^
$res.CompletionMatches[0].CompletionText | Should -Be "Attributes"
}

it 'Should complete base class members of types without type definition AST' {
$res = TabExpansion2 -inputScript @'
class InheritedClassTest : System.Attribute
{
[void] TestMethod()
{
$this.
'@
$res.CompletionMatches.CompletionText | Should -Contain 'TypeId'
}

Context "Script name completion" {
BeforeAll {
Setup -f 'install-powershell.ps1' -Content ""
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.