latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.49k stars 51 forks source link

The LSP stops working as soon as I try to type something #1147

Closed FedericoBruzzone closed 1 month ago

FedericoBruzzone commented 1 month ago

Description

The Language Server Protocol (LSP) stops working as soon as I start typing in Neovim. The issue seems to be related to texlab as indicated by the error messages in the log file.

Environment

Here are the relevant logs when the issue occurs:

[START][2024-06-27 08:15:19] LSP logging initiated
[ERROR][2024-06-27 08:15:19] .../vim/lsp/rpc.lua:770 "rpc" "/home/fcb/.local/share/nvim/mason/bin/texlab" "stderr" "thread 'main' panicked at crates/parser/src/bibtex.rs:255:43:\ncalled `Result::unwrap()` on an `Err` value: ()\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
[ERROR][2024-06-27 08:15:19] .../vim/lsp/rpc.lua:770 "rpc" "/home/fcb/.local/share/nvim/mason/bin/texlab" "stderr" "thread '<unnamed>' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lsp-server-0.7.6/src/stdio.rs:28:37:\nreceiver was dropped, failed to send a message: \"SendError(..)\"\n"

Additional Information

Possible Solution

Investigate the cause of the Err value in the BibTeX parser and handle the error appropriately to avoid the panic.

Thank you for looking into this issue!

pfoerster commented 1 month ago

@FedericoBruzzone Thank you for the report! The error originates from the BibTeX lexer. Do you have an example that you can share? It would make finding the error in the lexer much simpler.

FedericoBruzzone commented 1 month ago

@FedericoBruzzone Thank you for the report! The error originates from the BibTeX lexer. Do you have an example that you can share? It would make finding the error in the lexer much simpler.

Thank you for your immediate response.

I'm currently import lots of bib files:

\bibliography{local,strings,reflection,aosd,my_work,oolanguages,programming,software_engineering,logic,dsl,pl,distributed_systems,grammars,pattern,biomedicine,splc,roles}

trying to uncomment one at a time it occurs as soon as I uncomment software_engineering:

\bibliography{local,strings,reflection,aosd,my_work,oolanguages,programming,software_engineering}

It is a file 5000 lines long, with a manual binary search I was able to find it! :'D

@INPROCEEDINGS{Cuesta02,
  author = {Cuesta, Carlos E. and de la Fuente, Pablo and Barrio-Sol\órzano, Manuel and Beato, Encarnaci\ón},
  title = {{Coordination in a Reflective Architecture Description Language}},
  booktitle = {{Proceedings of the 5th International Conference on Coordination Models and Languages (COORDINATION'02)}},
  year = 2002,
  editor = {Arbab, Fahrad and Talcott, Carolyn},
  pages = {141--148},
  address = {York, United Kingdom},
  organization = {},
  publisher = {Springer},
  volume = {},
  number = {},
  series = {Lecture Notes in Computer Science 2315},
  month = apr,
  note = {}
}

The error is in exactly these two words: "Barrio-Sol\órzano" and "Encarnaci\ón"; of course it's the 's fault.

The resolution to this problem should cover not only this character but also other unicode characters.

I hope I have helped you, if I can be of any further help, please do not hesitate to ask me!