Discussion:
[TxMt] callback.document.will-save order
Uğur Özyılmazel (vigo)
2018-11-29 07:24:20 UTC
Permalink
Hi. Let's say I have 3 commands and they all use `callback.document.will-save` as semantic class. What is the order of execution? or How can I set the order? In my experience, the last created command runs first. I'm not quite sure about it. I've been trying to improve my Python formatter bundle. I have some tasks to do in order. Couldn't figure out exactly the execution order of it.

Thanks

---
Uğur "vigo" Özyılmazel

https://github.com/vigo
https://gitbook.com/@vigo
http://ugur.ozyilmazel.com | @vigobronx
http://devpod.org | @podcastmaster
http://gelistiriciyiz.biz | @gelistiriciyiz
Allan Odgaard
2018-11-29 09:46:57 UTC
Permalink
Post by Uğur Özyılmazel (vigo)
Hi. Let's say I have 3 commands and they all use
`callback.document.will-save` as semantic class. What is the order of
execution? or How can I set the order?
In practice TextMate keeps all items in an ordered container indexed by
their semantic class.

So you should be able to add an alphanumeric suffix to the semantic
class to affect sorting, e.g.:

- `callback.document.will-save.1`
- `callback.document.will-save.2`
- `callback.document.will-save.3`

Can you let me know what the 3 callbacks each do? Using the semantic
class system for callbacks was a quick prototype that never evolved into
a proper system, but I still have an open issue about it, so it would be
good to add dependency requirement examples to this issue.
Uğur Özyılmazel (vigo)
2018-11-29 11:08:51 UTC
Permalink
Hi Allan, thanks for quick response. Well, here are my tasks:

before save the python document,

- run `isort` then (first)
- run `flake8` (second)

then do the save (textmate is handling this)

after save,

- run `flake8`
- run `pylint`

You can check the bundle here : https://github.com/vigo/textmate2-python-fmt

also; https://github.com/vigo/textmate2-python-fmt/blob/master/Support/python_helper.rb

currently I have 2 different commands, one is running on "will-save" other is running on "did-save". On "will-save" I'm calling a function which handles "black" and "isort" sequentially. I'm planning to seperate functions by using "will-save". I guess I can do it right now. or mine is already ok? Would be great if you can skim out the bundle...



---
Uğur "vigo" Özyılmazel

https://github.com/vigo
Post by Uğur Özyılmazel (vigo)
Hi. Let's say I have 3 commands and they all use `callback.document.will-save` as semantic class. What is the order of execution? or How can I set the order?
In practice TextMate keeps all items in an ordered container indexed by their semantic class.
callback.document.will-save.1
callback.document.will-save.2
callback.document.will-save.3
Can you let me know what the 3 callbacks each do? Using the semantic class system for callbacks was a quick prototype that never evolved into a proper system, but I still have an open issue about it, so it would be good to add dependency requirement examples to this issue.
_______________________________________________
textmate mailing list
https://lists.macromates.com/listinfo/textmate
Loading...