Is it possible to monitor syntax changes due to view.set_syntax_file(syntaxFile)
in another plugin?
Just tried all event listener and it looked like none of them captured it.
Monitor syntax changes made by other plugins?
jfcherng
#1
0 Likes
Change language = lost focus = annoying behavior
kingkeith
#2
I believe not, you have to hope the plugin developer chose to use the set_file_type
command or beg/bribe them to change it unfortunately…
btw, set_syntax_file
is depreciated by assign_syntax
these days
0 Likes
kingkeith
#3
Actually, maybe it is worth trying view.settings().add_on_change('syntax', your_on_change_callback_here)
0 Likes
FichteFoll
#5
add_on_change()
should work, yes, but the string you pass in the first argument is not supposed to be the identifier of the setting but instead a (potentially) unique identifier that you can use later to un-register the listener.
0 Likes
kingkeith
#6
from uuid import uuid4 as guid
unique_key = str(guid())
view.settings().add_on_change(unique_key, your_on_change_callback_here)
probably it would make sense to manually track the syntax
value then to determine when it changes, as opposed to when a value for a different key is changed in the view’s settings.
0 Likes