Within a BUILD.gn file, I can't use `gf` in Vim to move to a dependency given by an absolute path (relative to source root of course).
From chrome/browser/BUILD.gn:
1. Move cursor to "//mash/common"
2. `gf`
Expected: opens //mash/common/BUILD.gn
Actual: opens //mash/common (the directory)
Reduced case:
:echo gn#TranslateToBuildFile("foo/bar")
Expected: "foo/bar/BUILD.gn"
Actual: "foo/bar"
Workaround: Install the google-vim/maktaba plugin, AND call `:runtime autoload/maktaba.vim`.
I think there are 2 bugs:
1. The fallback (without maktaba) uses `isdirectory()`, which only works for a relative directory if the directory exists relative to the current directory.
2. autoload/gn.vim checks for maktaba, but merely checking for a function's existence does not cause the vim file defining the function to be autoloaded. Thus the call to `:runtime` is necessary to load maktaba before calling gn#TranslateToBuildFile.
note: gn/misc/vim/ftplugin/gn.vim sets `includeexpr` to gn#TranslateToBuildFile, which causes it to be called when looking for a file when the buffer is a .gn file
Comment 1 by michae...@chromium.org
, Sep 8 2017