Skip to content

Function completion for parameterless functions can delete a typed closing parenthesis #782

@tristanlabelle

Description

@tristanlabelle

Compare C# and Swift:

func parens commit cs
func parens commit swift

Note that the completion list is still visible after the ( in the Swift case, whereas C# transitioned to parameter completion. It's not too bad in this example, but it leads to weird behaviors in others, like typing foo() and hitting enter:

func parens completion swift

Compare with C#:

func parens completion cs

I believe the fix is to specify commitCharacters = [ '(' ] on the CompletionItem at https://github.com/apple/sourcekit-lsp/blob/8cb76ba22a53bfe4b21575200fd5d930a931eb18/Sources/SourceKitLSP/Swift/CodeCompletion.swift#L173 . Or to use CompletionOptions.allCommitCharacters in initialize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions