-
Notifications
You must be signed in to change notification settings - Fork 36
Description
It feels like navigateToFile() and openDocument() are basically the same, so I'm left wondering which one I should use.
I note that documentOpen() has not yet appeared in a released version of rstudioapi, so this can still be rationalized easily.
From where I sit, it feels like documentOpen() should be a straight call to .rs.api.documentOpen(filePath, line = line, col = col, moveCursor = moveCursor). The current call to normalizePath(path, winslash = "/", mustWork = TRUE) in this package seems unnecessary given the argument checking and processing inside .rs.api.documentOpen().
And then maybe navigateToFile() becomes just an alias for documentOpen()? documentOpen() feels like a better name for this operation and fits well into the family of documentVERB() functions.
(.rs.addApiFunction("navigateToFile") is just an alias for .rs.api.documentOpen() at this point.)
Lines 246 to 254 in 75e7f6e
| documentOpen <- function( | |
| path, | |
| line = -1L, | |
| col = -1L, | |
| moveCursor = TRUE) | |
| { | |
| path <- normalizePath(path, winslash = "/", mustWork = TRUE) | |
| callFun("documentOpen", path, line, col, moveCursor) | |
| } |
Lines 238 to 248 in 942cebe
| navigateToFile <- function(file = character(0), | |
| line = -1L, | |
| column = -1L, | |
| moveCursor = TRUE) | |
| { | |
| callFun("navigateToFile", | |
| file, | |
| as.integer(line), | |
| as.integer(column), | |
| as.logical(moveCursor)) | |
| } |