Diagnostics for defined symbols currently use workspace symbols as a source of definitions. This causes definitions in a file to silence "undefined symbol" diagnostics in another file:
# file1.R
foo <- 1
# file2.R
foo # No diagnostic
RStudio is much less liberal. It requires that you source() a script to populate symbols explictly. For instance:
# file2.R
source("file1.R")
foo # Correctly defined
These features should behave more like "document symbols" than "workspace symbols":
Ideally we'd populate the definitions statically if the sourced file has a static file path. In the meantime we can rely on the dynamic search path, which is what RStudio does as well.