Frequently, VSCode garbles the syntax highlighting in my code:
When this happens, other features like code completion also fail (e.g., it will not give me a context menu after I type a period after an object, but it will give me such a menu if I type a period in a comment; it doesn’t provide hints to the arguments of a function, etc.). It also handles tabs/spaces incorrectly and throws errors about using tabs/spaces inconsistently.
Typically if I wait long enough (a few minutes) it will correct itself, then start acting up again in a few minutes.
What might be causing this, and how can I fix it?