@@ -207,6 +207,55 @@ suite("CommentCompletion Test Suite", () => {
207
207
) ; // ! ensures trailing white space is not trimmed when this file is formatted.
208
208
} ) ;
209
209
210
+ test ( "Comment completion on function with default parameter using #function" , async ( ) => {
211
+ const { document, positions } = await openDocument ( `
212
+ /// 1️⃣
213
+ func foo(f: String = #function) {}` ) ;
214
+ const position = positions [ "1️⃣" ] ;
215
+
216
+ const items = await provider . functionCommentCompletion . provideCompletionItems (
217
+ document ,
218
+ position
219
+ ) ;
220
+ assert . deepEqual ( items , [
221
+ expectedCompletionItem ( ` $1
222
+ /// - Parameter f: $2` ) ,
223
+ ] ) ;
224
+ } ) ;
225
+
226
+ test ( "Comment completion on function with parameter named 'func'" , async ( ) => {
227
+ const { document, positions } = await openDocument ( `
228
+ /// 1️⃣
229
+ func foo(func: String) {}` ) ;
230
+ const position = positions [ "1️⃣" ] ;
231
+
232
+ const items = await provider . functionCommentCompletion . provideCompletionItems (
233
+ document ,
234
+ position
235
+ ) ;
236
+ assert . deepEqual ( items , [
237
+ expectedCompletionItem ( ` $1
238
+ /// - Parameter func: $2` ) ,
239
+ ] ) ;
240
+ } ) ;
241
+
242
+ test ( "Comment completion on function with function and parameter named 'func' and #function default, returning function type" , async ( ) => {
243
+ const { document, positions } = await openDocument ( `
244
+ /// 1️⃣
245
+ public func \`func\`(func: #function) -> function {}` ) ;
246
+ const position = positions [ "1️⃣" ] ;
247
+
248
+ const items = await provider . functionCommentCompletion . provideCompletionItems (
249
+ document ,
250
+ position
251
+ ) ;
252
+ assert . deepEqual ( items , [
253
+ expectedCompletionItem ( ` $1
254
+ /// - Parameter func: $2
255
+ /// - Returns: $3` ) ,
256
+ ] ) ;
257
+ } ) ;
258
+
210
259
function expectedCompletionItem ( snippet : string ) : vscode . CompletionItem {
211
260
const expected = new vscode . CompletionItem (
212
261
"/// - parameters:" ,
0 commit comments