Skip to content

Commit 93841b5

Browse files
authored
Ensure UserPreferences return is never nil (microsoft#2395)
1 parent 14b3382 commit 93841b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/project/snapshot.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ func (s *Snapshot) GetECMALineInfo(fileName string) *sourcemap.ECMALineInfo {
105105
}
106106

107107
func (s *Snapshot) UserPreferences() *lsutil.UserPreferences {
108-
return s.config.tsUserPreferences
108+
if s.config.tsUserPreferences != nil {
109+
return s.config.tsUserPreferences
110+
}
111+
return lsutil.NewDefaultUserPreferences()
109112
}
110113

111114
func (s *Snapshot) FormatOptions() *format.FormatCodeSettings {

0 commit comments

Comments
 (0)