[syntax-coloring] Remove early exit from delta logic when there are no new highlighted tokens but are removed ones, and take account of the range of the mismatching token in the previous syntax map

We still need to adjust the affected range to the line boundaries and return all
tokens on the line when there are no new tokens, as the client will clear all
tokens on that line in its copy of the syntax map leaving the other tokens
unhighlighted. We also need to extend the affected range to include the ranges
of the mismatched tokens from the previous syntaxmap, so their highlighting will
be cleared.

Also add more comments to better document the new syntax map structure and
behaviour.
This commit is contained in:
Nathan Hawes
2017-06-16 11:50:32 -07:00
parent 04674ffd9c
commit 3791e12895
6 changed files with 292 additions and 71 deletions

View File

@@ -133,8 +133,20 @@
// After replacing a space with a space
// CHECK: {{^}}{
// CHECK-NEXT: key.diagnostic_stage: source.diagnostic.stage.swift.parse
// CHECK-NEXT: key.offset: 57,
// CHECK-NEXT: key.length: 15,
// CHECK-NEXT: key.diagnostic_stage: source.diagnostic.stage.swift.parse,
// CHECK-NEXT: key.syntaxmap: [
// CHECK-NEXT: {
// CHECK-NEXT: key.kind: source.lang.swift.syntaxtype.keyword,
// CHECK-NEXT: key.offset: 57,
// CHECK-NEXT: key.length: 6
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: key.kind: source.lang.swift.syntaxtype.identifier,
// CHECK-NEXT: key.offset: 64,
// CHECK-NEXT: key.length: 5
// CHECK-NEXT: }
// CHECK-NEXT: ],
// After adding code at the end of the file