File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed
src/PowerShellEditorServices/Services/TextDocument/Handlers
PowerShellEditorServices.Test/Language
PowerShellEditorServices.Test.Shared/Completion Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ private static CompletionItem CreateCompletionItem(
252
252
switch ( completionDetails . CompletionType )
253
253
{
254
254
case CompletionType . Type :
255
+ case CompletionType . Namespace :
255
256
case CompletionType . ParameterValue :
256
257
case CompletionType . Method :
257
258
case CompletionType . Property :
Original file line number Diff line number Diff line change
1
+ //
2
+ // Copyright (c) Microsoft. All rights reserved.
3
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
4
+ //
5
+
6
+ using Microsoft . PowerShell . EditorServices . Services . TextDocument ;
7
+
8
+ namespace Microsoft . PowerShell . EditorServices . Test . Shared . Completion
9
+ {
10
+ internal class CompleteNamespace
11
+ {
12
+ public static readonly ScriptRegion SourceDetails =
13
+ new ScriptRegion (
14
+ file : TestUtilities . NormalizePath ( "Completion/CompletionExamples.psm1" ) ,
15
+ text : string . Empty ,
16
+ startLineNumber : 21 ,
17
+ startColumnNumber : 25 ,
18
+ startOffset : 0 ,
19
+ endLineNumber : 0 ,
20
+ endColumnNumber : 0 ,
21
+ endOffset : 0 ) ;
22
+
23
+ public static readonly CompletionDetails ExpectedCompletion =
24
+ CompletionDetails . Create (
25
+ "System.Collections" ,
26
+ CompletionType . Namespace ,
27
+ "System.Collections"
28
+ ) ;
29
+ }
30
+ }
Original file line number Diff line number Diff line change @@ -115,6 +115,29 @@ await this.GetCompletionResults(
115
115
Assert . NotNull ( completionResults . Completions [ 0 ] . ToolTipText ) ;
116
116
}
117
117
118
+ [ Trait ( "Category" , "Completions" ) ]
119
+ [ Fact ]
120
+ public async Task LanguageServiceCompletesNamespace ( )
121
+ {
122
+ CompletionResults completionResults =
123
+ await this . GetCompletionResults (
124
+ CompleteNamespace . SourceDetails ) ;
125
+
126
+ Assert . NotEmpty ( completionResults . Completions ) ;
127
+
128
+ Assert . Equal (
129
+ CompleteNamespace . ExpectedCompletion . CompletionText ,
130
+ completionResults . Completions [ 0 ] . CompletionText
131
+ ) ;
132
+
133
+ Assert . Equal (
134
+ CompleteNamespace . ExpectedCompletion . CompletionType ,
135
+ completionResults . Completions [ 0 ] . CompletionType
136
+ ) ;
137
+
138
+ Assert . NotNull ( completionResults . Completions [ 0 ] . ToolTipText ) ;
139
+ }
140
+
118
141
[ Trait ( "Category" , "Completions" ) ]
119
142
[ Fact ]
120
143
public async Task LanguageServiceCompletesVariableInFile ( )
You can’t perform that action at this time.
0 commit comments