@@ -179,33 +179,22 @@ internal ITextPointer GetNextSpellingErrorPosition(ITextPointer position, Logica
179179 // re-evaluating the error from scratch.
180180 internal List < string > GetSuggestionsForError ( SpellingError error )
181181 {
182- ITextPointer contextStart ;
183- ITextPointer contextEnd ;
184- ITextPointer contentStart ;
185- ITextPointer contentEnd ;
186- TextMap textMap ;
187-
188- List < string > suggestions = new ( ) ;
189-
190182 //
191183 // IMPORTANT!!
192184 //
193185 // This logic here must match ScanRange, or else we might not
194186 // calculate the exact same error. Keep the two methods in sync!
195187 //
196188
197- XmlLanguage language ;
198- CultureInfo culture = GetCurrentCultureAndLanguage ( error . Start , out language ) ;
199- if ( culture == null || ! _spellerInterop . CanSpellCheck ( culture ) )
200- {
201- // Return an empty list.
202- }
203- else
189+ List < string > suggestions = new ( ) ;
190+ CultureInfo culture = GetCurrentCultureAndLanguage ( error . Start , out XmlLanguage language ) ;
191+
192+ if ( culture is not null || _spellerInterop . CanSpellCheck ( culture ) )
204193 {
205- ExpandToWordBreakAndContext ( error . Start , LogicalDirection . Backward , language , out contentStart , out contextStart ) ;
206- ExpandToWordBreakAndContext ( error . End , LogicalDirection . Forward , language , out contentEnd , out contextEnd ) ;
194+ ExpandToWordBreakAndContext ( error . Start , LogicalDirection . Backward , language , out ITextPointer contentStart , out ITextPointer contextStart ) ;
195+ ExpandToWordBreakAndContext ( error . End , LogicalDirection . Forward , language , out ITextPointer contentEnd , out ITextPointer contextEnd ) ;
207196
208- textMap = new TextMap ( contextStart , contextEnd , contentStart , contentEnd ) ;
197+ TextMap textMap = new ( contextStart , contextEnd , contentStart , contentEnd ) ;
209198
210199 SetCulture ( culture ) ;
211200
0 commit comments