latex-lsp / texlab Goto Github PK
View Code? Open in Web Editor NEWAn implementation of the Language Server Protocol for LaTeX
License: GNU General Public License v3.0
An implementation of the Language Server Protocol for LaTeX
License: GNU General Public License v3.0
Hovering over bibtex entry with crossref field fails with an exception:
Exception in thread "DefaultDispatcher-worker-6" org.jbibtex.ObjectResolutionException
at org.jbibtex.BibTeXParser.checkCrossReferenceResolution(BibTeXParser.java:130)
at org.jbibtex.BibTeXParser.resolveCrossReferences(BibTeXParser.java:113)
at org.jbibtex.BibTeXParser.Database(BibTeXParser.java:274)
at org.jbibtex.BibTeXParser.parse(BibTeXParser.java:57)
at de.undercouch.citeproc.bibtex.BibTeXConverter.loadDatabase(BibTeXConverter.java:149)
at texlab.completion.bibtex.BibtexCitationActor$actor$1$1.invokeSuspend(BibtexCitationActor.kt:22)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.kt:116)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:76)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:53)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:35)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at texlab.completion.bibtex.BibtexCitationActor$actor$1.invokeSuspend(BibtexCitationActor.kt:17)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)
If I understand correctly, the LSP specification for "go to definition" allows including a LocationLink
that contains a range for the target. Could this be used to make PeekDefinition
on a label only show exactly the labelled environment (plus maybe one or two lines above, possibly configurable)?
Alternatively (if this is even the responsibility of the server and not the client), could the shown preview be changed so that the targeted symbol is always at a fixed position from the top (first, second, third line, depending on the margin)?
When I type a control sequence inside \(...\)
, very few candidates appear in the completion list. For example, \beta
is missing in the following picture.
Just type a control sequence inside \(...\)
. Note that completion works well inside $...$
, which is almost the same as \(...\)
in LaTeX, as far as I know.
Completion list should contain the same candidates (e.g. \beta
) as the case of $...$
, as in the following picture.
$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
$ latex --version
pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian)
kpathsea version 6.2.1
It seems that the language server by default builds the current TeX file on save. This conflicts with my vimtex
plugin, which offers a similar function (but with more features such as call-backs which update the PDF viewer on success and opens an error list on failure).
Is there any way to disable this functionality (or make it opt-in)?
Hi,
first of all, thanks a lot for this project. This looks like a great improvement for my latex workflow. Code completion works nicely for me :)
On https://texlab.netlify.com/, it says that texlab supports the go to definition feature, but I can't get it to work. I've tried the following minimal document in both emacs' lsp-mode
and a vanilla VS Code installation + the texlab extension:
\documentclass{article}
\begin{document}
\newcommand{\test}{test}
hello \test{}
\end{document}
In both editors, going to the definition of \test
does not work.
It would be helpful when debugging clients if the errors in error messages were deserialized (either data
or message
).
In addition, it might be helpful to use window/showMessage
or window/logMessage
for actual errors or logging?
(Oh, and texlab is the model language server for the recently merged LSP functionality in core neovim: https://github.com/norcalli/nvim-common-lsp ๐ )
(Another suggestion cribbed from vimtex, which provides this as part of a general "table of contents" functionality)
I notice that texlab currently doesn't seem to provide the Workspace/DocumentSymbol functionality (it's listed on the website, but I don't see how to access this from VS Code, and vim-lsp gives "Retrieving symbols not supported for tex"). It would be useful to return a list of all labels, which the client can present as a way to navigate the project -- especially if this list could be filtered to only show equations (and other math-mode environments), or sections (and other sectioning commands), or theorems (and other such environments). EDIT: For BibTeX files, the function could return a list of all bibkeys.
On the documentation page about previewing, it mentions that we should pass the -pv
flag to the latex.build.args
setting.
I think the documentation should mention that one should pass the -pvc
flag if one does not want to launch a new instance of the PDF viewer after every build. (At least one other person strongly recommends -pvc with texlab).
EDIT: Suggested documentation should read as follows:
With latexmk, you can enable the preview feature by adding the
-pv
flag to the latex.build.args setting. Alternatively, use the-pvc
flag to tell the previewer to continuously check for updates, instead of opening a new window each time a build completes.
I just compiled 1.4.0 using the AUR package and it got the following warning in the jsonrpc
crate:
warning: unused `runtime::task::JoinHandle` that must be used
--> crates/jsonrpc/src/lib.rs:39:21
|
39 | / runtime::spawn(async move {
40 | | let response = server.handle_request(request).await;
41 | | let json = serde_json::to_string(&response).unwrap();
42 | | output.send(json).await.unwrap();
43 | | server.execute_actions().await;
44 | | });
| |_______________________^
| = note: `#[warn(unused_must_use)]` on by default
= note: futures do nothing unless you `.await` or poll them
warning: unused `runtime::task::JoinHandle` that must be used
--> crates/jsonrpc/src/lib.rs:49:21
|
49 | / runtime::spawn(async move {
50 | | server.execute_actions().await;
51 | | });
| |_______________________^
|
I noticed two small issues with parsing subcaption
labels in document symbols (and completion) only:
If I have subfigures
, the containing figure
incorrectly gets the label from the first subfigure
(i.e., Figure 1a
instead of Figure 1
). The problem is that the figure label is not the first label in the containing environment (since captions are usually below figures); if the caption is moved to the top of the environment, it is picked up correctly. Note that this is an issue in parsing the aux
file; the caption is still correctly linked to the figure
environment, e.g., in the LocationLink
of GotoDefinition
.
subtables
do not seem to be supported (the environment isn't autocompleted, and they don't appear in the symbol list). EDIT: This is an easy fix, see #89
Brief example, in case it's useful:
\documentclass{article}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}{0.4\textwidth}
\caption{A subfigure}
\label{fig1a}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
\caption{Another subfigure}
\label{fig1b}
\end{subfigure}
\caption{A figure}
\label{fig1}
\end{figure}
\begin{table}
\begin{subtable}{0.4\textwidth}
\caption{A subtable}
\label{tab1a}
\end{subtable}
\begin{subtable}{0.4\textwidth}
\caption{Another subtable}
\label{tab1b}
\end{subtable}
\caption{A table}
\label{tab1}
\end{table}
\end{document}
Aux file:
\relax
\providecommand\hyper@newdestlabel[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}
\providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}}
\newlabel{fig1a}{{1a}{1}{A subfigure\relax }{figure.caption.1}{}}
\newlabel{sub@fig1a}{{a}{1}{A subfigure\relax }{figure.caption.1}{}}
\newlabel{fig1b}{{1b}{1}{Another subfigure\relax }{figure.caption.1}{}}
\newlabel{sub@fig1b}{{b}{1}{Another subfigure\relax }{figure.caption.1}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces A figure\relax }}{1}{figure.caption. 1}\protected@file@percent }
\newlabel{fig1}{{1}{1}{A figure\relax }{figure.caption.1}{}}
\newlabel{tab1a}{{1a}{1}{A subtable\relax }{table.caption.2}{}}
\newlabel{sub@tab1a}{{a}{1}{A subtable\relax }{table.caption.2}{}}
\newlabel{tab1b}{{1b}{1}{Another subtable\relax }{table.caption.2}{}}
\newlabel{sub@tab1b}{{b}{1}{Another subtable\relax }{table.caption.2}{}}
\@writefile{lot}{\contentsline {table}{\numberline {1}{\ignorespaces A table\relax }}{1}{table.caption. 2}\protected@file@percent }
\newlabel{tab1}{{1}{1}{A table\relax }{table.caption.2}{}}
I'm using texlab through coc-texlab on [neo]vim, but I also use ALE (with let g:ale_lint_on_insert_leave = 1
and let g:ale_lint_on_text_changed = 'normal'
to avoid linting on every character input, but still have it after normal mode edits and when leaving insert mode). I'm currently getting diagnostics after text edits solely through ALE (it's picking it from chktex
), not from texlab. texlab only provides diagnostics on file save. I wish I could get diagnostics on the fly, so I could disable ALE.
I know this is a great ask, but it would help distribute this really impressive work. Texlab should be installed and updated within the users ecosystem of tools. This presents three options:
Option one is in every case a bad idea and should be avoided. Option two would leave you with much packaging and is not optimal. Option three should be the goal. Please consider, i don't know how much work lies behind those options. Feel free to ignore my heavy request and thank you for this project.
Related to #1: Could TexLab support packages like https://ctan.org/pkg/cleveref, which use different commands for inserting references (e.g. \cref{}
)? More generally, it seems it would be useful for there to be an option to customize the commands that trigger a certain sort of completion, e.g. reference commands, citation commands, etc.
Here's a far-out question (and feel free to close if it's too far out): I'm using (neo)vim, a text-based editor, so the markdown-based LaTeX preview isn't really helpful for me. Would it be possible to (optionally, e.g., with a command line flag) offer unicode preview for equation hover? There are some converters out there that can convert LaTeX to unicode, e.g.,
Or at least for the documentation of commands (e.g., ฮฑ
for \alpha
)?
(On a related note, have you seen https://tectonic-typesetting.github.io? Looks like a TeX engine written in Rust, which could be useful for preview features in general.)
๐ to removing the node dependency for citeproc! (I'll see about updating the homebrew PR -- if it's still not merged...)
I (only) noticed one regression: DOIs are no longer parsed but appear in the hover preview as, e.g.,
https://doi.org/[10.1007/978\-94\-007\-2247\-7](10.1007/978-
94-007-2247-7)
Does it possible to set up the previewing and build on save in nvim just like vimtex?
I see the document here https://texlab.netlify.com/docs/installation/previewing. But have no idea how to configure in nvim.
Hi,
I am not much used to with jar files.
I am using texlab with vim and Coc.
Can you please tell me how to install the file? java -jar texlab.jar
is not doing any thing. Can I just place it in /usr/local/ and give the path to Coc?
Coc: https://github.com/neoclide/coc.nvim
CocLatex: https://github.com/neoclide/coc.nvim/wiki/Language-servers#latex
I am using vim8.
Thanks.
Firstly, thanks for creating this project!
It would be great to extend the completion support for references and citations to support the following things:
\eqref
,\bibliography{path/to/bib}
,\cite{
the completion window contains not just the cite key but the author and title (I am not sure but I thought this could be done by setting the either the detaill property or the documentation property of the completion),Personally I would find these features particularly useful, all of my citation keys are some unique identifier that are not very instructive as to what is being cited (most of the citation keys I use are the same as used on mathsci.net).
I hope I'm not missing something here, but as far as I can tell, texlive only
works in one file at a time. Most of my latex documents are split into separate
files, i.e.
% Setup
\begin{document}
\input{src/introduction}
\input{src/background}
% ...
\end{document}
It would be great to have completion across these input files, and using the
packages defined in the main file. Is this possible right now, if not, how
difficult do you think it would be to support? I wouldn't mind trying to add
support for it if it's not too much effort.
The build feature freezes frequently on Windows. This can be reproduced by saving the the document and build it directly afterwards. The workaround for this issue is to use the server when it freezes e.g. by editing the text document. This causes the build to continue normally.
The issue seems to be related to the Windows specific process event handling of the tokio-process crate. It would be good to have a small reproduction example to submit this isssue to the repo. Any help is greatly appreciated.
I'm trying to install this project from source by using cargo install --path .
which gives me the following error:
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
--> src/tex.rs:54:5
|
54 | / Command::new(format.executable())
55 | | .args(&["--interaction=batchmode", "-shell-escape", file_name])
56 | | .current_dir(&directory)
57 | | .stdout(Stdio::null())
58 | | .stderr(Stdio::null())
59 | | .status()
60 | | .map_err(|_| CompileError::LatexNotInstalled)?
| |______________________________________________________^ the `?` operator cannot be applied to type `futures_util::try_future::map_err::MapErr<impl core::future::future::Future, [closure@src/tex.rs:60:18: 60:53]>`
|
= help: the trait `std::ops::Try` is not implemented for `futures_util::try_future::map_err::MapErr<impl core::future::future::Future, [closure@src/tex.rs:60:18: 60:53]>`
= note: required by `std::ops::Try::into_result
This happens with a freshly installed beta (rustup update beta
), nightly-2019-10-04
and the nightly version specified in the CI files here.
However, cargo build --release
seems to work, which is a bit weird since I was under the impression that install just runs cargo build --release
.
I tried both the current master, and the 1.6.0
tag
When hovering over lowercase fields of bibtex entries, the definition appears, which is not the case with uppercase fields.
This is inconvenient because bibtex tags are case insensitive, I believe: http://www.bibtex.org/Format/.
This is actually two independent but related issues:
\eqref{eq1}
, not just \label{eq1}
).But this might be annoying to some? In particular 2. may be redundant, since you can easily go directly to the definition.
Completion on symbols that include colons (such as eq:strong-convergence
) can lead to incorrect substitutions. I've originally reported this for vim-lsp (prabirshrestha/vim-lsp#420), but it turns out the issue occurs in VS Code as well (slightly differently).
Here's a minimal example from @thomasfaingnaert:
documentclass{article}
\begin{document}
\section{Foo bar}%
\label{sec:foo_bar}
\ref{sec:foo<cursor here>}
\end{document}
The language server then correctly suggests sec:foo_bar
, but when I select it, it inserts it after the initial sec:
, i.e., I get sec:sec:foo_bar
. (vim-lsp turns that into \ref{sec:barsec:foo_bar}
instead.)
The relevant part of the log is
Thu 27 Jun 2019 15:19:36 CEST:["--->",1,"texlab",{"method":"textDocument/completion","on_notification":"---funcref---","params":{"textDocument":{"uri":"file:///home/thomas/test.tex"},"position":{"character":12,"line":5}}}]
Thu 27 Jun 2019 15:19:36 CEST:["<---",1,"texlab",{"response":{"id":41,"jsonrpc":"2.0","result":{"isIncomplete":true,"items":[{"label":"sec:foo_bar","data":"Label","kind":5}]}},"request":{"id":41,"jsonrpc":"2.0","method":"textDocument/completion","params":{"textDocument":{"uri":"file:///home/thomas/test.tex"},"position":{"character":12,"line":5}}}}]
i.e., texlab gives the wrong position. (A related issue is with renaming: if I rename sec:foo_bar
, the prefilled text is just foo_bar
, but the whole label (including sec:
) is replaced with what I write. This is much less critical, of course.)
@thomasfaingnaert suggests not using labels for completions but rather text-edits, which is a newer part of the LSP protocol.
(also split off from #31)
Would it make sense (and be possible) to use different kind
s for BibTeX completions and documentSymbols
to distinguish article
, book
, inproceedings
, misc
etc.? (Assuming there are enough left?)
BibTeX itself only knows 13 entries:
and I would group some of them (book
/booklet
/proceedings
, inbook
/incollection
/inproceedings
, mastersthesis
/phdthesis
,
unpublished
/techreport
/manual
/misc
).
BibLaTeX knows many more entries, though, but most of them could either be grouped into one of the above equivalence classes or just left as plain reference
.
(I would definitely not go down the list of fields: author
, title
, etc.)
Providing -shell-escape
in latex.build.args
does not work, since it is not passed to latexmk, but rather to latex itself. From the logs:
===== 'mode=convert with system call': Invoking 'latex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "cache/schroeter-figure0" "\def\tikzextern
alrealjob{schroeter}\input{schroeter}" && dvips -o "cache/schroeter-figure0".ps
"cache/schroeter-figure0".dvi ' ========
<cache/schroeter-figure0.ps>This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
\write18 enabled.
entering extended mode
This is dvips(k) 5.998 Copyright 2018 Radical Eye Software (www.radicaleye.com)
' TeX output 2019.09.03:0809' -> cache/schroeter-figure1.ps
</usr/share/texlive/texmf-dist/dvips/base/tex.pro>
</usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc>
</usr/share/texlive/texmf-dist/dvips/base/texps.pro>
</usr/share/texlive/texmf-dist/dvips/base/special.pro>
</usr/share/texlive/texmf-dist/dvips/base/color.pro>.
</usr/share/texlive/texmf-dist/fonts/type1/urw/times/utmr8a.pfb>[1]
===== 'mode=convert with system call': Invoking 'latex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "cache/schroeter-figure1" "\def\tikzextern
alrealjob{schroeter}\input{schroeter}" && dvips -o "cache/schroeter-figure1".ps
"cache/schroeter-figure1".dvi ' ========
<cache/schroeter-figure1.ps>This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
\write18 enabled.
entering extended mode
system returned with code 256
===== 'mode=convert with system call': Invoking 'latex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "cache/schroeter-figure2" "\def\tikzextern
alrealjob{schroeter}\input{schroeter}" && dvips -o "cache/schroeter-figure2".ps
"cache/schroeter-figure2".dvi ' ========
! Package tikz Error: Sorry, the system call 'latex -shell-escape -halt-on-erro
r -interaction=batchmode -jobname "cache/schroeter-figure2" "\def\tikzexternalr
ealjob{schroeter}\input{schroeter}" && dvips -o "cache/schroeter-figure2".ps "c
ache/schroeter-figure2".dvi ' did NOT result in a usable output file 'cache/sch
roeter-figure2' (expected one of .epsi:.eps:.ps:). Please verify that you have
enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes
it is also named 'write 18' or something like that. Or maybe the command simpl
y failed? Error messages can be found in 'cache/schroeter-figure2.log'. If you
continue now, I'll try to typeset the picture.
(Another one from https://github.com/lervag/vimtex; not sure if it's doable server-side. Vimtex parses the aux file for this, so requires a compilation run before it works; texlab seems smarter in that it does not require this? I have to admit that I'm not completely sure how the LSP completion actually works...)
Would it be possible to offer completion based on the actual contents of the reference? For example, in vimtex I can do the following (<c-x c-o>
is the default keystroke to trigger completion):
\eqref{2.1<c-x c-o>
and get (among others) \eqref{eq:integral
, if the equation has the tag "(2.1)"; similarly for chapters, sections, theorems etc.\cite{Hilb<c-x c-o>
and get (among others) \cite{Courant:1953
, if the bib entry is@book{Courant:1953,
author = {Courant, Richard and Hilbert, David},
title = {Methods of Mathematical Physics},
year = {1953},
}
and similar with \cite{Physics<c-x c-o>
, \cite{1953<c-x c-o>
, etc.
(followup to #31)
It would be nice to have the global list of workspaceSymbols
sorted by project order rather than alphabetically by file name: At the moment, if I have main.tex that includes -- in this order -- b.tex and a.tex, a workspaceSymbols
request gives the (correctly sorted) symbols in a.tex before those in b.tex before those in main.tex, while the other way around would be more natural.
Hi
When trying to build, I get the following exception:
> Task :discoverMainScriptsExtensions
e: /home/pleroux/Repositories/texlab/src/main/kotlin/texlab/LatexLanguageServer.kt: (4, 33): Symbol is declared in module 'java.naming' which does not export package 'com.sun.jndi.toolkit.url'
> Task :compileKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.2.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
2 actionable tasks: 2 executed
I'm using ArchLinux with OpenJDK 11.0.3. Any help to get it up and running will be much appreciated.
I'm sorry if this comes out as a noob's question because I not really experienced in building Rust projects.
I'm trying to build from source a v1.5.0 Git checkout of this repo and I get the following error when building:
error[E0658]: async blocks are unstable
--> /home/doron/.cargo/registry/src/github.com-1ecc6299db9ec823/runtime-raw-0.3.0-alpha.5/src/lib.rs:65:15
|
65 | let fut = async move {
| _______________^
66 | | let t = fut.await;
67 | | let _ = tx.send(t);
68 | | };
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/50547
error[E0658]: async/await is unstable
--> /home/doron/.cargo/registry/src/github.com-1ecc6299db9ec823/runtime-raw-0.3.0-alpha.5/src/lib.rs:66:17
|
66 | let t = fut.await;
| ^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/50547
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
error: Could not compile `runtime-raw`.
I use rustup and I have the rust-toolchain
needed installed. All of the following cargo build
commands failed the same way:
cargo build
$(rustup which cargo) build
rustup toolchain default $(cat rust-toolchain) && cargo build
I understand that this is exactly why you use a specific rust toolchain but I don't understand why non of the above worked.
Starting from v1.0.0, the latex.build.cancel
command is not implemented yet.
This will be addressed soon.
(followup to #31, but also relevant for completion and hover)
For hover, completion, documentSymbols, and workspaceSymbols, texlab extracts the label numbers from the aux files. If the document is changed and (re)built, this is then not picked up. Since for multi-file projects, the client may not be aware of all (especially aux) files while texlab has a project tree, it would be good if texlab didn't rely on workspace/didChangeWatchedFiles
notifications from the client.
Instead, I would propose a custom notification (e.g., workspace/projectBuilt
) that the client can send whenever it thinks that one (and thus, in almost all cases, all) aux files in the project have changed. This would then trigger reparsing all aux files in the current project. (Naturally, texlab
s custom textDocument/build
command can do this internally.)
I may be misunderstanding how this works, but I can't get the language server to operate on any TeX file but the currently open one (or the included bibliography file). Specifically, I can't get completions from other files, while go to definition and list all references works (now; rust branch); renaming also only seems to affect the currently open file (but this might be an issue with calling the LSP from vim).
Hello,
Thank you for this great project.
Do you think it would be possible to ship texlab on CTAN?
I do not have any experience with CTAN, and shipping binaries might even be more complex.
I just wanted to start the discussion, maybe you were already thinking about this.
The language support doesn't work. I run the server for Vim with autozimu/LanguageClient-neovim on Windows 7. When I open a tex file, I get this message:
The procedure entry point GetSystemTimePreciseAsFileTime could not be located in the dynamic link library KERNEL32.dll.
When I googled the problem, I found grijjy/DelphiDuktape#1 which seems to imply that this function is not available on Windows 7, but I guess the server calls it somehow. The docs confirm that it's not supported.
Am I correct? If so, I wish you would support Windows 7. If other users have got this running on Windows 7, I would appreciate some help figuring out what I did wrong.
More of a question really. I typically keep all my style files in that directory and don't seem to be getting completion support for environments, macros etc. defined there.
Second question: even if texlab
doesn't automatically look there, is there a way to add that directory to the current workspace?
Many thanks for all of your work!
I tried to use this software in Emacs using lsp-mode. But it does not work.
'''
mar 31, 2019 10:01:59 EM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.util.NoSuchElementException: Collection contains no element matching the predicate.
java.util.concurrent.CompletionException: java.util.NoSuchElementException: Collection contains no element matching the predicate.
at java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
at java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
at java.util.concurrent.CompletableFuture.uniAccept(Unknown Source)
at java.util.concurrent.CompletableFuture$UniAccept.tryFire(Unknown Source)
at java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
at java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)
at kotlinx.coroutines.future.CompletableFutureCoroutine.onCompletedExceptionally(Future.kt:61)
at kotlinx.coroutines.AbstractCoroutine.onCompletionInternal$kotlinx_coroutines_core(AbstractCoroutine.kt:106)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:305)
at kotlinx.coroutines.JobSupport.tryFinalizeFinishingState(JobSupport.kt:230)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:799)
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:742)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:117)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)
Caused by: java.util.NoSuchElementException: Collection contains no element matching the predicate.
at texlab.provider.FeatureRequest.(FeatureRequest.kt:16)
at texlab.LatexLanguageServer$runFeature$2.invokeSuspend(LatexLanguageServer.kt:428)
at texlab.LatexLanguageServer$runFeature$2.invoke(LatexLanguageServer.kt)
at texlab.WorkspaceActor.withWorkspace(WorkspaceActor.kt:34)
at texlab.WorkspaceActor$withWorkspace$1.invokeSuspend(WorkspaceActor.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
... 4 more
Exception in thread "DefaultDispatcher-worker-8" java.lang.IllegalStateException: directory.resolve(MIKTEX .listFiles() must not be null
at texlab.resolver.LatexResolver$Companion.readDatabase(LatexResolver.kt:97)
at texlab.resolver.LatexResolver$Companion.create(LatexResolver.kt:35)
at texlab.LatexLanguageServer$resolver$1.invokeSuspend(LatexLanguageServer.kt:74)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)
mar 31, 2019 10:02:00 EM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.util.NoSuchElementException: Collection contains no element matching the predicate.
java.util.concurrent.CompletionException: java.util.NoSuchElementException: Collection contains no element matching the predicate.
at java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
at java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
at java.util.concurrent.CompletableFuture.uniAccept(Unknown Source)
at java.util.concurrent.CompletableFuture$UniAccept.tryFire(Unknown Source)
at java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
at java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)
at kotlinx.coroutines.future.CompletableFutureCoroutine.onCompletedExceptionally(Future.kt:61)
at kotlinx.coroutines.AbstractCoroutine.onCompletionInternal$kotlinx_coroutines_core(AbstractCoroutine.kt:106)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:305)
at kotlinx.coroutines.JobSupport.tryFinalizeFinishingState(JobSupport.kt:230)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:799)
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:742)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:117)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)
Caused by: java.util.NoSuchElementException: Collection contains no element matching the predicate.
at texlab.provider.FeatureRequest.(FeatureRequest.kt:16)
at texlab.LatexLanguageServer$runFeature$2.invokeSuspend(LatexLanguageServer.kt:428)
at texlab.LatexLanguageServer$runFeature$2.invoke(LatexLanguageServer.kt)
at texlab.WorkspaceActor.withWorkspace(WorkspaceActor.kt:34)
at texlab.WorkspaceActor$withWorkspace$1.invokeSuspend(WorkspaceActor.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
... 4 more
'''
latex and kpsewhich is on the path ...
(This is the first feature request based on the completion offered by https://github.com/lervag/vimtex.)
In principle, the LSP client is responsible for filtering completion results, but an option that would make sense on the server side is when completing in \eqref{
, only provide labels from math environments (equation(*)
, align(at)(*)
, multline(*)
).
(If this is actually feasible; otherwise just close the issue.)
I noticed a few issues with references (let me know if these should be made into separate issues):
\bibliography{bibfile}
.\cite{A,B}
).I also couldn't reformat if I use https://github.com/prabirshrestha/vim-lsp to call the client (it works with the vscode extension); all I get is Failed to document format for texlab: j
.
I suspect that the server answers this request with a non-standard response; let me know what I can do to get to the bottom of this.
(This is with the rust branch, FWIW.)
The openssl version on my computer is 1.0.2.
Is it possible to run texlab in this older version?
I noticed that when asking for completions on \begin{
, typical suspects such as theorem
, lemma
, proof
, etc. are missing from the list of candidates.
(I'm spoiled; vimtex has a huge list of completions generated via convert-cwl
, see https://github.com/lervag/vimtex/tree/master/autoload/vimtex/complete. Also, one neat related feature is that when completing for \end{
, the first match is always the environment from the last unclosed \begin{...}
above.)
EDIT: the corpus also contains information about the package the environment (or command) is defined in, which can (and is by vimtex) shown as a preview (rather than "user-defined").
(Sorry for the vague title, couldn't think of a better one.)
Currently, texlab provides the formatted reference of labels in completion as a Documentation
. Since these are rather short, I personally would prefer them as Details
(since vim-lsp can show them in-line in the completion menu), at least additionally. (For floats such as figure
environments, the caption text is indeed better put into a Documentation
.)
Also, how is the formatted reference for bibtex items done in VS Code? I don't see a Documentation
field in the log. (Having the output of Hover
in there would be useful.) For reference, vimtex completion results for bibtex items include Details
in the form of a simple string
Authors (Year) , "Title"
(where authors are either Author
, Author1 & Author2
, or Author1 et al.
). I find that this is sufficient (and helpful) to more quickly find the reference I want from a long list of similar keys.
Finally, while I'm at it, there's a small issue with the filter text of bib items. If you have something like
@book{Adams:2003a,
author = {Adams, Robert A. and Fournier, John J. F.},
edition = {2},
location = {Amsterdam},
publisher = {Academic Press},
title = {Sobolev {S}paces},
year = {2003},
}
the title will show up as Sobolev S paces
.
It may be a bit premature, but I wanted to test the new rust re-implementation. However, that branch fails to build: doing cargo build --release
(with the latest rust nightly) yields the error
error: couldn't read src/data/../../citeproc/dist/citeproc.js: No such file or directory (os error 2)
when compiling the texlab component. (That file indeed can't be found in the texlab tree -- or am I missing a step in building?)
Hello,
it would be an awesome feature if unused bibtex entries are marked with a warning in order that I can delete them to keep my bibtex file clean.
I think there's an unwanted clash for completionItemKinds
: Both environment
and item
are assigned to enumMember
:
texlab/src/completion/factory.rs
Line 120 in 58633bf
I assume that the former should be enum
(as it is for symbolKind
)?
There's also theorem
, package
, and class
that are all assigned to class
(7).
Also, both item
and book
are assigned to struct
.
These clashes prevent overriding the LSP kinds with the proper names (package
and class
can share a -- separate -- kind; since I don't need to distinguish them, I'll probably assign them an empty label anyway.)
(It would be helpful for that to have a list of correspondences between LaTeX structures and LSP kinds (completion and symbol) somewhere on the texlab website or the wiki here.)
I have custom document classes that define standard environments using amsthm
(theorem, proposition, lemma, definition) etc. These are not picked up by texlab for the purpose of setting LocationLinks for PeekDefinition (i.e., popup shows just the label, not the whole environment).
In other words, texlab should consider .cls
files just like .tex
and .sty
files for environment definitions.
(related to #29)
I try use this language server with a language client for neovim
But it doesn't seem to work.
I'm starting the server without any argument
\ 'tex': ['~/bin/texlab'],
As the title says, if I trigger hover on \cite{X}
with the provided macOS build (1.2.0), I just get
No hover information found
. (Hover on other symbols works as expected; on Linux everything works as expected.)
The stderr
output is simply
TRACE - Sent message:
Content-Length: 39^M
^M
{"jsonrpc":"2.0","result":null,"id":10}
Possibly the citeproc
dependency is not correctly built on the macOS pipeline?
EDIT It works if I build texlab on that machine from source (master).
EDIT2 Hover on equations isn't working on macOS either, also not if built from source, so there's another dependency issue. I didn't see any build errors or warnings, though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.