Hi,
This is new territory for me, so I just wanted to know if there’s LSP support in TextMate 2?
Best, Farhan
Hi, I really like the thought of having Language Server Protocol support in Textmate 2. Textmate would clearly benefit by getting first class code completion, code navigation, documentation view and all the other LSP goodness. Are there any plans for adding LSP support? Might this be something that should be implemented as a bundle or is it something that ships with the App itself? VSCode, Vim, Emacs, Sublime, Atom and other Editors now offer support or have plugins for LSP support. Would it be feasible for TM2 too?
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
I second that ! This would be phenomenal. But, it would probably require overhauling some of the completion UI to support more of what is available.
On Jun 25, 2018, at 17:33, Bijan b.rahnema@me.com wrote:
Hi, I really like the thought of having Language Server Protocol support in Textmate 2. Textmate would clearly benefit by getting first class code completion, code navigation, documentation view and all the other LSP goodness. Are there any plans for adding LSP support? Might this be something that should be implemented as a bundle or is it something that ships with the App itself? VSCode, Vim, Emacs, Sublime, Atom and other Editors now offer support or have plugins for LSP support. Would it be feasible for TM2 too?
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 25 Jun 2018, at 15:33, Bijan wrote:
Are there any plans for adding LSP support? Might this be something that should be implemented as a bundle or is it something that ships with the App itself?
It should probably be native.
As for plans; can’t really answer that before it’s at least halfway implemented :)
I am very interested in this (for completion, in particular). Do you have thoughts or pointers if I wanted to take a crack, myself?
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
On 15 Dec 2018, at 01:39, jrk katokop1@gmail.com wrote:
I am very interested in this (for completion, in particular). Do you have thoughts or pointers if I wanted to take a crack, myself?
I would start by creating a socket and try to get the communication with a server working. TextMate already has an interface for showing completion results, via the Dialog plugin [1]. Not sure if you should continue to use the plugin or move that code directly into TextMate. Note, the completion interface does not support showing any documentation, as far as I can see.
[1] https://github.com/textmate/textmate/tree/master/PlugIns
Oh Textmate loaded with LSP support would be sooooo superb.
Here are some interesting links regarding this LSP support:
https://microsoft.github.io/language-server-protocol https://microsoft.github.io/language-server-protocol <= A great starting point.
So basically this is the flow:
This is an example LSP plugin written for SublimeText (written in Python) https://github.com/tomv564/LSP https://github.com/tomv564/LSP But this is just an editor-extension.
Am 15.12.2018 um 11:25 schrieb Jacob Carlborg doob@me.com:
On 15 Dec 2018, at 01:39, jrk <katokop1@gmail.com mailto:katokop1@gmail.com> wrote:
I am very interested in this (for completion, in particular). Do you have thoughts or pointers if I wanted to take a crack, myself?
I would start by creating a socket and try to get the communication with a server working. TextMate already has an interface for showing completion results, via the Dialog plugin [1]. Not sure if you should continue to use the plugin or move that code directly into TextMate. Note, the completion interface does not support showing any documentation, as far as I can see.
[1] https://github.com/textmate/textmate/tree/master/PlugIns https://github.com/textmate/textmate/tree/master/PlugIns
/Jacob Carlborg
textmate mailing list textmate@lists.macromates.com https://lists.macromates.com/listinfo/textmate
I've started to work on rough implementation: https://github.com/f1nnix/LSP.tmbundle 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.
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
Great, thank you so much! 🚀🎉🥳 (LSP support is indeed the one single feature I’m missing so much that it would probably make me migrate away from TextMate in the foreseeable future 😔).
I think you’re referring to http://textmate.1073791.n5.nabble.com/How-to-implement-async-code-runner-bui... ?
Unfortunately I’m not really an expert in this regard so I hope someone with more knowledge can answer your questions. Anyone? :)
s.
On 15.12.19 14:26, f1nnix wrote:
I've started to work on rough implementation: https://github.com/f1nnix/LSP.tmbundle 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.
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
TextMate mailing list TextMate@lists.macromates.com https://lists.macromates.com/listinfo/textmate
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 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/pro...
I couldn’t run, can you please add more information about running ? also, some python packages are missing: cattrs==0.9.0 --- 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
On 15 Dec 2019, at 16:26, f1nnix ilya@rusanen.co.uk wrote:
I've started to work on rough implementation: https://github.com/f1nnix/LSP.tmbundle 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.
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
TextMate mailing list TextMate@lists.macromates.com https://lists.macromates.com/listinfo/textmate
Thanks everyone for interest! I'm really happy someone else find this project useful.
Right now it's nearly impossible to use this bundle unless you *exactly* know, how it works and what can fail. Soon I'll describe, how to run this project "as-is". And then we'll try to implement some kind of settings to be able to launch it somewhere except my own machine :).
Please, note two things:
1. For now I've developed it mostly to use with one particular Language server — https://github.com/palantir/python-language-server. That means, I rely on Python-specific things like PYTHONPATH, venv, etc. I'll try to dig other language servers' transport interfaces and adopt this bundle to it. But for now you will probably need to install and configure appropriate Language servers yourself. For example, for TypeScript you'll need to install https://github.com/theia-ide/typescript-language-server manually, etc. 2. Right now Textmate communicates with LS over dual-bound socket proxy. I've decided to make an intermediate proxy to handle persistent connection, as Textmate can't run async code in a way we need — not just disconnect from stdin/stdout, but be able to print something «back» if LS event occurs. That adds one additional step — you'll need to lauch LSP proxy yourself in separate terminal. I'll take a look closer on next week, maybe we would be able to drop proxy and rely just on PID of created LS process, saved somewhere on filesystem.
And obviously, there is just a limited subset of LS capabilities, that we physically can implement:
* Code completion — via DIALOG popup. * Go to definition — via `mate <file> <line>` * Hover — via DIALOG tooltip. * Document diagnostics — via some kind of internal HTML preview, rendered in modal window.
But for example, we won't be able go highlight errors in code as Jacob Carlborg stated above.
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
Some updates.
I've implemented simple stdio client to LS, and it works for completion requests. Also I've made ability to setup different LS (bin and env) variables via `.tm_properties`.
Unfortunately, it seems there's a major limitation in TM callbacks. Some of language servers strictly require didOpen, didChange and didClose notifications for each opened file. In other words:
1. When user __first time__ opens document from project, we should notify Language server. Callback `callback.document.did-open` runs __every time_ document gets focus, for example it you switch tabs. It means we should manage list of opened documents manually, which can't be done on TM side, but can be implemented on proxy-side. So it not an actual problem, but if there a callback for actual document first open event, it's better.
2. To get completions, we should notify sever a new document is opened (see 1) before. And when we open document, then we need to notify Language server about it's every change as document "truth" can't be read from file since opening.
Though specification clearly says "Note that a server’s ability to fulfill requests is independent of whether a text document is open or closed.", some popular language servers refuse to fulfill completion requests until document explicitly opened.
And this means unless we are able notify server on every content change of opened document in realtime, we can't make completion requests for major part for Language Server implementations. Is there a way to run command on every content change?
3. The same as 1. When document is closed, we need to notify LS about it. I can't find any info about document.close callback (https://github.com/textmate/textmate/search?q=callback.document.did-close&am...). Is it true there is no such callback?
-- Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html
On 20 Dec 2019, at 17:06, f1nnix ilya@rusanen.co.uk wrote:
And this means unless we are able notify server on every content change of opened document in realtime, we can't make completion requests for major part for Language Server implementations. Is there a way to run command on every content change?
Have a look at this changelog entry [1].
- The same as 1. When document is closed, we need to notify LS about it. I
can't find any info about document.close callback (https://github.com/textmate/textmate/search?q=callback.document.did-close&am...). Is it true there is no such callback?
No there’s no such callback. I asked about that recently. But, if you look at [1], there’s DocumentClosed, which might work.
As Allan mentioned [2], I think it’s better if the LSP support is natively implemented inside TextMate and not as a bundle.
[1] https://github.com/textmate/textmate/blob/master/Applications/TextMate/about... https://github.com/textmate/textmate/blob/master/Applications/TextMate/about/Changes.md#2016-10-03-v20-beta1221 [2] http://textmate.1073791.n5.nabble.com/Language-Server-Protocol-LSP-tp31826p3...