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

Highlight not working on multiples files #356

Closed
evandrocoan opened this issue Jun 27, 2016 · 5 comments
Closed

Highlight not working on multiples files #356

evandrocoan opened this issue Jun 27, 2016 · 5 comments

Comments

@evandrocoan
Copy link

evandrocoan commented Jun 27, 2016

The first file pointed as green on the below image is working fine, but on the second tab(the same file), is not highlighting properly. It only updates after it is switched to the first tab and switched back to it.

We should be able to see the brackets mark on the below image, but it is not show up properly only on the second tab, or third, forth, etc (if there were).

Error

@facelessuser
Copy link
Owner

I don't really understand. I use multiple files everyday, and I don't have a problem with BH highlighting. I feel like I'm missing something.

@evandrocoan
Copy link
Author

evandrocoan commented Jun 27, 2016

Note, they are the same file on each tab:

ok

notok

@facelessuser
Copy link
Owner

It appears you are using BracketHighlighter and you still have Sublime's default bracket highlighter enabled.

  1. The top one looks like BH is doing its thing.
  2. It looks like the built-in highlighter (not BH's) is showing in the other file. Notice that the underlines are thinner in the second and no icons.
  3. I am assuming you are talking about cloned files? I can only guess as this was not made clear. I did just try out cloning a file, and it appears the cloned view doesn't register selection events or even modified events. If Sublime won't create on_selection events and on_modified events in the clone, then BH can't do anything as you move the cursor around.
  4. But it does appear that on_activated events do get created in the clone which is why activating a different view, and then going back to the clone causes it to work.
  5. Also on demand commands seem to work (you can run from the command palette BracketHighlighter: Match Brackets (ignore threshold) and you can see it works.

BH works around the Sublime API. If Sublime limits the API in a cloned view, then there is nothing I can do because I need the API to make it work. I imagine Sublime is treating cloned views differently as it is constantly syncing it with the original.

@evandrocoan
Copy link
Author

evandrocoan commented Jun 27, 2016

Thank you very much for your promptness and work.

Answers:
  1. Yes, sorry for not make it clear.
  2. Yes, it is working fine using 'BracketHighlighter: Match Brackets (ignore threshold)'.

I understand, if the events 'on_selection' and 'on_modified' are not created, then it is impossible to BH do it thing. But may be could be some workaround, I cannot say for sure 'cause I do not know about the sublime API/programming. But I can give some thoughts:

(workaround) Update by 'polling' instead of 'interruption'

Could be registered an event to be called every 0.1 seconds and each time call the command palette 'BracketHighlighter: Match Brackets (ignore threshold)', then we would not need to relay on the sublime's 'on_modified' or 'on_selection' events.

On C language it would be an thread which run an while(true) sleeping 0.1 seconds every loop after call the command palette 'BracketHighlighter: Match Brackets (ignore threshold)'.

On scripting, where probably we do not have such freedom, the API could provide an event registering where we can create a repeating task to be called on specified intervals as 0.1 seconds.
Also, could be used/hooked another event which is as called as we need our event to be called, then after such event to proceeds, we can call ours the command palette 'BracketHighlighter: Match Brackets (ignore threshold)'.

Closing it

Hence if anything else can be done, we can close this thread or request to the sublime's team to provide one of the tools we need to implement the BH behavior on cloned views.

@facelessuser
Copy link
Owner

It's really not worth it to me to do an elaborate work around for cloned views. I'm afraid at this point in time I am passing on this.

Thank you for bringing this to my attention though. It is good to know.

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

2 participants