code: func (l *Loader) LoadConfigWithSnapshot(rootDir string) (*configs.Config, *Snapshot, hcl.Diagnostics) {
  	rootMod, diags := l.parser.LoadConfigDir(rootDir)
  	if rootMod == nil {
  		return nil, nil, diags
  	}
  
  	snap := &Snapshot{
  		Modules: map[string]*SnapshotModule{},
  	}
  	walker := l.makeModuleWalkerSnapshot(snap)
  	cfg, cDiags := configs.BuildConfig(rootMod, walker)
  	diags = append(diags, cDiags...)
  
  	addDiags := l.addModuleToSnapshot(snap, "", rootDir, "", nil)
  	diags = append(diags, addDiags...)
  
  	return cfg, snap, diags
  }
docs: // LoadConfigWithSnapshot is a variant of LoadConfig that also simultaneously
  // creates an in-memory snapshot of the configuration files used, which can
  // be later used to create a loader that may read only from this snapshot.