Sublime Forum

Incorrect diff highlighting

#1

I’m using the latest version of sublime merge and when I’m viewing diffs I get a lot of extra highlighting that shouldn’t be highlighted.

As you can see from another git client the only change is NSView to DirectoryView, but Merge seems to include additional highlighting for no reason. I really like merge, but this is making it unusable for me.

0 Likes

#2

The red background looks like invalid highlighting caused by the syntax definition. Which language is it?

2 Likes

#3

The language is Swift

0 Likes

#4

Do you see the same errors in Sublime Text for that file?

0 Likes

#5

No, I don’t see any issues in Sublime Text, but I think @deathaxe is correct because I don’t see this issue for other file types. Is it possible to turn off syntax highlighting?

0 Likes

#6

You can Menu > Edit Settings… to open the Preferences.sublime-settings and add

	"ignored_packages":
	[
		"Swift"
	],

SM and ST share many settings.

Nevertheless it’s a bit curious for SM to fail with a file which works in ST as both use the same engine.

2 Likes

#7

Thanks for sharing this article. it’s helped to me

0 Likes

#8

@corysullivan, few questions:

  1. Is this Swift package the one you had installed in Sublime Text for Swift support?
  2. Is whitespace ignored? Does the error go away if you toggle ignore whitespace?
  3. Was there a diff block above the one in the image that included changes in or around a string?

@deathaxe, the Swift package is 3 years old & still uses .tmLanguage files. The only invalid scope in the syntax is for illegal characters within a string. Since every built-in language uses .sublime-syntax, I wonder if SM doesn’t handle syntax highlighting with added/removed lines with the old-school structures. (at the moment, I’m guessing SM is not running the syntax highlighter for each version of the file)

0 Likes

#9
  1. Is this Swift package the one you had installed in Sublime Text for Swift support?

yes, that is the package I was using, however, I have since uninstalled it and I still see the problem.

  1. Is whitespace ignored? Does the error go away if you toggle ignore whitespace?

Do you mean whitespace visibility? Because I tried changing that and it has no effect.

In that case, no there was not. But I see this red highlighting everywhere, it’s not just related to the diff view. If a select a file from the view tree, it still shows red.

0 Likes