AntlrVSIX icon indicating copy to clipboard operation
AntlrVSIX copied to clipboard

Significant typing lag in grammar files and wrong colorization

Open RecorderMuninn opened this issue 5 years ago • 1 comments

I'm working on a simple lexer grammar (~50 lines). When I try to type with AntlrVSIX 8.2 installed, there's a delay of several seconds per character, and the IDE repeatedly displays a "waiting for an editor command to finish" popup. After doing this for a little while, Visual Studio eventually freezes up entirely and has to be killed from the Task Manager.

There's also a couple of syntax coloring problems:

  1. A single-line comment token ("//") anywhere causes the entire rest of the file to be colored as a comment.
  2. I have this fragment in my grammar, and AntlrVSIX detects the double quote in the character set as the start of a string. fragment StringChar : ~["\r\n] ;

Here's the grammar file for reference: lexer.g4.txt

RecorderMuninn avatar Dec 02 '20 20:12 RecorderMuninn

Thanks for the information. (1) Yes, it looks like the Antlr4 grammar--from the grammars-v4 Antlr4 repository!--is incorrect. Your grammar is accepted by the Antlr tool, but not with a parse generated from the "official" Antlr4 grammar. That's bad! (2) The slowdown is significantly worse in VS2019 than in VSCode because VS2019 does not implement language server semantic highlighting, whereas VSCode does. I have an implementation for semantic highlighting for VS2019, but it's not great. I think each type causes a reparse and the colorization tags for the grammar to be resent. I'll work on improving this in release 8.4, after I get the next release (8.3) done this week. --Ken

kaby76 avatar Dec 02 '20 20:12 kaby76