@@ -115,14 +115,14 @@ export function migrateLegacySnippet(
115115 name : snippetName ,
116116 description : snippet . description ,
117117 phrases : phrases ,
118- variables : parseVariables (
118+ variables : parseVariables ( {
119119 spokenForms,
120120 snippetName,
121- snippet . variables ,
122- undefined ,
123- true ,
124- false ,
125- ) ,
121+ snippetVariables : snippet . variables ,
122+ defVariables : undefined ,
123+ addMissingPhrases : true ,
124+ addMissingInsertionFormatters : false ,
125+ } ) ,
126126 insertionScopes : snippet . insertionScopeTypes ,
127127 } ;
128128 }
@@ -141,14 +141,14 @@ export function migrateLegacySnippet(
141141 phrases : useHeader ? undefined : phrases ,
142142 insertionScopes : useHeader ? undefined : snippet . insertionScopeTypes ,
143143 languages : def . scope ?. langIds ,
144- variables : parseVariables (
144+ variables : parseVariables ( {
145145 spokenForms,
146146 snippetName,
147- useHeader ? undefined : snippet . variables ,
148- def . variables ,
149- ! useHeader ,
150- true ,
151- ) ,
147+ snippetVariables : useHeader ? undefined : snippet . variables ,
148+ defVariables : def . variables ,
149+ addMissingPhrases : ! useHeader ,
150+ addMissingInsertionFormatters : true ,
151+ } ) ,
152152 // SKIP: def.scope?.scopeTypes
153153 // SKIP: def.scope?.excludeDescendantScopeTypes
154154 body : def . body . map ( ( line ) => line . replaceAll ( "\t" , " " ) ) ,
@@ -159,14 +159,23 @@ export function migrateLegacySnippet(
159159 return [ communitySnippetFile , hasSkippedSnippet ] ;
160160}
161161
162- function parseVariables (
163- spokenForms : SpokenForms ,
164- snippetName : string ,
165- snippetVariables : Record < string , SnippetVariableLegacy > | undefined ,
166- defVariables : Record < string , SnippetVariableLegacy > | undefined ,
167- addMissingPhrases : boolean ,
168- addMissingInsertionFormatters : boolean ,
169- ) : SnippetVariable [ ] {
162+ interface ParseVariablesOpts {
163+ spokenForms : SpokenForms ;
164+ snippetName : string ;
165+ snippetVariables : Record < string , SnippetVariableLegacy > | undefined ;
166+ defVariables : Record < string , SnippetVariableLegacy > | undefined ;
167+ addMissingPhrases : boolean ;
168+ addMissingInsertionFormatters : boolean ;
169+ }
170+
171+ function parseVariables ( {
172+ spokenForms,
173+ snippetName,
174+ snippetVariables,
175+ defVariables,
176+ addMissingPhrases,
177+ addMissingInsertionFormatters,
178+ } : ParseVariablesOpts ) : SnippetVariable [ ] {
170179 const map : Record < string , SnippetVariable > = { } ;
171180
172181 const add = ( name : string , variable : SnippetVariableLegacy ) => {
0 commit comments