sch0lars / koopa-mode

A PowerShell mode for Emacs.
GNU General Public License v3.0
16 stars 3 forks source link

Any reason not to be using treesitter and lsp-mode at this point? #3

Open gtusr opened 2 weeks ago

gtusr commented 2 weeks ago

Ideally, I'm looking for a shell-mode experience inside emacs that leverages powershell-ts-mode for syntax highlighting user input at the prompt and lsp-mode's pwsh-ls for tab completing commands and linting at the prompt.

Are there any plans to migrate to these tools since treesitter is now built into emacs 29? While eglot is the standard LSP client built into emacs 29, lsp-mode appears to more featureful and better tested with powershell at the moment.

sch0lars commented 1 week ago

koopa-mode was written for versions prior to Emacs 29, and most of its features are likely replaceable with a combination of treesitter and eglot, so rewriting the entire package may be counterproductive. I’m also admittedly not very well-versed in Emacs LISP and am not sure how feasible it is to incorporate an LSP mode into a major mode. I searched earlier for some examples of other packages doing so, but didn’t really find any.

The only unavailable feature seems to be spawning and sending code to a PowerShell buffer. I have not tested this, but you could try using koopa-mode without company and instead enabling eglot or lsp-mode. Something like this in your init.el should work:

(add-hook `koopa-mode-hook
  (lambda ()
    (company-mode -1)
    (eglot-ensure)))

Since treesitter and eglot are native to Emacs 29, and treesitter obviates the need for any syntax highlighting, the residual features could likely be rewritten into a minor mode.

I would rather not rewrite koopa-mode given that these features are already available in Emacs 29 and it would make the package inaccessible to those for whom it was originally intended. If there is a general need for interacting with a PowerShell buffer, I can write a minor mode when I have some time.