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

[Neovim] Greeted with Build Error on compilation after updating to 5.0.0 #837

Closed
Icy-Thought opened this issue Jan 10, 2023 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@Icy-Thought
Copy link

Description

After updating texlab + neovim-git (nightly overlay) to their latest versions, I noticed that texlab had suddenly become unable to compile my .tex files to .pdf with the help of tectonic and complained about:

[ERROR][2023-01-10 16:52:02] .../vim/lsp/rpc.lua:734	"rpc"	"texlab"	"stderr"	"thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: \"SendError(..)\"', /build/texlab-5.0.0-vendor.tar.gz/lsp-server/src/stdio.rs"
[ERROR][2023-01-10 16:52:02] .../vim/lsp/rpc.lua:734	"rpc"	"texlab"	"stderr"	":29:37\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
[ERROR][2023-01-10 16:52:02] .../vim/lsp/rpc.lua:734	"rpc"	"texlab"	"stderr"	'Error: unexpected message during shutdown: Request(Request { id: RequestId(I32(5)), method: "shutdown", params: Null })\n'

Other relevant info:

System information:

  1. Distro: NixOS

Package versions:

  1. Texlab: 5.0.0
  2. Neovim: v0.9.0-dev-1df2db0
  3. Tectonic: 0.12.0

nvim-lspconfig

