Skip to content

REGRESSION: closing parenthesis typed inside arguments of autocompleted function call does not overwrite/jump the existing closing parenthesis #947

Closed

Description

@php4fan

Steps to reproduce:

  1. Start with this code
<?php

class Whatever {
    
    protected function doSomething($x) {
        echo $x;
    }
    
    protected function bar() {
        // We are going to add code here below:
        
        
    }
}
  1. Place the cursor at the end of (inside) the bar() function, below the comment.

  2. Start typing:

        $this->doSome
Image
  1. Accept the autocomplete suggestion for doSomething() by either clicking on it or using the Enter or Tab key.

  2. Type 123 as the argument for the function:

Image

The cursor is now before the closing parenthesis

  1. Type )

Expected behavior

The closing parenthesis that you type should "overwrite" the already existing closing parenthesis, and now you should have only one closing parenthesis (which was already there) and the cursor should now be after the closing parenthesis

Observed behavior

This:

Image

The ) you typed is added inside the existing (), as if you were typing in a simple agnostic plain text editor that knows nothing about code.

Activity

  1. jakubmisek commented on Nov 21, 2025

    @jakubmisek
    Member

    Please check the setting "php.completion.parameters", you may want to set it to none.

    Image
    • parameters and parentheses insert a snippet, so you finish it by pressing TAB.
    • none option lets you to type ( and ), and tracks the closing bracket:

    Image

    f, f, [enter], (, q, 2, 3, ), ;

  2. php4fan commented on Nov 21, 2025

    @php4fan
    Author

    No, I don't want to have to type the opening ( myself.
    I expect it to understand that, if I am inside and at the end of a (), and I type an extra unmatched ), it is meant to be the closing ) that is already there and "jump" it, exactly as it does when I have typed the ( myself (and if I wanted to purposefully write an extra syntactically incorrect ) for whatever reason, i can always add it after instead of before). In other words, it shouldn't matter whether I typed the ( myself (which also results in the ) being automatically added) or it was inserted by autocomplete. What the IDE does should always only depend on the code that is there and the position I'm at, regardless of the history of how I got there.

    I never touched that setting and I've always had the () inserted automatically when it autocompletes a function name (which is what I want), and I'm pretty sure it used to behave as I expect until recently, otherwise I couldn't possibly be noticing it only now.

  3. jakubmisek commented on Nov 22, 2025

    @jakubmisek
    Member

    I see, you are right, there was a minor change that breaks the auto function of VSCode's editor.autoClosingOvertype setting.

    We'll prepare a pre-release with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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