On 15 Dec 2019, at 14:26, f1nnix <ilya@rusanen.co.uk> wrote:

I've started to work on rough implementation:
<https://github.com/f1nnix/LSP.tmbundle>  . Completion already ~works.

It would be nice, if someone could take a look at my questions about
Textmate internal bundle mechanism. Thanks.

* To run a command in the background, you need to create a subprocess and close stdout and stderr. See [1][2] for more details.

* It’s not possible to highlight arbitrary symbols.

* Regarding diagnostic reporting, It’s not possible highlight symbols. But it’s possible to show an icon in the gutter on a specific line. When the user clicks on the icon a message will be shown. Run “mate —help” and see the “mark” related flags. It would be something like: “mate foo.rb —line 3 —set-mark error:'missing symbol’”

* The callback for open document is called "callback.document.did-open”. Set that as the semantic class of a bundle command

* Regarding your last question: "Is there a way to run a command on file opening?”. I guess it’s the same answer as the previous question. I don’t think there’s a difference between opening a document or a file.

This is a list of semantic class callbacks that I’ve managed to collect from different places:

* callback.application.did-activate
* callback.application.did-deactivate
* callback.document.binary-export
* callback.document.binary-import
* callback.document.did-change-scm-status
* callback.document.did-open
* callback.document.did-reload
* callback.document.did-save
* callback.document.export
* callback.document.import
* callback.document.will-reload
* callback.document.will-save
* callback.double-click
* callback.file-browser.action-menu
* callback.mouse-click (old)
* callback.single-click
* callback.triple-click

For mouse click callbacks, the following modifiers can be used:

* dyn.modifier.shift
* dyn.modifier.control
* dyn.modifier.option
* dyn.modifier.command

The modifiers are set in "Scope Selector".

[1] https://wiki.macromates.com/HowTo/RunCommandInBackground
[2] https://github.com/textmate/d.tmbundle/blob/master/Support/lib/text_mate/process.rb

/Jacob Carlborg