Syntax highlighting using JS
-
wrote on 22 Jun 2023, 12:48 last edited by
Hello. I need to implement syntax highlighting using Qt and JS. I did it on my own, it works, but when a large amount of information comes into the lexer (10k lines of text), the lexer works slower (about 10 seconds on my machine) and the application crashes after I try to enter something new in the input field.
Could someone tell me how it would be better to do this and the possible mistakes that I made, which leads to the crash of the program. I posted the project code on Github. It can be found at link.
I know that there are many projects that would allow me not to write anything in JS, but unfortunately I could not find anything that would not require a lot of effort during installation (syntax highlighting from KDE and QScintilla were considered). -
wrote on 23 Jun 2023, 07:24 last edited by
Qt Creator takes a long time for highlighting 10k lines as well. The only trick they seem to use is that it is done in a separate thread, so that the GUI initially does not freeze. Also, they must keep track of changes such that they don't have to recompute the entire highlight after every keypress. But highlighting (at least of C++) is not very fast inside Qt Creator.
1/2