@@ -141,10 +141,44 @@ export const MethodRow = ({
141141 const showModelTypeCell =
142142 ! externalApiUsage . supported ||
143143 ( modeledMethod && modeledMethod ?. type !== "none" ) ;
144+ const modelTypeOptions = useMemo (
145+ ( ) => [
146+ { value : "none" , label : "Unmodeled" } ,
147+ { value : "source" , label : "Source" } ,
148+ { value : "sink" , label : "Sink" } ,
149+ { value : "summary" , label : "Flow summary" } ,
150+ { value : "neutral" , label : "Neutral" } ,
151+ ] ,
152+ [ ] ,
153+ ) ;
154+
144155 const showInputCell =
145156 modeledMethod ?. type && [ "sink" , "summary" ] . includes ( modeledMethod ?. type ) ;
157+ const inputOptions = useMemo (
158+ ( ) => [
159+ { value : "Argument[this]" , label : "Argument[this]" } ,
160+ ...argumentsList . map ( ( argument , index ) => ( {
161+ value : `Argument[${ index } ]` ,
162+ label : `Argument[${ index } ]: ${ argument } ` ,
163+ } ) ) ,
164+ ] ,
165+ [ argumentsList ] ,
166+ ) ;
167+
146168 const showOutputCell =
147169 modeledMethod ?. type && [ "source" , "summary" ] . includes ( modeledMethod ?. type ) ;
170+ const outputOptions = useMemo (
171+ ( ) => [
172+ { value : "ReturnValue" , label : "ReturnValue" } ,
173+ { value : "Argument[this]" , label : "Argument[this]" } ,
174+ ...argumentsList . map ( ( argument , index ) => ( {
175+ value : `Argument[${ index } ]` ,
176+ label : `Argument[${ index } ]: ${ argument } ` ,
177+ } ) ) ,
178+ ] ,
179+ [ argumentsList ] ,
180+ ) ;
181+
148182 const showKindCell = predicate ?. supportedKinds ;
149183
150184 return (
@@ -165,62 +199,32 @@ export const MethodRow = ({
165199 </ ApiOrMethodCell >
166200 < VSCodeDataGridCell gridColumn = { 2 } >
167201 < Dropdown
168- value = { showModelTypeCell ? modeledMethod ?. type ?? "none" : undefined }
202+ value = { modeledMethod ?. type ?? "none" }
203+ options = { modelTypeOptions }
169204 disabled = { ! showModelTypeCell }
170205 onChange = { handleTypeInput }
171- >
172- { showModelTypeCell && (
173- < >
174- < option value = "none" > Unmodeled</ option >
175- < option value = "source" > Source</ option >
176- < option value = "sink" > Sink</ option >
177- < option value = "summary" > Flow summary</ option >
178- < option value = "neutral" > Neutral</ option >
179- </ >
180- ) }
181- </ Dropdown >
206+ />
182207 </ VSCodeDataGridCell >
183208 < VSCodeDataGridCell gridColumn = { 3 } >
184209 < Dropdown
185- value = { showInputCell ? modeledMethod ?. input : undefined }
210+ value = { modeledMethod ?. input }
211+ options = { inputOptions }
186212 disabled = { ! showInputCell }
187213 onChange = { handleInputInput }
188- >
189- { showInputCell && (
190- < >
191- < option value = "Argument[this]" > Argument[this]</ option >
192- { argumentsList . map ( ( argument , index ) => (
193- < option key = { argument } value = { `Argument[${ index } ]` } >
194- Argument[{ index } ]: { argument }
195- </ option >
196- ) ) }
197- </ >
198- ) }
199- </ Dropdown >
214+ />
200215 </ VSCodeDataGridCell >
201216 < VSCodeDataGridCell gridColumn = { 4 } >
202217 < Dropdown
203- value = { showOutputCell ? modeledMethod ?. output : undefined }
218+ value = { modeledMethod ?. output }
219+ options = { outputOptions }
204220 disabled = { ! showOutputCell }
205221 onChange = { handleOutputInput }
206- >
207- { showOutputCell && (
208- < >
209- < option value = "ReturnValue" > ReturnValue</ option >
210- < option value = "Argument[this]" > Argument[this]</ option >
211- { argumentsList . map ( ( argument , index ) => (
212- < option key = { argument } value = { `Argument[${ index } ]` } >
213- Argument[{ index } ]: { argument }
214- </ option >
215- ) ) }
216- </ >
217- ) }
218- </ Dropdown >
222+ />
219223 </ VSCodeDataGridCell >
220224 < VSCodeDataGridCell gridColumn = { 5 } >
221225 < KindInput
222226 kinds = { predicate ?. supportedKinds || [ ] }
223- value = { showKindCell && modeledMethod ?. kind }
227+ value = { modeledMethod ?. kind }
224228 disabled = { ! showKindCell }
225229 onChange = { handleKindChange }
226230 />
0 commit comments