-- ...
texlab = {
    log_level = vim.lsp.protocol.MessageType.Log,
    settings = {
        texlab = {
            auxDirectory = "build",
            bibtexFormatter = "texlab",
            build = {
                executable = "tectonic",
                args = {
                    "%f",
                    "--synctex",
                    "--keep-logs",
                    "--keep-intermediates",
                    "--outdir",
                    "build",
                },
                onSave = true,
            },
            forwardSearch = {
                executable = "zathura",
                args = { "--synctex-forward", "%l:1:%f", "%p" },
            },
            chktex = {
                onEdit = false,
                onOpenAndSave = false,
            },
            diagnosticsDelay = 100,
            formatterLineLength = 120,
            latexFormatter = "latexindent",
            latexindent = { modifyLineBreaks = false },
        },
    },
@f1rstlady
Copy link

Same here on my system after the upgrade to version 5.0. I get exactly the same error messages.

  1. Texlab 5.0.0
  2. Neovim 0.8.2

pfoerster added a commit that referenced this issue Jan 18, 2023
@pfoerster
Copy link
Member

@Icy-Thought @f1rstlady
It looks like channel used to send the build output to the client is dropped before all output is read. Can you try 1a47c8c, please while setting the environment variable RUST_BACKTRACE=1?

@pfoerster pfoerster added the bug Something isn't working label Jan 18, 2023
@Icy-Thought
Copy link
Author

I do apologize for the late reply, have been quite busy for the past couple of days..

I managed to install texlab from that commit in Nix and applied RUST_BACKTRACE=1 as you'd specified and stumbled upon a rather weird issue..

texlab appears to be struggling with LaTeX documents placed inside git directories and the reason for my suspicion is that it builds the following document alright when placed outside of my git project directory:

├──  build
│  ├──  random.aux
│  ├──  random.log
│  ├──  random.out
│  ├──  random.pdf
│  ├──  random.synctex.gz
│  └──  random.toc
└──  random.tex

whereas it fails to build the same document when placed inside my git project directory and complains about a missing build directory.

Logs:

[DEBUG][2023-01-21 13:36:20] .../lua/vim/lsp.lua:1389	"LSP[texlab]"	"client.request"	1	"textDocument/build"	{  textDocument = {    uri = "file:///git-directory/document/random.tex"  }}	<function 1>	1
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 4,  jsonrpc = "2.0",  method = "textDocument/build",  params = {    textDocument = {      uri = "file:///git-directory/document/random.tex"    }  }}
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 5,  jsonrpc = "2.0",  method = "window/workDoneProgress/create",  params = {    token = 2  }}
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:403	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 5,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = 2,    value = {      cancellable = false,      kind = "begin",      message = "file:///git-directory/document/random.tex",      title = "Building"    }  }}
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = 'error: output directory "build" does not exist',    type = 4  }}
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = 2,    value = {      kind = "end"    }  }}
[DEBUG][2023-01-21 13:36:20] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 4,  jsonrpc = "2.0",  result = {    status = 1  }}
[INFO][2023-01-21 13:36:20] ...lsp/handlers.lua:516	'error: output directory "build" does not exist'
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didSave",  params = {    textDocument = {      uri = "file:///git-directory/document/random.tex"    }  }}
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 6,  jsonrpc = "2.0",  method = "window/workDoneProgress/create",  params = {    token = 3  }}
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:403	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 6,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = 3,    value = {      cancellable = false,      kind = "begin",      message = "file:///git-directory/document/random.tex",      title = "Building"    }  }}
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = 'error: output directory "build" does not exist',    type = 4  }}
[INFO][2023-01-21 13:36:21] ...lsp/handlers.lua:516	'error: output directory "build" does not exist'
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = 3,    value = {      kind = "end"    }  }}
[DEBUG][2023-01-21 13:36:21] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = {},    uri = "file:///git-directory/document/random.tex"  }}
[INFO][2023-01-21 13:37:23] .../lua/vim/lsp.lua:1861	"exit_handler"	{ {    _on_attach = <function 1>,    attached_buffers = { true },    cancel_request = <function 2>,    commands = {},    config = {      _on_attach = <function 3>,      autostart = true,      capabilities = {        textDocument = {          callHierarchy = {            dynamicRegistration = false          },          codeAction = {            codeActionLiteralSupport = {              codeActionKind = {                valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }              }            },            dataSupport = true,            dynamicRegistration = false,            isPreferredSupport = true,            resolveSupport = {              properties = { "edit" }            }          },          completion = {            completionItem = {              commitCharactersSupport = true,              deprecatedSupport = true,              documentationFormat = { "markdown", "plaintext" },              insertReplaceSupport = true,              insertTextModeSupport = {                valueSet = { 1, 2 }              },              labelDetailsSupport = true,              preselectSupport = true,              resolveSupport = {                properties = { "documentation", "detail", "additionalTextEdits" }              },              snippetSupport = true,              tagSupport = {                valueSet = { 1 }              }            },            completionItemKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }            },            completionList = {              itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }            },            contextSupport = true,            dynamicRegistration = false,            insertTextMode = 1          },          declaration = {            linkSupport = true          },          definition = {            linkSupport = true          },          documentHighlight = {            dynamicRegistration = false          },          documentSymbol = {            dynamicRegistration = false,            hierarchicalDocumentSymbolSupport = true,            symbolKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }            }          },          hover = {            contentFormat = { "markdown", "plaintext" },            dynamicRegistration = false          },          implementation = {            linkSupport = true          },          publishDiagnostics = {            relatedInformation = true,            tagSupport = {              valueSet = { 1, 2 }            }          },          references = {            dynamicRegistration = false          },          rename = {            dynamicRegistration = false,            prepareSupport = true          },          semanticTokens = {            augmentsSyntaxTokens = true,            dynamicRegistration = false,            formats = { "relative" },            multilineTokenSupport = false,            overlappingTokenSupport = true,            requests = {              full = {                delta = true              },              range = false            },            serverCancelSupport = false,            tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },            tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }          },          signatureHelp = {            dynamicRegistration = false,            signatureInformation = {              activeParameterSupport = true,              documentationFormat = { "markdown", "plaintext" },              parameterInformation = {                labelOffsetSupport = true              }            }          },          synchronization = {            didSave = true,            dynamicRegistration = false,            willSave = true,            willSaveWaitUntil = true          },          typeDefinition = {            linkSupport = true          }        },        window = {          showDocument = {            support = true          },          showMessage = {            messageActionItem = {              additionalPropertiesSupport = false            }          },          workDoneProgress = true        },        workspace = {          applyEdit = true,          configuration = true,          semanticTokens = {            refreshSupport = true          },          symbol = {            dynamicRegistration = false,            hierarchicalWorkspaceSymbolSupport = true,            symbolKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }            }          },          workspaceEdit = {            resourceOperations = { "rename", "create", "delete" }          },          workspaceFolders = true        }      },      cmd = { "texlab" },      cmd_cwd = "git-directory",      filetypes = { "tex", "plaintex", "bib" },      flags = {        debounce_text_changes = 150      },      get_language_id = <function 4>,      handlers = <1>{},      init_options = vim.empty_dict(),      log_level = 4,      message_level = 2,      name = "texlab",      on_attach = <function 5>,      on_exit = <function 6>,      on_init = <function 7>,      root_dir = "git-directory",      settings = {        texlab = {          auxDirectory = "build",          bibtexFormatter = "texlab",          build = {            args = { "%f", "--synctex", "--keep-logs", "--keep-intermediates", "--outdir", "build" },            executable = "tectonic",            forwardSearchAfter = false,            onSave = true          },          chktex = {            onEdit = false,            onOpenAndSave = false          },          diagnosticsDelay = 100,          formatterLineLength = 120,          forwardSearch = {            args = { "--synctex-forward", "%l:1:%f", "%p" },            executable = "zathura"          },          latexFormatter = "latexindent",          latexindent = {            modifyLineBreaks = false          }        }      },      single_file_support = true,      workspace_folders = <2>{ {          name = "git-directory",          uri = "file:///git-directory"        } },      <metatable> = <3>{        __tostring = <function 8>      }    },    handlers = <table 1>,    id = 1,    initialized = true,    is_stopped = <function 9>,    messages = {      messages = {},      name = "texlab",      progress = { {          cancellable = false,          done = true,          title = "Building"        }, {          cancellable = false,          done = true,          title = "Building"        }, {          cancellable = false,          done = true,          title = "Building"        } },      status = {}    },    name = "texlab",    notify = <function 10>,    offset_encoding = "utf-16",    request = <function 11>,    request_sync = <function 12>,    requests = {},    rpc = {      is_closing = <function 13>,      notify = <function 14>,      request = <function 15>,      terminate = <function 16>    },    server_capabilities = {      completionProvider = {        resolveProvider = true,        triggerCharacters = { "\\", "{", "}", "@", "/", " " }      },      definitionProvider = true,      documentFormattingProvider = true,      documentHighlightProvider = true,      documentLinkProvider = {        resolveProvider = false      },      documentSymbolProvider = true,      executeCommandProvider = {        commands = { "texlab.cleanAuxiliary", "texlab.cleanArtifacts" }      },      foldingRangeProvider = true,      hoverProvider = true,      inlayHintProvider = true,      referencesProvider = true,      renameProvider = {        prepareProvider = true      },      textDocumentSync = {        change = 2,        openClose = true,        save = {          includeText = false        }      },      workspaceSymbolProvider = true    },    stop = <function 17>,    supports_method = <function 18>,    workspace_did_change_configuration = <function 19>,    workspace_folders = <table 2>,    <metatable> = {      __index = <function 20>    }  } }
[DEBUG][2023-01-21 13:37:23] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 5,  jsonrpc = "2.0",  method = "shutdown"}
[DEBUG][2023-01-21 13:37:23] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 5,  jsonrpc = "2.0"}
[DEBUG][2023-01-21 13:37:23] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "exit"}

@pfoerster
Copy link
Member

@Icy-Thought

Thanks for the update!

texlab appears to be struggling with LaTeX documents placed inside git directories and the reason for my suspicion is that it builds the following document alright when placed outside of my git project directory:

This suspicion seems to align with the issue that I fixed in #839. Can you try again with the v5.1.0 ( which was just released), please? I think this problem should be fixed now.

@Icy-Thought
Copy link
Author

Just tested and texlab now appears to be working as intended!
Appreciate the fix! :)

pushed update to nixpkgs for others to enjoy!

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Apr 27, 2023
## [5.5.0] - 2023-04-16

### Added

- Allow optionally passing cursor position to `textDocument/build` request for use in forward search after building.
  Previously, the server had to guess the cursor position ([#475](latex-lsp/texlab#475))
- Add experimental `texlab.experimental.citationCommands` setting to allow extending the list of citation commands
  ([#832](latex-lsp/texlab#832))
- Add support for escaping placeholders in build arguments similar to forward search
- Allow configuring completion matching algorithm ([#872](latex-lsp/texlab#872))

### Fixed

- Fix regression introduced in `v5.4.2` involving `texlab.cleanArtifacts` command.

## [5.4.2] - 2023-04-11

### Fixed

- Fix memory leak when editing documents over a long time ([#856](latex-lsp/texlab#856))
- Fix parsing parentheses in file paths ([#874](latex-lsp/texlab#874))

## [5.4.1] - 2023-03-26

### Fixed

- Do not return symbols with empty names (e. g. sections without name) ([#870](latex-lsp/texlab#870))
- Repair `textDocument/formatting` request ([#871](latex-lsp/texlab#871))

## [5.4.0] - 2023-03-12

### Added

- Add experimental settings to allow extending the list of special environments:
  - `texlab.experimental.mathEnvironments`
  - `texlab.experimental.enumEnvironments`
  - `texlab.experimental.verbatimEnvironments`
- Add `texlab.changeEnvironment` workspace command ([#849](latex-lsp/texlab#849))
- Add `texlab.showDependencyGraph` workspace command

### Changed

- Do not show caption or section names in label inlay hints ([#858](latex-lsp/texlab#858))
- Include more user-defined commands in command completion

### Fixed

- Parse nested `\iffalse` blocks correctly ([#853](latex-lsp/texlab#853))
- Parse commands with multi-byte characters correctly ([#857](latex-lsp/texlab#857))
- Fix checking whether a document can be a root file

## [5.3.0] - 2023-02-25

### Added

- Allow filtering `textDocument/documentSymbols` using regular expressions specified via
  `texlab.symbols.allowedPatterns` and `texlab.symbols.ignoredPatterns`
  ([#851](latex-lsp/texlab#851))

### Fixed

- Do not use percent-encoded path when searching for PDF files during forward search
  ([#848](latex-lsp/texlab#848))
- Always return an empty list of code actions instead of returning "method not found" ([#850](latex-lsp/texlab#850))

## [5.2.0] - 2023-01-29

### Added

- Include line numbers in build warnings when available ([#840](latex-lsp/texlab#840))
- Add `none` formatter to `texlab.latexFormatter` and `texlab.bibtexFormatter` options
  to allow disabling formatting ([#846](latex-lsp/texlab#846))

### Fixed

- Concatenate more than two lines of maximum length in build diagnostics ([#842](latex-lsp/texlab#842))
- Apply the correct range of references to labels when renaming ([#841](latex-lsp/texlab#841))
- Use `document` environment to detect root file instead of `\documentclass` ([#845](latex-lsp/texlab#845))

## [5.1.0] - 2023-01-21

### Added

- Allow manually overriding the root directory using a `texlabroot`/`.texlabroot` marker file.
  See the wiki for more information.
  ([#826](latex-lsp/texlab#826), [#838](latex-lsp/texlab#838))

### Deprecated

- Deprecate `texlab.rootDirectory` setting in favor of `.texlabroot` files

### Fixed

- Do not use `.git`, `.chktexrc`, `.latexmkrc` files/directories to determine the root directory
  ([#826](latex-lsp/texlab#826))
- Fix building documents without an explicit root directory ([#837](latex-lsp/texlab#837))

## [5.0.0] - 2022-12-29

### Changed

- _BREAKING_: `texlab.rootDirectory` is now used as the folder path from which the compiler is executed
  relative to the main document. By default it is equal to `"."`. For more information, please visit the wiki.
- Improve performance of completion by a huge margin due to a faster filtering method used internally
- Do not discover project files beyond the provided workspace folders
- Try to guess the root directory by checking for files such as `.latexmkrc` or `Tectonic.toml` if `texlab.rootDirectory` is not set

### Fixed

- Update positions of reported build diagnostics when editing the affected line
- Do not treat links to files as bidirectional by default. This prevents issues where `texlab` ends up compiling the wrong file
  in projects with shared files ([#806](latex-lsp/texlab#806), [#757](latex-lsp/texlab#757), [#679](latex-lsp/texlab#679))
- Fix coverage of directories which need to be watched for changes ([#502](latex-lsp/texlab#502), [#491](latex-lsp/texlab#491))
- Resolve links of the `import` package correctly
- Use `filterText` of completion items when filtering internally ([#829](latex-lsp/texlab#829))

## [4.3.2] - 2022-11-20

### Fixed

- Do not try to run the TeX engine on package files and fail the build instead ([#801](latex-lsp/texlab#801))
- Handle URIs with URL-encoded drive letters on Windows ([#802](latex-lsp/texlab#802))
- Parse BibTeX entries with unbalanced quotes correctly ([#809](latex-lsp/texlab#809))
- Provide completion for more acronym commands ([#813](latex-lsp/texlab#813))
- Fix parsing acronym definitions ([#813](latex-lsp/texlab#813))

## [4.3.1] - 2022-10-22

### Fixed

- Do not crash with a stack overflow when trying to load packages with many internal dependencies ([#793](latex-lsp/texlab#793))
- Normalize drive letters of all document URIs
- Fix parsing commands that take file paths as arguments ([#789](latex-lsp/texlab#789))
- Use the correct working directory and command line arguments when calling `latexindent` ([#645](latex-lsp/texlab#645))
- Fix publishing to CTAN

## [4.3.0] - 2022-09-25

### Added

- Add inlay hints for `\label{...}` ([#753](latex-lsp/texlab#753))

### Fixed

- Improve accuracy of the error locations reported by the TeX engine ([#738](latex-lsp/texlab#738))
- Reduce number of false positive errors reported by `texlab` ([#745](latex-lsp/texlab#745))
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

3 participants