Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lang/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type ParseOptions struct {

LspOptions map[string]string

DisableBuildGraph bool

// TS options
// tsconfig string
TSParseOptions
Expand Down Expand Up @@ -102,6 +104,13 @@ func Parse(ctx context.Context, uri string, args ParseOptions) ([]byte, error) {
log.Error("Failed to collect symbols: %v\n", err)
return nil, err
}

if !args.DisableBuildGraph {
if err = repo.BuildGraph(); err != nil {
return nil, err
}
}

log.Info("all symbols collected, start writing to stdout...\n")

if args.RepoID != "" {
Expand Down Expand Up @@ -199,9 +208,6 @@ func collectSymbol(ctx context.Context, cli *lsp.LSPClient, repoPath string, opt
}
}

if err := repo.BuildGraph(); err != nil {
return nil, err
}
return repo, nil
}

Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ Language Support:
cmd.Flags().BoolVar(&opts.NoNeedComment, "no-need-comment", false, "Skip parsing code comments (only works for Go).")
cmd.Flags().BoolVar(&opts.NotNeedTest, "no-need-test", false, "Skip test files during parsing (only works for Go).")
cmd.Flags().BoolVar(&opts.LoadByPackages, "load-by-packages", false, "Load packages one by one instead of all at once (only works for Go, uses more memory).")
cmd.Flags().BoolVar(&opts.DisableBuildGraph, "disable-build-graph", false, "Disable the step of building the dependency graph among AST nodes.")
cmd.Flags().StringSliceVar(&opts.Excludes, "exclude", []string{}, "Files or directories to exclude from parsing (can be specified multiple times).")
cmd.Flags().StringVar(&opts.RepoID, "repo-id", "", "Custom identifier for this repository (useful for multi-repo scenarios).")
cmd.Flags().StringArrayVar(&opts.BuildFlags, "build-flag", []string{}, "Pass build flags to the Go parser (e.g. -tags=xxx).")
Expand Down
Loading