[fidl-lsp] Resolve relative fidl_project.json paths
fidl_project.json, generated by //build/fidl:gen_fidl_project in
fuchsia.git, now uses paths relative to the build directory. For
example, "../../sdk/fidl/..." for source files and "fidling/gen/..." for
JSON IR. The language server treated these paths as absolute, so it
resolved them against its own working directory, failed to load any
JSON IR, and go-to-definition, hover, and references returned nothing.
Resolve relative paths in LoadFidlProject against the directory
containing fidl_project.json, so the rest of the server keeps working
with absolute paths. Absolute paths are left unchanged.
Add github.com/google/go-cmp to compare the loaded result in the new
test. v0.6.0 is the newest version compatible with this module's
go 1.14 directive.
Test: go test -run 'TestLoadFidlProject|TestFindDeps' ./analysis/
Test: Ran the patched server against a core.x64 build's unmodified
fidl_project.json; go-to-definition now resolves symbols in the same
library and in dependencies.
Change-Id: I59b87ccc4070853f69bb1c1e883351b7bb515ceb
Reviewed-on: https://fuchsia-review.googlesource.com/c/fidl-misc/+/1901917
Reviewed-by: Ian McKellar <ianloic@google.com>
3 files changed