Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting with text properties is slow and highlighting incorrectly #485

Closed
PaddiM8 opened this issue Jul 10, 2019 · 11 comments
Closed

Comments

@PaddiM8
Copy link

PaddiM8 commented Jul 10, 2019

I'm on Vim 8.1 and enabled highlighting using text properties.

This is the default configuration with extension method name and method name disabled. With them enabled, the now white parts are blue. I've tried various configurations and I always notice inconsistencies! Often identical lines of code are highlighted differently. I also noticed it's quite slow, it takes a few minutes before it highlights it if I don't do :OmniSharpHighlightTypes (then it takes a few seconds). I know this is a fairly new feature, so it's not too unexpected.

@nickspoons
Copy link
Member

Highlighting, as all OmniSharp-vim actions, need the server to be loaded before they work. After the server is loaded they will work, but the first command can still take time as some parts of the server are lazy loaded as far as I can tell.

So if you just open a .cs file and don't do anything else, it won't be highlighted, as the highlighting request is made before the server is loaded. I am currently working on a feature to replay requests made before the server is loaded but it currently blocked since the is no reliable way of detecting when OmniSharp-roslyn is completely loaded. See https://github.com/nickspoons/omnisharp-vim/tree/feature-replay-requests-on-load and OmniSharp/omnisharp-roslyn#1521

Once the server is loaded, highlighting is updated after certain events, such as exiting insert mode. After the first request this is very fast (in my experience), a fraction of a second.

@nickspoons
Copy link
Member

I'm not sure about the inconsistent highlighting, I've seen it before too, it seems to sometimes happen with early highlighting requests. Subsequent requests always seem to be correct. There's not much we can do about it here, all we can do is apply the highlights that OmniSharp-roslyn returns.

@PaddiM8
Copy link
Author

PaddiM8 commented Jul 10, 2019

@nickspoons Hm, the thing is, syntax highlighting seems to be loading long after the server is loaded. Autocompletion and all that start to work after a few seconds, but syntax highlighting can take minutes unless I trigger it manually. Well, damn.

@nickspoons
Copy link
Member

nickspoons commented Jul 10, 2019

Is it really taking minutes, or is it just not being requested? There's no difference between you triggering it manually, and one of the other events which trigger it, i.e. BufEnter and InsertLeave. So my point with my earlier comment is that if you just open vim to a .cs file there won't be highlighting, as the server is not fully loaded. However once the server is loaded fully then highlighting is fast.

Also make sure you have let g:OmniSharp_highlight_types = 2. If g:OmniSharp_highlight_types is 1 then highlighting is only automatically performed on BufEnter, not InsertLeave.

@nickspoons
Copy link
Member

nickspoons commented Aug 1, 2019

@PaddiM8 the replay-requests-on-load has been merged now so if you have g:OmniSharp_highlight_types = 2 you should see highlighting soon after the server is loaded.

As for the inconsistent highlighting, there is definitely something wrong with the results we get back from OmniSharp-roslyn, I have opened issue OmniSharp/omnisharp-roslyn#1576 over there.

@DasOhmoff
Copy link

"I'm not sure about the inconsistent highlighting, I've seen it before too, it seems to sometimes happen with early highlighting requests. Subsequent requests always seem to be correct".

How can I make subsequent requests? My highlighting is always not 100% corrent, even on subsequent requests (if OmniSharp makes them automatically). How can I fix this?

@nickspoons
Copy link
Member

@DasOhmoff you're quoting an old comment. As later comments say, and the O#roslyn issue you've already commented on, the results we get back from O#roslyn are inconsistent, we can't do more about it on this side.

@DasOhmoff
Copy link

Ah I see, ok thank you

@nickspoons
Copy link
Member

Thanks for getting the highlighting fixed in OmniSharp-roslyn, @DasOhmoff, much appreciated!

@DasOhmoff
Copy link

@nickspoons, I think you mistook me for someone else :D .
I think you were trying to thank "DasCleverle", my name is "DasOhmoff".
Anyway, the real true heroes here are YOU, "DasCleverle", and the other guys that worked for this feature. THANK YOU VERY MUCH <3

@nickspoons
Copy link
Member

Ah ha, so I did! I'll go and thank @DasCleverle over in the other repo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants