lite-xl-lsp icon indicating copy to clipboard operation
lite-xl-lsp copied to clipboard

Another Lua-based text editor with LSP support

Open Atreyu-94 opened this issue 3 years ago • 12 comments

Hey, this feature is really cool, especially for us beginners. I recently found another Lua-based text editor. Is named Textadept:

https://orbitalquark.github.io/textadept/

It turns out that they implemented an LSP server, perhaps with Lua code that can be recycled here. The repository is:

https://github.com/orbitalquark/textadept-lsp

If this is nonsense, ignore me, it is just an idea to help 😅.

Atreyu-94 avatar Jul 05 '21 23:07 Atreyu-94

It turns out that they implemented an LSP server, perhaps with Lua code that can be recycled here.

Indeed, if you look into the code of this repository you will find this comment: https://github.com/jgmdev/lite-xl-lsp/blob/master/lsp/server.lua#L7

I researched a bit before starting work on this plugin, and textadept lsp code was my point of reference :) I did ended implementing some more stuff than textadept (like lazy loading of completion items description, context support, etc...), but there is still some from textadept plugin that I'm still missing, namely:

  • window/showMessage
  • workspace/symbol
  • textDocument/linkedEditingRange

Haven't implemented window/showMessage due to not having widgets on Lite-XL but now that I have put together a basic widgets library for lite-xl I will try to finish the remaining todo items.

I have tried to recycle code as much as possible (I can be a lazy/copy/paste coder, please don't judge me :P) but as you may know lite didn't had a process management facility so I had to also submit the reproc wrapper for lua, fix some issues with the lua json library from rxi that I'm using, add additional functionality to autocomplete plugin, put together a listbox hacked from autocomplete plugin because I didn't know what I was doing (because of that, kind of documented the C Lua api) and recently wrote the basic widgets system (which may be full of bugs, maybe I'm exagerating) to be able to more easily generate gui elements when needed and finally understand a bit more what I'm doing :)

But there is so much more on the LSP standard that makes one anxious and think if I'm gonna be able to fully implement all the client bits: https://microsoft.github.io/language-server-protocol/specifications/specification-current/

Hopefully implementing additional LSP requests/functionality should be easy for other contributors since I wrote the server/client pluggable (at least in my point of view)

Finally there will always remain bug fixes as with any other piece of code, but I hope this plugin can later be moved on to lite-xl org for continued maintenance by the community.

jgmdev avatar Jul 06 '21 03:07 jgmdev

Wow! hahaha you had already taken it into account :) I am very anxious for it to work, I would like to contribute, but I am not a programmer, however I could be useful testing the releases, if you provide me with the binaries I would be happy to do it :) (my machine is very slow to compile). I could also try some LSPs that interest me and give you some feedback. Greetings!

Atreyu-94 avatar Jul 06 '21 11:07 Atreyu-94

however I could be useful testing the releases, if you provide me with the binaries I would be happy to do it :)

What OS and architecture you are running on?

jgmdev avatar Jul 07 '21 14:07 jgmdev

Hey, on my personal computer I use Manjaro Linux Xfce, with x86_64, specifically 64 bits. At work I can check Windows 10 for 64 bits too.

Atreyu-94 avatar Jul 08 '21 15:07 Atreyu-94

Shouldn't binaries be provided on lite-xl repository?

redtide avatar Jul 08 '21 16:07 redtide

Shouldn't binaries be provided on lite-xl repository?

Yes, but does it matter having the normal one and pasting the LSP .lua files in the plugin repository?

Atreyu-94 avatar Jul 08 '21 16:07 Atreyu-94

you just need to save this plugin like any other on your user directory, the editor is always the same for all, or I don't get what you mean

redtide avatar Jul 08 '21 17:07 redtide

The problem is that I thought that I had to use the Master branch and that this was different from the last release of Lite-XL published in the repo. I'm going to test it then with the latest release. Excuse my nonsense.

Atreyu-94 avatar Jul 08 '21 17:07 Atreyu-94

I took lite-xl-git PKGBUILD from AUR and modified it to point to a custom branch I have with changes merged in:

# Maintainer: Sergii Fesenko <sergii underscore f dot at outlook dot com>
# PKGBUILD based on the one from https://aur.archlinux.org/packages/lite-xl

pkgname=lite-xl-git
_pkgname=lite-xl
pkgver=1.16.9.dev.1.r175.g8be2a3d
pkgrel=1
pkgdesc='A lightweight text editor written in Lua'
arch=('x86_64' 'aarch64')
url="https://github.com/lite-xl/$_pkgname"
license=('MIT')
depends=('lua52' 'sdl2' 'freetype2')
makedepends=('meson>=0.58')
conflicts=("lite" "lite-xl")
provides=("$_pkgname")
source=("git+https://github.com/jgmdev/lite-xl#branch=mydev")
md5sums=('SKIP')

pkgver() {
  cd "${srcdir}/${_pkgname}"
  git describe --tags --long | sed 's/^v//; s/\([^-]*-g\)/r\1/; s/-/./g'
}

build() {
  cd "$_pkgname"
  arch-meson build --wrap-mode default
  meson compile -C build
}

package() {
  cd "$_pkgname"

  DESTDIR="$pkgdir" meson install --skip-subprojects -C build

  install -Dm 644 "${srcdir}/${_pkgname}/resources/icons/lite-xl.svg" \
    "$pkgdir/usr/share/icons/hicolor/scalable/apps/${_pkgname}.svg"

  install -Dm 644 "${srcdir}/${_pkgname}/resources/linux/${_pkgname}.desktop" \
    -t "$pkgdir/usr/share/applications"
}

You can copy paste that text in a PKGBUILD file inside a lite-xl-git directory and build it with makepkg -s

jgmdev avatar Jul 08 '21 18:07 jgmdev

Thanks, now I try it

Atreyu-94 avatar Jul 08 '21 18:07 Atreyu-94

i am not a programmer

why do you need LSP then?

vincens2005 avatar Jul 08 '21 20:07 vincens2005

i am not a programmer

why do you need LSP then?

Well, for my thesis I need to model some things, we receive programming in the career, nowadays in any branch of science or technology you have to apply programming, without being a programming professional. Greetings :)

Atreyu-94 avatar Jul 09 '21 12:07 Atreyu-94