@@ -11,7 +11,7 @@ import (
11
11
op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation"
12
12
)
13
13
14
- func (idx * Indexer ) decodeInstalledModuleCalls (modHandle document.DirHandle ) (job.IDs , error ) {
14
+ func (idx * Indexer ) decodeInstalledModuleCalls (modHandle document.DirHandle , ignoreState bool ) (job.IDs , error ) {
15
15
jobIds := make (job.IDs , 0 )
16
16
17
17
moduleCalls , err := idx .modStore .ModuleCalls (modHandle .Path ())
@@ -43,9 +43,10 @@ func (idx *Indexer) decodeInstalledModuleCalls(modHandle document.DirHandle) (jo
43
43
parseId , err := idx .jobStore .EnqueueJob (job.Job {
44
44
Dir : mcHandle ,
45
45
Func : func (ctx context.Context ) error {
46
- return module .ParseModuleConfiguration (idx .fs , idx .modStore , mcPath )
46
+ return module .ParseModuleConfiguration (ctx , idx .fs , idx .modStore , mcPath )
47
47
},
48
- Type : op .OpTypeParseModuleConfiguration .String (),
48
+ Type : op .OpTypeParseModuleConfiguration .String (),
49
+ IgnoreState : ignoreState ,
49
50
})
50
51
if err != nil {
51
52
multierror .Append (errs , err )
@@ -60,9 +61,10 @@ func (idx *Indexer) decodeInstalledModuleCalls(modHandle document.DirHandle) (jo
60
61
Dir : mcHandle ,
61
62
Type : op .OpTypeLoadModuleMetadata .String (),
62
63
Func : func (ctx context.Context ) error {
63
- return module .LoadModuleMetadata (idx .modStore , mcPath )
64
+ return module .LoadModuleMetadata (ctx , idx .modStore , mcPath )
64
65
},
65
- DependsOn : job.IDs {parseId },
66
+ DependsOn : job.IDs {parseId },
67
+ IgnoreState : ignoreState ,
66
68
})
67
69
if err != nil {
68
70
multierror .Append (errs , err )
@@ -73,7 +75,7 @@ func (idx *Indexer) decodeInstalledModuleCalls(modHandle document.DirHandle) (jo
73
75
}
74
76
75
77
if parseId != "" {
76
- ids , err := idx .collectReferences (mcHandle , refCollectionDeps )
78
+ ids , err := idx .collectReferences (mcHandle , refCollectionDeps , ignoreState )
77
79
if err != nil {
78
80
multierror .Append (errs , err )
79
81
} else {
@@ -84,9 +86,10 @@ func (idx *Indexer) decodeInstalledModuleCalls(modHandle document.DirHandle) (jo
84
86
varsParseId , err := idx .jobStore .EnqueueJob (job.Job {
85
87
Dir : mcHandle ,
86
88
Func : func (ctx context.Context ) error {
87
- return module .ParseVariables (idx .fs , idx .modStore , mcPath )
89
+ return module .ParseVariables (ctx , idx .fs , idx .modStore , mcPath )
88
90
},
89
- Type : op .OpTypeParseVariables .String (),
91
+ Type : op .OpTypeParseVariables .String (),
92
+ IgnoreState : ignoreState ,
90
93
})
91
94
if err != nil {
92
95
multierror .Append (errs , err )
@@ -100,8 +103,9 @@ func (idx *Indexer) decodeInstalledModuleCalls(modHandle document.DirHandle) (jo
100
103
Func : func (ctx context.Context ) error {
101
104
return module .DecodeVarsReferences (ctx , idx .modStore , idx .schemaStore , mcPath )
102
105
},
103
- Type : op .OpTypeDecodeVarsReferences .String (),
104
- DependsOn : job.IDs {varsParseId },
106
+ Type : op .OpTypeDecodeVarsReferences .String (),
107
+ DependsOn : job.IDs {varsParseId },
108
+ IgnoreState : ignoreState ,
105
109
})
106
110
if err != nil {
107
111
multierror .Append (errs , err )
@@ -114,7 +118,7 @@ func (idx *Indexer) decodeInstalledModuleCalls(modHandle document.DirHandle) (jo
114
118
return jobIds , errs .ErrorOrNil ()
115
119
}
116
120
117
- func (idx * Indexer ) collectReferences (modHandle document.DirHandle , dependsOn job.IDs ) (job.IDs , error ) {
121
+ func (idx * Indexer ) collectReferences (modHandle document.DirHandle , dependsOn job.IDs , ignoreState bool ) (job.IDs , error ) {
118
122
ids := make (job.IDs , 0 )
119
123
120
124
var errs * multierror.Error
@@ -124,8 +128,9 @@ func (idx *Indexer) collectReferences(modHandle document.DirHandle, dependsOn jo
124
128
Func : func (ctx context.Context ) error {
125
129
return module .DecodeReferenceTargets (ctx , idx .modStore , idx .schemaStore , modHandle .Path ())
126
130
},
127
- Type : op .OpTypeDecodeReferenceTargets .String (),
128
- DependsOn : dependsOn ,
131
+ Type : op .OpTypeDecodeReferenceTargets .String (),
132
+ DependsOn : dependsOn ,
133
+ IgnoreState : ignoreState ,
129
134
})
130
135
if err != nil {
131
136
errs = multierror .Append (errs , err )
@@ -138,8 +143,9 @@ func (idx *Indexer) collectReferences(modHandle document.DirHandle, dependsOn jo
138
143
Func : func (ctx context.Context ) error {
139
144
return module .DecodeReferenceOrigins (ctx , idx .modStore , idx .schemaStore , modHandle .Path ())
140
145
},
141
- Type : op .OpTypeDecodeReferenceOrigins .String (),
142
- DependsOn : dependsOn ,
146
+ Type : op .OpTypeDecodeReferenceOrigins .String (),
147
+ DependsOn : dependsOn ,
148
+ IgnoreState : ignoreState ,
143
149
})
144
150
if err != nil {
145
151
errs = multierror .Append (errs , err )
0 commit comments