vscode-R: VSCode autocompletion doesn't "complete", duplicates existing text

Apologies if this is easily fixed, but I wasn’t able to find it in the docs.

On my Mac, when I type any VSCode autocompletion, the autocompletion appends to what I have already written, producing invalid code. Say I’m writing is.infinite, and I have written is., I navigate over to infinite and press tab or Enter and the editor produces is.is.infinite().

Is there a setting to change this behavior? Is this intended to be the default behavior? Or am I missing something?

Thank you.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 4
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Ah! I just noticed that this issue only occurs inside .Rmd code chunks and not in .R files. Can you reproduce there?

Yes, I could reproduce it in rmd. Thanks for reporting!

It is an editor issue, let me transfer it to vscode-R.

Thanks!

A further detail: it seems to only occur with completions in the is. and the as. family (perhaps others???). When I type geo and fill geom_point, it correctly appends the remaining text. I thought it had to do with dot operators, but typing data. correctly completes to data.frame. Strangely, typing infinite and then selecting is.infinite autocompletes the correct code.

It is an editor issue, let me transfer it to vscode-R.

From the logging of the languageserver, the beginning tokens seem correct:


[2021-10-17 13:27:02.649] token: {
  "full_token": "is.",
  "right_token": "",
  "package": null,
  "accessor": "",
  "token": "is."
}

[2021-10-17 13:27:02.656] bracket is  

[2021-10-17 13:27:02.657] completions:  {
  "init_count": 57,
  "final_count": 57,
  "time": 0.0078,
  "isIncomplete": false
}

[2021-10-17 13:27:19.168] token: {
  "full_token": "data.",
  "right_token": "",
  "package": null,
  "accessor": "",
  "token": "data."
}

[2021-10-17 13:27:19.176] bracket is  

[2021-10-17 13:27:19.177] completions:  {
  "init_count": 62,
  "final_count": 62,
  "time": 0.0089,
  "isIncomplete": false
}

Sure. The above issues were on vscode-R (2.3.1), vscode release (1.61.0) on macOS (11.5.2) with languageserver (0.3.11). Updating to vscode (1.61.1) did not resolve the issue. I doubt the OS version would make a difference?

Ah! I just noticed that this issue only occurs inside .Rmd code chunks and not in .R files. Can you reproduce there?