Sublime Forum

Sublime Text 4 R code autocomplete doesn't recognize variables with period

#1

In R is common practice to name long variables using a period such as “my.variable”. The autocomplete in ST3 recognized these as variables but in ST4 the words before and after the period are recognized as separate variables.

How do I make variables with a period recognized as a complete name?

0 Likes

#2

You probably can’t, because many functions just ignore word_separators settings, which doesn’t contain periods for R already.

0 Likes

#3

It was working just fine on ST3, I am not sure I understand your answer. I guess I will have to go back to ST3

0 Likes

#4

Word boundaries in auto-completions and other functions are hard coded and not configurable (The linked issue requests them to be more adjustable). Auto-completions has seen several changes to fix quite a number of issues with regards to non-word characters. All those changes or new heuristics are hard coded as well. So there is no way for syntax authors or end users to adjust things for certain syntaxes - all of them coming with their own special needs.

The main issue might be - just guessing - periods to be used as accessors in many popular languages, so new AC breaks words when seeing them.

As AC probably won’t go the way back to make it work like in ST3 as it breaks many other things, the only chance is to request it to respect word_separators setting. That’s the point.

0 Likes

#5

Thanks for explaining that. Oh my what a nightmare, I definitely will not change thousands of lines of code, so I am forced to go back to ST3 or move to a different editor. This is a huge drawback for R users.

0 Likes

#6

Are there any updates on the issue? I am sure I am not the only R programmer with this problem. I wanted to buy a ST license but now being stuck with ST3 I don’t know what to do. What are some alternatives for R coding aside from Rstudio text editor?

0 Likes

#7

Have you tried LSP-R ?

It’s a package that hooks up the R languageserver with sublime text, providing accurate completions (among other things).

1 Like

#8

I recommend using ST4 with LSP-R.

1 Like

#9

Thanks for the suggestion. I have just tried but unfortunately it doesn’t recognize “.” as part of a variable name.

This is really frustrating! ST developer have not at all thought about R code!

0 Likes

#10

I imagine there’s still no solution for this rather than using LSP-R?

0 Likes

#11

LSP-R is the proper solution. It is maintained by a Sublime Text user. Same author as Terminus. You can open an issue about the . auto-completion on the repo to work towards steps to a better UX.

0 Likes

#12

I have been using ST with LSP-R and so far it’s really a horrible UX, the UI is so cluttered with documentation, auto complete, scrolling down sometimes the cursors gets stuck because of some popup.

0 Likes