Files
swift-mirror/test/SourceKit/CodeComplete/complete_name.swift
Ben Langmuir b6d5a1f1a5 [code-complete] Do not insert rparen after a call pattern completion
When completing
  Foo(<here>
We will now provide
  bar: <#value#>
instead of
  bar: <#value#>)

Inserting the rparen caused some problems in practice:
* the old behaviour optimized for typing Foo(<complete> instead of
  Foo(<complete>), which can conflict with user behaviours or ...
* in editors with automatic brace-matching, we often conflicted with the
  editor, leading to extraneous closing parens

And in general, it is much more predictable for tooling to either insert
matching ( and ) or to not insert either.  While this change may not be
ideal For users of editors that do not do automatic brace-matching, I
believe it is still better overall to have to type a missing paren than
to have to delete an extraneous one.

rdar://31113161
2017-12-18 11:59:49 -08:00

22 lines
623 B
Swift

// XFAIL: broken_std_regex
// RUN: %complete-test -raw -tok=INIT_NAME %s | %FileCheck %s -check-prefix=INIT_NAME
// RUN: %complete-test -raw -tok=METHOD_NAME %s | %FileCheck %s -check-prefix=METHOD_NAME
struct S {
init(a: Int, b: Int, _ c: Int) {}
init(_ a: Int, _ b: Int) {}
func foo1(_ a: Int, _ b: Int, _ c: Int, _ d: Int..., _ e: inout Int) {}
func foo2(a a: Int, b: Int, c: Int, d: Int..., e: inout Int) {}
}
func test01() {
S(#^INIT_NAME^#)
}
// INIT_NAME: key.name: "a:b::"
func test02(_ x: S) {
x.#^METHOD_NAME^#
}
// METHOD_NAME: key.name: "foo1(:::::)"
// METHOD_NAME: key.name: "foo2(a:b:c:d:e:)"