Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Previewing is depend on texlab or not? #254

Closed
ROCKTAKEY opened this issue Jun 6, 2020 · 12 comments
Closed

[Question] Previewing is depend on texlab or not? #254

ROCKTAKEY opened this issue Jun 6, 2020 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@ROCKTAKEY
Copy link

Hi! Thanks for your maintenance!

I have question on the page https://texlab.netlify.app/docs/installation/previewing, for solving this issue.

Does the previewing depend on texlab? Or, is it just a function of VSCode extension?

Thanks.

@pfoerster
Copy link
Member

Thank you for maintaining the Emacs plugin.

The previewing after building itself is just a latexmk configuration and does not depend on texlab.
However, the forward search does depend on texlab.
I am not sure how it is done for lsp-mode but most
clients allow you to pass configuration to texlab (in VSCode, this corresponds to settings.json) using either the workspace/configuration request or the workspace/didChangeConfiguration notification. The forward search itself is implemented as a custom request currently (see https://texlab.netlify.app/docs/reference/custom-messages for the details)
but we are going to convert it into a command (workspace/executeCommand) soon with the 3.0 release in order to stay more in line with the LSP spec.

Maybe this thread can help: emacs-lsp/lsp-mode#167.

@ROCKTAKEY
Copy link
Author

I got it.
I will make attachment of this feature on Emacs.
Thanks a lot!

@ROCKTAKEY
Copy link
Author

@pfoerster Could you help me if you don't mind?

After initialization, I send to texlab:

[Trace - 05:02:13 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
  "settings": {
    "latex.forwardSearch.executable": "qpdfview",
    "latex.forwardSearch.args": [
      "--unique",
      "%p#src:%f:%l:1"
    ]
  }
}

Then, send:

[Trace - 05:32:24 PM] Sending request 'textDocument/forwardSearch - (1333)'.
Params: {
  "textDocument": {
    "uri": "file:///home/rocktakey/aaa.tex"
  },
  "position": {
    "line": 19,
    "character": 0
  }
}

Then, received:

[Trace - 05:32:24 PM] Received response 'textDocument/forwardSearch - (1333)' in 49ms.
Result: {
  "status": 3
}

Status 3 means unconfigured. The first configuration is bad? Or, status 3 means other error?

@pfoerster
Copy link
Member

@ROCKTAKEY I think you need to send the settings like this:

"settings": {
    "latex": {
        "forwardSearch": {
            "executable": "qpdfview",
            "args": ["--unique", "%p#src:%f:%l:1"]
        }
    }
}

Otherwise, serde_json may not be able to deserialize the settings.

@pfoerster pfoerster reopened this Jun 7, 2020
@ROCKTAKEY
Copy link
Author

ROCKTAKEY commented Jun 7, 2020

@pfoerster Thanks!
I changed to:

[Trace - 06:50:16 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
  "settings": {
    "latex": {
      "forwardSearch": {
        "executable": "qpdfview",
        "args": [
           "--unique",
           "%p#src:%f:%l:1" 
        ]
      }
    }
  }
}

However, almost completely same response was received.

send:

[Trace - 06:50:19 PM] Sending request 'textDocument/forwardSearch - (1454)'.
Params: {
  "textDocument": {
    "uri": "file:///home/rocktakey/aaa.tex"
  },
  "position": {
    "line": 19,
    "character": 0
  }
}

received:

[Trace - 06:50:19 PM] Received response 'textDocument/forwardSearch - (1454)' in 48ms.
Result: {
  "status": 3
}

Are there any requirements or mistakes, yet?

@pfoerster
Copy link
Member

This seems like a bug of texlab to me. Can you try running texlab with

texlab -vvvv --log-file texlab.log

and post the log here?

@pfoerster pfoerster added the bug Something isn't working label Jun 7, 2020
@pfoerster pfoerster self-assigned this Jun 7, 2020
@ROCKTAKEY
Copy link
Author

ROCKTAKEY commented Jun 7, 2020

I tried it now, but it was failed. texlab gives error:

thread 'main' panicked at 'failed to open log file: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:86:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It seem to be another bug. It is my fault. I put --log-file ~/texlab.log but texlab cannot accept ~ omisstion

@ROCKTAKEY
Copy link
Author

Sorry for my mistakes. Here is log file.
texlab.log

@pfoerster
Copy link
Member

Thank you for the log. It seems that the issue is that the Emacs LSP client advertises the workspace/configuration request capability. texlab prefers using the workspace/configuration request instead of the workspace/didChangeConfiguration notification (mainly because of VSCode compability and I read once that workspace/configuration should be preferred). However, a lot of clients only support workspace/didChangeConfiguration so texlab supports both approaches. The problem is that texlab chooses the pull-based approach but the client always returns [null] when querying a configuration section so the options are not picked up.

So we have two options to fix the issue:

  1. Do not advertise the workspace/configuration request capability (the easy way)
  2. Support the workspace/configuration request properly (at the moment it always returns null)

@ROCKTAKEY
Copy link
Author

I see.
Delete advertising is difficult, because it is hard-coded on our upstream.
So I will do latter one. I should make setting along with this, shouldn't I?

@pfoerster
Copy link
Member

I should make setting along with this, shouldn't I?

Yeah, that would be pretty nice. Then, the user can use additional features like building on save or configuring the BibTeX formatter.

@ROCKTAKEY
Copy link
Author

ROCKTAKEY commented Jun 11, 2020

It works with workspace/configuration! Thanks a lot!

Now we can use all configuration of latex and bibtex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants