@@ -33,8 +33,6 @@ LUAU_FASTINT(LuauTarjanChildLimit)
3333LUAU_FASTFLAGVARIABLE(DebugLogFragmentsFromAutocomplete)
3434LUAU_FASTFLAG(LuauUseWorkspacePropToChooseSolver)
3535LUAU_FASTFLAGVARIABLE(LuauFragmentRequiresCanBeResolvedToAModule)
36- LUAU_FASTFLAGVARIABLE(LuauPopulateSelfTypesInFragment)
37- LUAU_FASTFLAGVARIABLE(LuauForInProvidesRecommendations)
3836LUAU_FASTFLAGVARIABLE(LuauForInRangesConsiderInLocation)
3937
4038namespace Luau
@@ -119,7 +117,7 @@ Location getFragmentLocation(AstStat* nearestStatement, const Position& cursorPo
119117 {
120118 Location nonEmpty{nearestStatement->location .begin , cursorPosition};
121119 // If your sibling is a do block, do nothing
122- if (auto doEnd = nearestStatement->as <AstStatBlock>())
120+ if (nearestStatement->as <AstStatBlock>())
123121 return empty;
124122
125123 // If you're inside the body of the function and this is your sibling, empty fragment
@@ -156,27 +154,20 @@ Location getFragmentLocation(AstStat* nearestStatement, const Position& cursorPo
156154
157155 if (auto forStat = nearestStatement->as <AstStatFor>())
158156 {
159-
160- if (FFlag::LuauForInProvidesRecommendations)
161- {
162- if (forStat->step && forStat->step ->location .containsClosed (cursorPosition))
163- return {forStat->step ->location .begin , cursorPosition};
164- if (forStat->to && forStat->to ->location .containsClosed (cursorPosition))
165- return {forStat->to ->location .begin , cursorPosition};
166- if (forStat->from && forStat->from ->location .containsClosed (cursorPosition))
167- return {forStat->from ->location .begin , cursorPosition};
168- }
157+ if (forStat->step && forStat->step ->location .containsClosed (cursorPosition))
158+ return {forStat->step ->location .begin , cursorPosition};
159+ if (forStat->to && forStat->to ->location .containsClosed (cursorPosition))
160+ return {forStat->to ->location .begin , cursorPosition};
161+ if (forStat->from && forStat->from ->location .containsClosed (cursorPosition))
162+ return {forStat->from ->location .begin , cursorPosition};
169163
170164 if (!forStat->hasDo )
171165 return nonEmpty;
172166 else
173167 {
174- if (FFlag::LuauForInProvidesRecommendations)
175- {
176168 auto completeableExtents = Location{forStat->location .begin , forStat->doLocation .begin };
177169 if (completeableExtents.containsClosed (cursorPosition))
178170 return nonEmpty;
179- }
180171
181172 return empty;
182173 }
@@ -188,21 +179,18 @@ Location getFragmentLocation(AstStat* nearestStatement, const Position& cursorPo
188179 return nonEmpty;
189180 else
190181 {
191- if (FFlag::LuauForInProvidesRecommendations)
182+ auto completeableExtents = Location{forIn->location .begin , forIn->doLocation .begin };
183+ if (completeableExtents.containsClosed (cursorPosition))
192184 {
193- auto completeableExtents = Location{forIn->location .begin , forIn->doLocation .begin };
194- if (completeableExtents.containsClosed (cursorPosition))
185+ if (!forIn->hasIn )
186+ return nonEmpty;
187+ else
195188 {
196- if (!forIn->hasIn )
189+ // [for ... in ... do] - the cursor can either be between [for ... in] or [in ... do]
190+ if (FFlag::LuauForInRangesConsiderInLocation && cursorPosition < forIn->inLocation .begin )
197191 return nonEmpty;
198192 else
199- {
200- // [for ... in ... do] - the cursor can either be between [for ... in] or [in ... do]
201- if (FFlag::LuauForInRangesConsiderInLocation && cursorPosition < forIn->inLocation .begin )
202- return nonEmpty;
203- else
204- return Location{forIn->inLocation .begin , cursorPosition};
205- }
193+ return Location{forIn->inLocation .begin , cursorPosition};
206194 }
207195 }
208196 return empty;
@@ -429,13 +417,10 @@ FragmentAutocompleteAncestryResult findAncestryForFragmentParse(AstStatBlock* st
429417 {
430418 if (globFun->location .contains (cursorPos))
431419 {
432- if (FFlag::LuauPopulateSelfTypesInFragment )
420+ if (auto local = globFun-> func -> self )
433421 {
434- if (auto local = globFun->func ->self )
435- {
436- localStack.push_back (local);
437- localMap[local->name ] = local;
438- }
422+ localStack.push_back (local);
423+ localMap[local->name ] = local;
439424 }
440425
441426 for (AstLocal* loc : globFun->func ->args )
0 commit comments