intellij-plugin-v4 icon indicating copy to clipboard operation
intellij-plugin-v4 copied to clipboard

switching from lexer to parser in a split grammar regenerates `.tokens` no matter what

Open parrt opened this issue 3 years ago • 2 comments

This could slow down switching between tabs so we should check see if the .tokens file is older than the lexer .g4 file in `RunANTLROnGrammarFile.run() on line 85.

	// is lexer file? gen .tokens file no matter what as tokens might have changed;
	// a parser that feeds off of that file will need to see the changes.
	if ( previewState.g==null && previewState.lg!=null) {
		Grammar g = previewState.lg;
		String language = g.getOptionString(ANTLRv4GrammarProperties.PROP_LANGUAGE);
		Tool tool = ParsingUtils.createANTLRToolForLoadingGrammars(getGrammarProperties(project, grammarFile));
		CodeGenerator gen = CodeGenerator.create(tool, g, language);
		gen.writeVocabFile();
	}

parrt avatar Apr 24 '22 16:04 parrt

I have a fix for this one, but still figuring out how to properly test it in a headless environment

kjarrio avatar Aug 07 '22 04:08 kjarrio

Should be fixed in #577

kjarrio avatar Aug 09 '22 02:08 kjarrio

Fixed by https://github.com/antlr/intellij-plugin-v4/pull/577

parrt avatar Aug 13 '22 22:08 parrt