ROCKTAKEY / lsp-latex

Emacs lsp-mode client for LaTeX, on texlab.
GNU General Public License v3.0
69 stars 4 forks source link

texlab 5.13.0 and texlab.experimental.labelReferenceCommands #46

Closed rdiaz02 closed 7 months ago

rdiaz02 commented 8 months ago

With texlab 5.13.0 , https://github.com/latex-lsp/texlab/releases/tag/v5.13.0 , it is now possible to pass texlab.experimental.labelReferenceCommands (https://github.com/latex-lsp/texlab/commit/75ded0b9fec8050f467506e4e9337cf7c200e05f). It is my understanding that to use this, the seetings need to be passed from the client. Is this correct? If so, would it be possible to allow this from lsp-latex?

ROCKTAKEY commented 7 months ago

You are right. In https://github.com/ROCKTAKEY/lsp-latex/pull/47, I added variable named lsp-latex-experimental-label-reference-commands for the feature.

Feel free to ask me if you have any question.

rdiaz02 commented 7 months ago

Thanks a lot. But I do not seem to be able to get it to work; I am not sure I am using the right syntax, or if there is some other issue. For example, using :

 (setq lsp-latex-experimental-label-reference-commands
    '("qrif" "qprif" "[qruf, qqruf]" "[\"qlrof\", \"qrrof\"]"))

none of them seem to lead to the desired behavior (that, when inside one of them, I am offered completions as if I had typed \ref).

Doing C-h v the variable actually has the value I set:

lsp-latex-experimental-label-reference-commands is a variable defined in ‘lsp-latex.el’.

Its value is
("qrif" "qprif" "[qruf, qqruf]" "[\"qlrof\", \"qrrof\"]")
Original value was nil

List of command name which should be regarded as "\ref"-like command.
For example, "ref" is meet the condition. Note that backslash is not needed.

I couldn't find examples of this, or of the similar lsp-latex-experimental-citation-commands. What am I doing wrong?

ROCKTAKEY commented 7 months ago

I don't know detail of the configuration. I will ask the texlab author.

ROCKTAKEY commented 7 months ago

As far as I think, ("qrif" "qprif") looks correct.

ROCKTAKEY commented 7 months ago

@rdiaz02, could you get a debug log? It is probably bug of texlab.

See URL below to get a debug log. https://github.com/ROCKTAKEY/lsp-latex/blob/master/.github/issue_template.md

rdiaz02 commented 7 months ago

I tried to. I issue a '\qrif{}' that doesn't give completions. BUT: I think the syntax for lsp-latex-experimental-label-reference-commands is not correct, as I see this

LSP :: texlab2:1613572 initialized successfully in folders: (/home/ramon/tmp/tex-test-dir)
LSP :: Sending to process failed with the following error: Wrong type argument: symbolp, "qrif" [3 times]

This is the code I am using

(setq lsp-latex-texlab-executable-argument-list '("-vvvv" "--log-file" "/home/ramon/tmp/texlab3.log"))
(setq lsp-latex-experimental-label-reference-commands
      '("qrif" "qprif"))

If I instead use the syntax

(setq lsp-latex-experimental-label-reference-commands
      '("[qrif, qprif]"))

I get error

LSP :: Sending to process failed with the following error: Wrong type argument: consp, nil

And if I use

(setq lsp-latex-experimental-label-reference-commands
      '("[\"qrif\", \"qprif\"]"))

I get

LSP :: Sending to process failed with the following error: Wrong type argument: consp, nil [3 times]

So I think the problem, or the first problem, is the syntax for passing the arguments to lsp-latex-experimental-label-reference-commands.

I am not attaching any log because they are huge and it seems pointless given that it seems that the syntax is incorrrect.

ROCKTAKEY commented 7 months ago

Thanks for your report. It's my falult. I will fix this bug by tommorow.

ROCKTAKEY commented 7 months ago

Maybe fixed on https://github.com/ROCKTAKEY/lsp-latex/commit/30e5ee2a387bee7b320564d402b3e587cdae536c

The code below is valid.

(setq lsp-latex-experimental-label-reference-commands
      '("qrif" "qprif"))

Please reopen this issue if it does not work.

rdiaz02 commented 7 months ago

I just tried the latest MELPA version. It works perfectly. Thank you!!