Sublime Forum

Goto definition in R language wrongly goes to Rd files

#1

If i use the “Goto Definition” function in an R language file (file extension *.R), it does not find the function definition as in other languages. If however there is a *.Rd file in the current project, it will use the definition from this one instead. *.Rd files are automatically created from the comments via the documentation tool roxygen2 when building R libraries. Sublime understands them to have a different syntax (they are recognized as R Documentation files) so why does sublime look at files from another syntax definition for the function defintion?

This behavior does not seem to change independent of the two R assignment operators (= and <-)

0 Likes

#2

ST treats definitions in a language agnostic manner - sometimes you want to go to a CSS class referenced in a HTML page, for example

however, with the following code (disclaimer, I have no idea how R works as there are no syntax test files in the R package)

abc <- function () {}
abc

using Goto Definition on line 2 goes to line 1, so this seems to work for me.

What build of Sublime Text are you running? Do you use a third party package for R syntax highlighting? can you share some example code where the Goto Definition functionality doesn’t find your function declaration in the source code?

0 Likes