initial
Some checks are pending
CI Tests / dotnet (push) Waiting to run
CI Tests / dotnet-1 (push) Waiting to run
CI Tests / dotnet-2 (push) Waiting to run
Emacs End-to-End Tests / ert (push) Waiting to run
Vim End-to-End Tests / themis (push) Waiting to run

This commit is contained in:
fwastring 2026-02-17 13:06:31 +01:00
commit baa0056244
352 changed files with 47928 additions and 0 deletions

View file

@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
namespace Microsoft.PowerShell.EditorServices.Test.Shared.Completion
{
internal static class CompleteAttributeValue
{
public static readonly ScriptRegion SourceDetails = new(
file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"),
text: string.Empty,
startLineNumber: 16,
startColumnNumber: 38,
startOffset: 0,
endLineNumber: 0,
endColumnNumber: 0,
endOffset: 0);
public static readonly CompletionItem ExpectedCompletion1 = new()
{
Kind = CompletionItemKind.Property,
Detail = "System.Boolean ValueFromPipeline",
FilterText = "ValueFromPipeline",
InsertText = "ValueFromPipeline",
Label = "ValueFromPipeline",
TextEdit = new TextEdit
{
NewText = "ValueFromPipeline",
Range = new Range
{
Start = new Position { Line = 15, Character = 32 },
End = new Position { Line = 15, Character = 37 }
}
}
};
public static readonly CompletionItem ExpectedCompletion2 = new()
{
Kind = CompletionItemKind.Property,
Detail = "System.Boolean ValueFromPipelineByPropertyName",
FilterText = "ValueFromPipelineByPropertyName",
InsertText = "ValueFromPipelineByPropertyName",
Label = "ValueFromPipelineByPropertyName",
TextEdit = new TextEdit
{
NewText = "ValueFromPipelineByPropertyName",
Range = new Range
{
Start = new Position { Line = 15, Character = 32 },
End = new Position { Line = 15, Character = 37 }
}
}
};
public static readonly CompletionItem ExpectedCompletion3 = new()
{
Kind = CompletionItemKind.Property,
Detail = "System.Boolean ValueFromRemainingArguments",
FilterText = "ValueFromRemainingArguments",
InsertText = "ValueFromRemainingArguments",
Label = "ValueFromRemainingArguments",
TextEdit = new TextEdit
{
NewText = "ValueFromRemainingArguments",
Range = new Range
{
Start = new Position { Line = 15, Character = 32 },
End = new Position { Line = 15, Character = 37 }
}
}
};
}
}

View file

@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
namespace Microsoft.PowerShell.EditorServices.Test.Shared.Completion
{
internal static class CompleteCommandFromModule
{
public const string GetRandomDetail =
"Get-Random [[-Maximum] <Object>] [-SetSeed <int>] [-Minimum <Object>]";
public static readonly ScriptRegion SourceDetails = new(
file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"),
text: string.Empty,
startLineNumber: 13,
startColumnNumber: 8,
startOffset: 0,
endLineNumber: 0,
endColumnNumber: 0,
endOffset: 0);
public static readonly CompletionItem ExpectedCompletion = new()
{
Kind = CompletionItemKind.Function,
Detail = "", // OS-dependent, checked separately.
FilterText = "Get-Random",
InsertText = "Get-Random",
Label = "Get-Random",
SortText = "0001Get-Random",
TextEdit = new TextEdit
{
NewText = "Get-Random",
Range = new Range
{
Start = new Position { Line = 12, Character = 0 },
End = new Position { Line = 12, Character = 8 }
}
}
};
}
}

View file

@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
namespace Microsoft.PowerShell.EditorServices.Test.Shared.Completion
{
internal static class CompleteCommandInFile
{
public static readonly ScriptRegion SourceDetails = new(
file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"),
text: string.Empty,
startLineNumber: 8,
startColumnNumber: 10,
startOffset: 0,
endLineNumber: 0,
endColumnNumber: 0,
endOffset: 0);
public static readonly CompletionItem ExpectedCompletion = new()
{
Kind = CompletionItemKind.Function,
Detail = "",
FilterText = "Get-XYZSomething",
InsertText = "Get-XYZSomething",
Label = "Get-XYZSomething",
SortText = "0001Get-XYZSomething",
TextEdit = new TextEdit
{
NewText = "Get-XYZSomething",
Range = new Range
{
Start = new Position { Line = 7, Character = 0 },
End = new Position { Line = 7, Character = 9 }
}
}
};
}
}

