diff --git a/src/harness/unittests/services/colorization.ts b/src/harness/unittests/services/colorization.ts
index fd7d932885a..3fed9ec6164 100644
--- a/src/harness/unittests/services/colorization.ts
+++ b/src/harness/unittests/services/colorization.ts
@@ -424,6 +424,50 @@ class D { }\r\n\
comment("=======\r\nclass D { }\r\n"),
comment(">>>>>>> Branch - a"),
finalEndOfLineState(ts.EndOfLineState.None));
+
+ testLexicalClassification(
+"class C {\r\n\
+<<<<<<< HEAD\r\n\
+ v = 1;\r\n\
+||||||| merged common ancestors\r\n\
+ v = 3;\r\n\
+=======\r\n\
+ v = 2;\r\n\
+>>>>>>> Branch - a\r\n\
+}",
+ ts.EndOfLineState.None,
+ keyword("class"),
+ identifier("C"),
+ punctuation("{"),
+ comment("<<<<<<< HEAD"),
+ identifier("v"),
+ operator("="),
+ numberLiteral("1"),
+ punctuation(";"),
+ comment("||||||| merged common ancestors\r\n v = 3;\r\n"),
+ comment("=======\r\n v = 2;\r\n"),
+ comment(">>>>>>> Branch - a"),
+ punctuation("}"),
+ finalEndOfLineState(ts.EndOfLineState.None));
+
+ testLexicalClassification(
+"<<<<<<< HEAD\r\n\
+class C { }\r\n\
+||||||| merged common ancestors\r\n\
+class E { }\r\n\
+=======\r\n\
+class D { }\r\n\
+>>>>>>> Branch - a\r\n",
+ ts.EndOfLineState.None,
+ comment("<<<<<<< HEAD"),
+ keyword("class"),
+ identifier("C"),
+ punctuation("{"),
+ punctuation("}"),
+ comment("||||||| merged common ancestors\r\nclass E { }\r\n"),
+ comment("=======\r\nclass D { }\r\n"),
+ comment(">>>>>>> Branch - a"),
+ finalEndOfLineState(ts.EndOfLineState.None));
});
it("'of' keyword", function () {
diff --git a/tests/baselines/reference/conflictMarkerDiff3Trivia1.errors.txt b/tests/baselines/reference/conflictMarkerDiff3Trivia1.errors.txt
new file mode 100644
index 00000000000..b38e4e189ee
--- /dev/null
+++ b/tests/baselines/reference/conflictMarkerDiff3Trivia1.errors.txt
@@ -0,0 +1,24 @@
+tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(2,1): error TS1185: Merge conflict marker encountered.
+tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(4,1): error TS1185: Merge conflict marker encountered.
+tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(6,1): error TS1185: Merge conflict marker encountered.
+tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(8,1): error TS1185: Merge conflict marker encountered.
+
+
+==== tests/cases/compiler/conflictMarkerDiff3Trivia1.ts (4 errors) ====
+ class C {
+ <<<<<<< HEAD
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+ v = 1;
+ ||||||| merged common ancestors
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+ v = 3;
+ =======
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+ v = 2;
+ >>>>>>> Branch-a
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/conflictMarkerDiff3Trivia1.js b/tests/baselines/reference/conflictMarkerDiff3Trivia1.js
new file mode 100644
index 00000000000..86cccd44e18
--- /dev/null
+++ b/tests/baselines/reference/conflictMarkerDiff3Trivia1.js
@@ -0,0 +1,18 @@
+//// [conflictMarkerDiff3Trivia1.ts]
+class C {
+<<<<<<< HEAD
+ v = 1;
+||||||| merged common ancestors
+ v = 3;
+=======
+ v = 2;
+>>>>>>> Branch-a
+}
+
+//// [conflictMarkerDiff3Trivia1.js]
+var C = (function () {
+ function C() {
+ this.v = 1;
+ }
+ return C;
+}());
diff --git a/tests/baselines/reference/conflictMarkerDiff3Trivia2.errors.txt b/tests/baselines/reference/conflictMarkerDiff3Trivia2.errors.txt
new file mode 100644
index 00000000000..2e29826c43a
--- /dev/null
+++ b/tests/baselines/reference/conflictMarkerDiff3Trivia2.errors.txt
@@ -0,0 +1,34 @@
+tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(3,1): error TS1185: Merge conflict marker encountered.
+tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(4,6): error TS2304: Cannot find name 'a'.
+tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(6,1): error TS1185: Merge conflict marker encountered.
+tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(9,1): error TS1185: Merge conflict marker encountered.
+tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(12,1): error TS1185: Merge conflict marker encountered.
+
+
+==== tests/cases/compiler/conflictMarkerDiff3Trivia2.ts (5 errors) ====
+ class C {
+ foo() {
+ <<<<<<< B
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+ a();
+ ~
+!!! error TS2304: Cannot find name 'a'.
+ }
+ ||||||| merged common ancestors
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+ c();
+ }
+ =======
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+ b();
+ }
+ >>>>>>> A
+ ~~~~~~~
+!!! error TS1185: Merge conflict marker encountered.
+
+ public bar() { }
+ }
+
\ No newline at end of file
diff --git a/tests/baselines/reference/conflictMarkerDiff3Trivia2.js b/tests/baselines/reference/conflictMarkerDiff3Trivia2.js
new file mode 100644
index 00000000000..61a2273019b
--- /dev/null
+++ b/tests/baselines/reference/conflictMarkerDiff3Trivia2.js
@@ -0,0 +1,28 @@
+//// [conflictMarkerDiff3Trivia2.ts]
+class C {
+ foo() {
+<<<<<<< B
+ a();
+ }
+||||||| merged common ancestors
+ c();
+ }
+=======
+ b();
+ }
+>>>>>>> A
+
+ public bar() { }
+}
+
+
+//// [conflictMarkerDiff3Trivia2.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype.foo = function () {
+ a();
+ };
+ C.prototype.bar = function () { };
+ return C;
+}());
diff --git a/tests/cases/compiler/conflictMarkerDiff3Trivia1.ts b/tests/cases/compiler/conflictMarkerDiff3Trivia1.ts
new file mode 100644
index 00000000000..072cc4b9683
--- /dev/null
+++ b/tests/cases/compiler/conflictMarkerDiff3Trivia1.ts
@@ -0,0 +1,9 @@
+class C {
+<<<<<<< HEAD
+ v = 1;
+||||||| merged common ancestors
+ v = 3;
+=======
+ v = 2;
+>>>>>>> Branch-a
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/conflictMarkerDiff3Trivia2.ts b/tests/cases/compiler/conflictMarkerDiff3Trivia2.ts
new file mode 100644
index 00000000000..023d425cd4d
--- /dev/null
+++ b/tests/cases/compiler/conflictMarkerDiff3Trivia2.ts
@@ -0,0 +1,15 @@
+class C {
+ foo() {
+<<<<<<< B
+ a();
+ }
+||||||| merged common ancestors
+ c();
+ }
+=======
+ b();
+ }
+>>>>>>> A
+
+ public bar() { }
+}
diff --git a/tests/cases/fourslash/formatConflictDiff3Marker1.ts b/tests/cases/fourslash/formatConflictDiff3Marker1.ts
new file mode 100644
index 00000000000..f6492a6f60c
--- /dev/null
+++ b/tests/cases/fourslash/formatConflictDiff3Marker1.ts
@@ -0,0 +1,22 @@
+///
+
+////class C {
+////<<<<<<< HEAD
+////v = 1;
+////||||||| merged common ancestors
+////v = 3;
+////=======
+////v = 2;
+////>>>>>>> Branch - a
+////}
+
+format.document();
+verify.currentFileContentIs("class C {\r\n\
+<<<<<<< HEAD\r\n\
+ v = 1;\r\n\
+||||||| merged common ancestors\r\n\
+v = 3;\r\n\
+=======\r\n\
+v = 2;\r\n\
+>>>>>>> Branch - a\r\n\
+}");
\ No newline at end of file
diff --git a/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers1.ts b/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers1.ts
new file mode 100644
index 00000000000..669705307a9
--- /dev/null
+++ b/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers1.ts
@@ -0,0 +1,23 @@
+///
+
+////class C {
+////<<<<<<< HEAD
+//// v = 1;
+////||||||| merged common ancestors
+//// v = 3;
+////=======
+//// v = 2;
+////>>>>>>> Branch - a
+////}
+
+const c = classification;
+verify.syntacticClassificationsAre(
+ c.keyword("class"), c.className("C"), c.punctuation("{"),
+ c.comment("<<<<<<< HEAD"),
+ c.identifier("v"), c.operator("="), c.numericLiteral("1"), c.punctuation(";"),
+ c.comment("||||||| merged common ancestors"),
+ c.identifier("v"), c.punctuation("="), c.numericLiteral("3"), c.punctuation(";"),
+ c.comment("======="),
+ c.identifier("v"), c.punctuation("="), c.numericLiteral("2"), c.punctuation(";"),
+ c.comment(">>>>>>> Branch - a"),
+ c.punctuation("}"));
\ No newline at end of file
diff --git a/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers2.ts b/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers2.ts
new file mode 100644
index 00000000000..17144397184
--- /dev/null
+++ b/tests/cases/fourslash/syntacticClassificationsConflictDiff3Markers2.ts
@@ -0,0 +1,19 @@
+///
+
+////<<<<<<< HEAD
+////class C { }
+////||||||| merged common ancestors
+////class E { }
+////=======
+////class D { }
+////>>>>>>> Branch - a
+
+const c = classification;
+verify.syntacticClassificationsAre(
+ c.comment("<<<<<<< HEAD"),
+ c.keyword("class"), c.className("C"), c.punctuation("{"), c.punctuation("}"),
+ c.comment("||||||| merged common ancestors"),
+ c.keyword("class"), c.identifier("E"), c.punctuation("{"), c.punctuation("}"),
+ c.comment("======="),
+ c.keyword("class"), c.identifier("D"), c.punctuation("{"), c.punctuation("}"),
+ c.comment(">>>>>>> Branch - a"));
\ No newline at end of file