astoff / digestif

A language server for TeX and friends
Other
256 stars 6 forks source link

Unable to get digestif to work with ConTeXt LuaMetaTeX (LMTX) #69

Open 120ace opened 3 weeks ago

120ace commented 3 weeks ago

Hello! I have been looking for a context lsp and came across yours. I am very excited to use it; however, I have been unable to get it to work with lmtx. I did some digging and found a similar issue: https://github.com/astoff/digestif/issues/54. I was initially hopeful that this would fix it. It did not. I set DIGESTIF_TEXMF to '~/context/tex' without success. Trying to run 'digestif -g context-en.xml' also failed: I event cd'd to the dir containing it '~/context/tex/texmf-context/tex/context/interface/mkiv' and reran the command. All I get is cannot find or generate tags.

More techical info:

As a sanity check I installed texlive-context and was able to get completions from that. I really do not know what todo further to try and fix this.

astoff commented 3 weeks ago

Try setting DIGESTIF_TEXMF="$HOME/context/tex/texmf-context" (make sure $HOME is expanded to your home directory, a literal ~ will not work).

120ace commented 3 weeks ago

Hi, thanks for the response. Trying that did not fix the problem. Digestif is still telling me Error: can't find 'context-en.xml' or can't generate tags from it. when I run digestif -g context-en.xml. I also tried setting DIGESTIF_TEXMF to "$HOME/context/texmf-context/tex" with no luck there either.

120ace commented 3 weeks ago

Correction "$HOME/context/tex/texmf-context/tex".

astoff commented 3 weeks ago

This should work. What do these commands give you?

find ~/context/ -iname 'context-en.xml'

and

DIGESTIF_TEXMF=$HOME/context/tex/ digestif -v -g context-en.xml
120ace commented 3 weeks ago

Context-en.xml is located at "~/context/tex/texmf-context/tex/context/interface/mkiv/context-en.xml". And "13:12:02 TLPDB not found Error: can't find 'context-en.xml' or can't generate tags from it."

astoff commented 3 weeks ago

With the -v switch you should additionally see a message like Scanned /home/.../context/tex/ in ... ms. If this message is not saying something sensible, then for some reason you didn't manage to supply the environment variable correctly...

120ace commented 3 weeks ago

I set DIGESTIF_TEXMF to "$HOME/context/tex". To make sure that bash expanded it properly I echoed it, it expanded properly. I also reran "digestif -v -g context-en.xml" 2 more times with the same result (aside from the timespamp): "14:09:11 TLPDB not found Error: can't find 'context-en.cml' or can't generate tags from it." Running "digestif -g context-en.xml" without the 'v' flag gives me this: "Error: can't find 'context-en.xml' or can't generate tags from it.". For good measure I exported DIGESTIF_TEXMF. Still got the same result. Could this be because I installed digestif via luarocks? Also, I did not install context via texlive, but as a standalone install.

astoff commented 3 weeks ago

Ah, okay, the luarocks version is somewhat old, that might be the reason then...

In this case I would suggest to use the self-installing script method.

You need to change the line LUA=texlua to LUA=lua (or whatever Lua interpreter you have) and add the line export DIGESTIF_TEXMF=$HOME/context/tex/ to that script.

120ace commented 3 weeks ago

Okay! Will do.

120ace commented 2 weeks ago

Sorry for taking so long to reply. My internet router/modem died on me and I had to wait for a replacement.

I have installed digestif using the self installer script. I set LUA to LUA=lua and added export DIGESTIF_TEXMF="$HOME/context/tex/" to the self installer script. I attempted to run digestif -v -g context-en.xml but was getting this error:

lua5.4: ~/.digestif/digestif/data.lua:1: module 'lfs' not found:
        no field package.preload['lfs']
        no file '~/.digestif/lfs.lua'
        no file '/usr/local/lib/lua/5.4/lfs.so'
        no file '/usr/lib/lua/5.4/lfs.so'
        no file '/usr/local/lib/lua/5.4/loadall.so'
        no file '/usr/lib/lua/5.4/loadall.so'
stack traceback:
        [C]: in function 'require'
        ~/.digestif/digestif/data.lua:1: in main chunk
        [C]: in function 'require'
        ~/.digestif/digestif/langserver.lua:493: in upvalue 'generate'
        ~/.digestif/digestif/langserver.lua:565: in function 'digestif.langserver.main'
        ~/.digestif/bin/digestif:5: in main chunk
        [C]: in ?

I went ahead and installed luafilesystem using luarocks. Rerunning digestif -v -g context-en.xml now gives me:

14:06:46 TLPDB not found
14:06:46 Scanned ~/context/tex/ in 54.248 ms
14:06:46 Generating tags: ~/context/tex/texmf-context/tex/context/interface/mkiv/context-en.xml
14:06:46 Generating tags: ~/context/tex/texmf-context/tex/context/interface/mkiv/context-en.xml
Generated  context-en.xml.tags with 4253 commands and 442 environments.

I proceeded to open a tex file using my editor, but am not getting any auto completions.

Also, following https://github.com/astoff/digestif/wiki/Common-installation-issues#info-nodes, I cannot find any info file in my context installation. Running fd info ~/context results in:

~/context/tex/texmf-context/source/luametatex/source/libraries/pplib/util/utilmeminfo.c
~/context/tex/texmf-context/source/luametatex/source/libraries/pplib/util/utilmeminfo.h
~/context/tex/texmf-context/tex/context/fonts/mkiv/informal-math.lfg
~/context/tex/texmf-context/tex/context/fonts/mkiv/type-imp-informal.mkiv

I am unsure as how to proceed from here. Finally, sorry for not correctly formatting the code snippets in my previous replies. Realized I wasn't using Markdown right.

astoff commented 1 week ago

I went ahead and installed luafilesystem using luarocks. Rerunning digestif -v -g context-en.xml now gives me: [...]

Okay this means Digestif is correctly installed now. I guess the rest of the story is editor-specific; you need to convince your editor to run the right program.

I cannot find any info file in my context installation.

This is fine, it's irrelevant for ConTeXt.

120ace commented 1 week ago

I was successfully getting Digestif to run inside neovime using nvim-lspconfig and nvim-cmp. IDK why it's not working now. Do you have any suggestions?

120ace commented 1 week ago

Clarification: it was running when I was using the texlive context distribution..