         # Write the suggestion in the code mirror
         write_suggestion: (args) =>
             suggestion_to_write = args.suggestion_to_write
-            @codemirror.setValue @query_first_part+suggestion_to_write+@query_last_part
+            if suggestion_to_write[suggestion_to_write.length-1] is '(' and @count_not_closed_brackets('(') >= 0
+                @codemirror.setValue @query_first_part+suggestion_to_write+')'+@query_last_part
+            else
+                @codemirror.setValue @query_first_part+suggestion_to_write+@query_last_part
     
             @codemirror.focus() # Useful if the user used the mouse to select a suggestion
             @codemirror.setCursor

            last_char_is_white: /.*(\s+)$/
        stop_char: # Just for performance (we look for a stop_char in constant time - which is better than having 3 and conditions) and cleaner code
            opening:
                '(': true
                '{': true
                '[': true
            closing:
                ')': '(' # Match the opening character
                '}': '{'


            @current_highlighted_suggestion = -1
            @.$('.suggestion_name_list').empty()

            result =
                status: null