View file

@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
namespace Microsoft.PowerShell.EditorServices.Test.Shared.Completion
{
internal static class CompleteFilePath
{
public static readonly ScriptRegion SourceDetails = new(
file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"),
text: string.Empty,
startLineNumber: 19,
startColumnNumber: 15,
startOffset: 0,
endLineNumber: 0,
endColumnNumber: 0,
endOffset: 0);
public static readonly TextEdit ExpectedEdit = new()
{
NewText = "",
Range = new Range
{
Start = new Position { Line = 18, Character = 14 },
End = new Position { Line = 18, Character = 14 }
}
};
}
}

View file

@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
namespace Microsoft.PowerShell.EditorServices.Test.Shared.Completion
{
internal static class CompleteNamespace
{
public static readonly ScriptRegion SourceDetails = new(
file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"),
text: string.Empty,
startLineNumber: 22,
startColumnNumber: 15,
startOffset: 0,
endLineNumber: 0,
endColumnNumber: 0,
endOffset: 0);
public static readonly CompletionItem ExpectedCompletion = new()
{
Kind = CompletionItemKind.Module,
Detail = "Namespace System.Collections",
FilterText = "System.Collections",
InsertText = "System.Collections",
Label = "Collections",
SortText = "0001Collections",
TextEdit = new TextEdit
{
NewText = "System.Collections",
Range = new Range
{
Start = new Position { Line = 21, Character = 1 },
End = new Position { Line = 21, Character = 15 }
}
}
};
}
}

View file

@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
namespace Microsoft.PowerShell.EditorServices.Test.Shared.Completion
{
internal static class CompleteTypeName
{
public static readonly ScriptRegion SourceDetails = new(
file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"),
text: string.Empty,
startLineNumber: 21,
startColumnNumber: 25,
startOffset: 0,
endLineNumber: 0,
endColumnNumber: 0,
endOffset: 0);
public static readonly CompletionItem ExpectedCompletion = new()
{
Kind = CompletionItemKind.TypeParameter,
Detail = "System.Collections.ArrayList",
FilterText = "System.Collections.ArrayList",
InsertText = "System.Collections.ArrayList",
Label = "ArrayList",
SortText = "0001ArrayList",
TextEdit = new TextEdit
{
NewText = "System.Collections.ArrayList",
Range = new Range
{
Start = new Position { Line = 20, Character = 1 },
End = new Position { Line = 20, Character = 29 }
}
}
};
}
}

View file

@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
namespace Microsoft.PowerShell.EditorServices.Test.Shared.Completion
{
internal static class CompleteVariableInFile
{
public static readonly ScriptRegion SourceDetails = new(
file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"),
text: string.Empty,
startLineNumber: 10,
startColumnNumber: 9,
startOffset: 0,
endLineNumber: 0,
endColumnNumber: 0,
endOffset: 0);
public static readonly CompletionItem ExpectedCompletion = new()
{
Kind = CompletionItemKind.Variable,
// PowerShell 7.4 now lights up a type for the detail, otherwise it's the same as the
// label and therefore hidden.
Detail = Utility.VersionUtils.IsPS74 ? "[string]" : "",
FilterText = "$testVar1",
InsertText = "$testVar1",
Label = "testVar1",
SortText = "0001testVar1",
TextEdit = new TextEdit
{
NewText = "$testVar1",
Range = new Range
{
Start = new Position { Line = 9, Character = 0 },
End = new Position { Line = 9, Character = 8 }
}
}
};
}
}

View file

@ -0,0 +1,22 @@
function Get-XYZSomething
{
$testVar2 = "Shouldn't find this variable"
}
$testVar1 = "Should find this variable"
Get-XYZSo
$testVar
Import-Module PowerShellGet
Get-Rand
function Test-Completion {
param([Parameter(Mandatory, Value)]$test)
}
Get-ChildItem /
[System.Collections.ArrayList].GetType()
[System.Collect