File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
test/integration-tests/editor Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ class FunctionDocumentationCompletionProvider implements vscode.CompletionItemPr
179
179
}
180
180
if ( mark [ 0 ] === "throws" ) {
181
181
throws = true ;
182
+
183
+ // Check for a type annotation on the throw i.e. throws(MyError)
184
+ parser . match ( / ^ \s * ( \( .* \) ) / ) ;
182
185
}
183
186
}
184
187
// if we find a `->` then function returns a value
Original file line number Diff line number Diff line change @@ -164,6 +164,27 @@ suite("CommentCompletion Test Suite", () => {
164
164
] ) ;
165
165
} ) ;
166
166
167
+ test ( "Comment completion on complex typed throwing function" , async ( ) => {
168
+ const { document, positions } = await openDocument ( `
169
+ /// 1️⃣
170
+ func foo(bar: Int, baz: String) -> Data throws(MyError) { return Data() }` ) ;
171
+ const position = positions [ "1️⃣" ] ;
172
+
173
+ const items = await provider . functionCommentCompletion . provideCompletionItems (
174
+ document ,
175
+ position
176
+ ) ;
177
+ assert . deepEqual ( items , [
178
+ expectedCompletionItem (
179
+ ` $1
180
+ /// - Parameters:
181
+ /// - bar: $2
182
+ /// - baz: $3
183
+ /// - Returns: $4`
184
+ ) ,
185
+ ] ) ;
186
+ } ) ;
187
+
167
188
test ( "Comment Insertion" , async ( ) => {
168
189
const { document, positions } = await openDocument ( `
169
190
/// 1️⃣
You can’t perform that action at this time.
0 commit comments