gojimmypi / VerilogLanguageExtension

Verilog Language Extension for Visual Studio
https://marketplace.visualstudio.com/items?itemName=gojimmypi.gojimmypi-verilog-language-extension
MIT License
18 stars 3 forks source link

single quotes in constants sometimes not properly ending #21

Open gojimmypi opened 4 years ago

gojimmypi commented 4 years ago

see picorv32.v line 532

note missing colorization after single quote:

image

Risavk commented 4 years ago

Looks like could be caused by my fix ? Currently i don't have possibility to check.

Edit: Hm. Was able to test - and after removing my commit it still doesn't work properly - but on your screenshot from issue 14 it looks as it should be highlighted properly ... Strange if you ask me :)

Would be fun to mock editor object and write some test cases to verify syntax highlighting :)

gojimmypi commented 4 years ago

I'm pretty sure your fix did not break that. yes, there are a variety of "strange things" that happen. I had a chance over the weekend (such as #16) to find and fix a few more. Currently I am trying to figure out why typing in a big file such as picorv32.v causes sporadic incorrect highlighting. Perhaps this is related to my threaded process not completing in time. Indeed some test cases would be awesome!

If you are actively working on this, I can check in my recent code.

I appreciate you looking at this. Cheers

Risavk commented 4 years ago

Got too much work stuff for now...

But, just for fun - try to comment out this line, just for fun... : https://github.com/gojimmypi/VerilogLanguageExtension/blob/057249c9a33ca0b37be6001d51dc68c3d4d27150/VerilogToken/VerilogTokenTagger.cs#L143

I tested your code with profiler and found, that this line consumes huuuge amount of resources/time.

With your existing code, open big verilog file - more then 2000 lines. Try to scroll it near end. It lags as hell. Then try to comment this line. I know, it will mess highlightning, but look at responsivness now. Scanning whole file, and calling CommentHelper for each line from the beginning, for EACH line step when scrolling is very, very time consuming...

As i remember about 90% time was just for this method.

I didn't found good solution yet (but got "some" solution). Eg. "windowed" scrolling, but it can mess things up too :)

gojimmypi commented 4 years ago

ya, I hear you on the "too much work". after a week of programming at the day job, here I am doing some relaxing coding on the weekend. ;)

I'm revisiting the performance issues today. when I first created this extension (and the gcode one)... I didn't know anything at all about extensions. it's still quite the learning opportunity.

One big problem is the re-parsing gets called way more often than needed... and rebuilds all the tags. it is particularly interesting for special characters like * and /. Do a "goto line" from the end back to the beginning, type a / in just the right spot, and the entire file is now a comment. But type a space... nothing. I need to better detect when the attributes actually change, and when perhaps they just need a little attention. Minimize the full reparsing.

you're right about performance on big files. I need to open a new issue on that and get serious about really fixing this.

gojimmypi commented 4 years ago

@Risavk heads up I've pushed all my latest code to development-interim branch: Some performance improvements, but nearly as much as I'd like. Still too much time spent re-parsing needlessly.

Handling of * and / has been improved.

Do you have any experience with callbacks? See https://github.com/gojimmypi/VerilogLanguageExtension/issues/23#issuecomment-623129817