Open mechatroner opened 4 years ago
I have a similar issue when generating syntaxes for JS Custom's unit tests. I plan to address this by polling sublime.list_syntaxes()
and running the tests when the generated syntax is included in the list. I haven't tried this yet, but I think you should be able to do something similar.
@Thom1729 Thank you for the suggestion.
I ended up using sublime.find_resources()
which is what list_syntaxes()
uses under the hood.
Also between the polling sublime.find_resources()
I am waiting with sublime.set_timeout()
. If I try to wait with time.sleep()
instead, it doesn't work for some reason.
time.sleep()
will block.
Description
Hello, I am developing and supporting the rainbow_csv package. Recently I added an option to autogenerate syntax files when users select a text of the CSV separator, so it could be not a single character but a sequence of characters. My extension generates the syntax file and writes it to "Packages/User" folder e.g. Packages/User/Rainbow_CSV_hex_657665_Simple.sublime-syntax You can see the code here: https://github.com/mechatroner/sublime_rainbow_csv/blob/421a305569ea372f63fe6a05e6c4676088431850/main.py#L426
The problem is, when my extension calls
view.set_syntax_file(rainbow_syntax_file)
immediately after generating it, Sublime Text shows this error:But, if I click OK, Sublime correctly applies the newly-generated syntax file as if no error had occurred.
I actually found a workaround for this problem, If I set the syntax file with 2.5 seconds delay after generating it, everything seems to be working as expected (no error is getting shown). Although I have already published rainbow_csv with this workaround I would prefer to find out what is the root cause of this and it would be great if you could fix this.
Steps to reproduce
Expected behavior
Same as above but without step 4.
Actual behavior
Sublime Text 3 shows an error in step 4.
Environment