From e0318685ea8a28703d07fb73fd98d17ba9e48ba7 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Tue, 11 Sep 2018 16:41:52 -0400 Subject: [PATCH] add dir field to context --- internal/suggest/suggest.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/suggest/suggest.go b/internal/suggest/suggest.go index 684809c2..4a1d1e09 100644 --- a/internal/suggest/suggest.go +++ b/internal/suggest/suggest.go @@ -30,6 +30,11 @@ type PackedContext struct { // Env []string + // Dir is the directory in which to run the build system's query tool + // that provides information about the packages. + // If Dir is empty, the tool is run in the current directory. + Dir string + // BuildFlags is a list of command-line flags to be passed through to // the build system's query tool. BuildFlags []string @@ -98,6 +103,7 @@ func (c *Config) analyzePackage(filename string, data []byte, cursor int) (*toke cfg := &packages.Config{ Mode: packages.LoadSyntax, Env: c.Context.Env, + Dir: c.Context.Dir, BuildFlags: c.Context.BuildFlags, ParseFile: func(fset *token.FileSet, parseFilename string) (*ast.File, error) { var src interface{}