martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.19k stars 259 forks source link

Update scintillua lexers to tag scintillua_6.1 #1068

Closed mcepl closed 1 year ago

mcepl commented 1 year ago

https://github.com/martanne/vis/pull/1018 has been fantastic achievement, but it was done against a bit older commit of https://github.com/orbitalquark/scintillua. This PR tries to sync lexers/ directory to the same code as is the latest upstream tag https://github.com/orbitalquark/scintillua/releases/tag/scintillua_6.1.

Please, review, I am not sure how well I have to managed to do the merge.

Cc: @ninewise @Nomarian @qiu-x @jpe90 @deepcube @martanne @orbitalquark

mcepl commented 1 year ago

Hmm, so it is not complete yet. On the start of the editor I get immediately:

/home/matej/.config/vis/plugins/vis-toggler/init.lua:11: attempt to index a nil value (loc
al 'l')

(vis-toggler is obviously https://repo.or.cz/vis-toggler.git or from my clone of the repo on https://git.sr.ht/~mcepl/vis-toggler).

jpe90 commented 1 year ago

For one thing it looks like a change from upstream to lexer.lua needs to be added here:

diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua
index ede9fd4..b35551d 100644
--- a/lua/plugins/filetype.lua
+++ b/lua/plugins/filetype.lua
@@ -497,7 +497,7 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
                for _, cmd in pairs(filetype.cmd or {}) do
                        vis:command(cmd)
                end
-               local path = vis.lexers.property['lexer.lpeg.home']:gsub(';', '/?.lua;') .. '/?.lua'
+               local path = vis.lexers.property['scintillua.lexers']:gsub(';', '/?.lua;') .. '/?.lua'

Some logic in vis.lua needs to be updated because the lexer table contents were overhauled.

Table contents dumped when opening vis.c:

old new

mcepl commented 1 year ago

For one thing it looks like a change from upstream to lexer.lua needs to be added here:

diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua
index ede9fd4..b35551d 100644
--- a/lua/plugins/filetype.lua
+++ b/lua/plugins/filetype.lua
@@ -497,7 +497,7 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
                for _, cmd in pairs(filetype.cmd or {}) do
                        vis:command(cmd)
                end
-               local path = vis.lexers.property['lexer.lpeg.home']:gsub(';', '/?.lua;') .. '/?.lua'
+               local path = vis.lexers.property['scintillua.lexers']:gsub(';', '/?.lua;') .. '/?.lua'

Unfortunately, it is not enough, I am afraid. The result is still broken. I guess we broke something fundamental about require()?

mcepl commented 1 year ago

I really didn’t want to close it. Not sure how I have managed to do it.

mcepl commented 10 months ago

@rnpnr Not sure whether I should ask you to reopen this one, or whether I should try again with the new tag scintillua_6.2.

rnpnr commented 10 months ago

I can't actually reopen this one since you deleted your github fork of vis. However a new version based on Scintillua 6.2 would be very appreciated.

mcepl commented 10 months ago

I will probably split it into multiple submissions and send to https://lists.sr.ht/~martanne/devel

rnpnr commented 10 months ago

Sounds good to me.

To answer your upstream question (https://github.com/orbitalquark/scintillua/issues/87#issuecomment-1446540510), based on:

Table contents dumped when opening vis.c:

old new

It looks like replacing _TOKENSTYLES with _TAGS might be sufficient. Otherwise some of the logic in vis.lua will need to be updated.