Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit d146494

Browse files
committed
Don't add a byte order mark to editor contents.
This was causing #1137; it was obviously added for a reason in 6b81f3f but I can no longer reproduce VS erroneously signalling a file as changed if we don't add the BOM. Maybe we handle this elsewhere now. Fixes #1137.
1 parent 49ba6cf commit d146494

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ public IEnumerable<ITagSpan<InlineCommentTag>> GetTags(NormalizedSnapshotSpanCol
157157

158158
Task<byte[]> IEditorContentSource.GetContent()
159159
{
160-
return Task.FromResult(GetContents(buffer.CurrentSnapshot));
160+
var text = buffer.CurrentSnapshot.GetText();
161+
var bytes = document.Encoding.GetBytes(text);
162+
return Task.FromResult(bytes);
161163
}
162164

163165
void Initialize()
@@ -279,22 +281,6 @@ void Buffer_Changed(object sender, TextContentChangedEventArgs e)
279281
}
280282
}
281283

282-
byte[] GetContents(ITextSnapshot snapshot)
283-
{
284-
var currentText = snapshot.GetText();
285-
286-
var content = document.Encoding.GetBytes(currentText);
287-
288-
var preamble = document.Encoding.GetPreamble();
289-
if (preamble.Length == 0) return content;
290-
291-
var completeContent = new byte[preamble.Length + content.Length];
292-
Buffer.BlockCopy(preamble, 0, completeContent, 0, preamble.Length);
293-
Buffer.BlockCopy(content, 0, completeContent, preamble.Length, content.Length);
294-
295-
return completeContent;
296-
}
297-
298284
async Task Rebuild(ITextSnapshot snapshot)
299285
{
300286
if (buffer.CurrentSnapshot == snapshot && session != null)

0 commit comments

Comments
 (0)