nelsam / vidar

vidar is a highly experimental Go editor, written in Go, using gxui
The Unlicense
50 stars 7 forks source link

plugin/gosyntax: lock access to the syntax highlighter #148

Closed nelsam closed 5 years ago

nelsam commented 5 years ago

As per #147, we were seeing occasional concurrent map writes and reads. This is the quick, obvious fix for the issue, although we should take another look after the fix is confirmed to see if we really need the same syntax parser in both goroutines. On the one hand, we probably don't want to assume that all of the code will be re-parsed from scratch; on the other hand, we're not passing along any information about which spans could have changed.

Resolves #147

Type

Tests

I have tested locally against:

I have included automated tests: