@@ -126,17 +126,17 @@ range_formatting_reply <- function(id, uri, document, range, options) {
126126on_type_formatting_reply <- function (id , uri , document , point , ch , options ) {
127127 content <- document $ content
128128 end_line <- point $ row + 1
129- use_zero <- FALSE
129+ use_completer <- FALSE
130130 if (ch == " \n " ) {
131131 start_line <- end_line - 1
132132 if (grepl(" ^\\ s*(#.*)?$" , content [[start_line ]])) {
133133 return (Response $ new(id ))
134134 }
135135 if (grepl(" ^\\ s*(#.*)?$" , content [[end_line ]])) {
136- # use "0" to complete the potentially incomplete expression
136+ # use completer to complete the potentially incomplete expression
137137 last_line <- content [end_line ]
138- content [end_line ] <- " 0 "
139- use_zero <- TRUE
138+ content [end_line ] <- " f() "
139+ use_completer <- TRUE
140140 }
141141 } else {
142142 start_line <- end_line
@@ -203,8 +203,9 @@ on_type_formatting_reply <- function(id, uri, document, point, ch, options) {
203203 error = function (e ) logger $ info(" on_type_formatting_reply:styler:" , e )
204204 )
205205 if (! is.null(new_text )) {
206- if (use_zero ) {
207- new_text <- substr(new_text , 1 , nchar(new_text ) - 1 )
206+ if (use_completer ) {
207+ # remove completer from formatted text
208+ new_text <- substr(new_text , 1 , nchar(new_text ) - 3 )
208209 new_text <- paste0(new_text , trimws(last_line ))
209210 }
210211 range <- range(
0 commit comments