Skip to content

Commit c00d1e6

Browse files
committed
Prevent filespace cache from being reset
1 parent 86d309c commit c00d1e6

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Core/Sources/Service/Workspace.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@ extension Workspace {
118118
filespaces[fileURL] = filespace
119119
}
120120

121-
filespace.uti = editor.uti
122-
filespace.tabSize = editor.tabSize
123-
filespace.indentSize = editor.indentSize
124-
filespace.usesTabsForIndentation = editor.usesTabsForIndentation
121+
if !editor.uti.isEmpty {
122+
filespace.uti = editor.uti
123+
filespace.tabSize = editor.tabSize
124+
filespace.indentSize = editor.indentSize
125+
filespace.usesTabsForIndentation = editor.usesTabsForIndentation
126+
}
125127

126128
let snapshot = Filespace.Snapshot(
127129
linesHash: editor.lines.hashValue,
@@ -174,7 +176,7 @@ extension Workspace {
174176
cancelInFlightRealtimeSuggestionRequests()
175177
lastTriggerDate = Environment.now()
176178

177-
if let editor {
179+
if let editor, !editor.uti.isEmpty {
178180
filespaces[fileURL]?.uti = editor.uti
179181
filespaces[fileURL]?.tabSize = editor.tabSize
180182
filespaces[fileURL]?.indentSize = editor.indentSize
@@ -195,7 +197,7 @@ extension Workspace {
195197
filespace.suggestionIndex < filespace.suggestions.endIndex
196198
else { return nil }
197199

198-
if let editor {
200+
if let editor, !editor.uti.isEmpty {
199201
filespaces[fileURL]?.uti = editor.uti
200202
filespaces[fileURL]?.tabSize = editor.tabSize
201203
filespaces[fileURL]?.indentSize = editor.indentSize

0 commit comments

Comments
 (0)