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

No completion for bibliographical entries #55

Closed
manuel-uberti opened this issue Dec 31, 2022 · 8 comments
Closed

No completion for bibliographical entries #55

manuel-uberti opened this issue Dec 31, 2022 · 8 comments

Comments

@manuel-uberti
Copy link

Hi,

I updated Digestif yesterday by removing the .digestif directory and re-running digestif from the command line, but I cannot complete bibliographical entries any more.

This is a small recipe to reproduce the problem:

  • mkdir /tmp/test-completion
  • create a biblio.bib file with the following content:
@Book{test,
  author       = {testy, test},
  title        = {This is a test},
  date         = 2022,
  publisher    = {Test Press}
}
  • create a test.tex file with the following content:
\documentclass[12pt, oneside]{book}

\begin{document}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
  • emacs -Q
  • M-x eglot RET
  • after \begin{document}, try inserting \cite{te and press TAB (or M-x completion-at-point)

This is the content of the Eglot events buffer:

[internal] Sat Dec 31 14:48:35 2022:
(:message "Running language server: /home/manuel/.bin/digestif")
[client-request] (id:1) Sat Dec 31 14:48:35 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 5997 :rootPath "/tmp/test-completion/" :rootUri "file:///tmp/test-completion" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
																	 ())
		      :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges t)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t :workspaceFolders t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false :deprecatedSupport t :resolveSupport
							       (:properties
								["documentation" "details" "additionalTextEdits"])
							       :tagSupport
							       (:valueSet
								[1]))
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["plaintext"])
			:signatureHelp
			(:dynamicRegistration :json-false :signatureInformation
					      (:parameterInformation
					       (:labelOffsetSupport t)
					       :activeParameterSupport t))
			:references
			(:dynamicRegistration :json-false)
			:definition
			(:dynamicRegistration :json-false :linkSupport t)
			:declaration
			(:dynamicRegistration :json-false :linkSupport t)
			:implementation
			(:dynamicRegistration :json-false :linkSupport t)
			:typeDefinition
			(:dynamicRegistration :json-false :linkSupport t)
			:documentSymbol
			(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :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]))
			:documentHighlight
			(:dynamicRegistration :json-false)
			:codeAction
			(:dynamicRegistration :json-false :codeActionLiteralSupport
					      (:codeActionKind
					       (:valueSet
						["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
					      :isPreferredSupport t)
			:formatting
			(:dynamicRegistration :json-false)
			:rangeFormatting
			(:dynamicRegistration :json-false)
			:rename
			(:dynamicRegistration :json-false)
			:publishDiagnostics
			(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
					     (:valueSet
					      [1 2])))
		       :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
						   ()))
		      :workspaceFolders
		      [(:uri "file:///tmp/test-completion" :name "/tmp/test-completion/")]))
[server-reply] (id:1) Sat Dec 31 14:48:36 2022:
(:id 1 :jsonrpc "2.0" :result
     (:capabilities
      (:completionProvider
       (:triggerCharacters
	["\\" "{" "[" "," "="])
       :workspaceSymbolProvider t :documentSymbolProvider t :textDocumentSync
       (:change 2 :openClose t)
       :referencesProvider t :hoverProvider t :definitionProvider t :signatureHelpProvider
       (:triggerCharacters
	["{" "[" "="]))
      :serverInfo
      (:name "Digestif" :version "0.5.1")))
[client-notification] Sat Dec 31 14:48:36 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
							    ()))
[client-notification] Sat Dec 31 14:48:36 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///tmp/test-completion/test.tex" :version 0 :languageId "latex" :text "\\documentclass[12pt, oneside]{book}\n\n\\begin{document}\n\n\\cite{te\n\n\\end{document}\n\n%%% Local Variables:\n%%% mode: latex\n%%% TeX-master: t\n%%% End:\n")))
[client-notification] Sat Dec 31 14:48:36 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///tmp/test-completion/biblio.bib" :version 0 :languageId "latex" :text "@Book{test,\n  author       = {testy, test},\n  title        = {This is a test},\n  date         = 2022,\n  publisher    = {Test Press}\n}")))
[client-notification] Sat Dec 31 14:48:36 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
	  (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
				   ())))
[client-request] (id:2) Sat Dec 31 14:48:44 2022:
(:jsonrpc "2.0" :id 2 :method "textDocument/completion" :params
	  (:textDocument
	   (:uri "file:///tmp/test-completion/test.tex")
	   :position
	   (:line 4 :character 8)
	   :context
	   (:triggerKind 1)))
[server-reply] (id:2) Sat Dec 31 14:48:44 2022:
(:id 2 :jsonrpc "2.0" :result
     [])

I am using GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-12-31

@manuel-uberti
Copy link
Author

For the sake of completeness, I have a more complex .tex file with this at the top:

\usepackage[backend=biber, style=ext-authoryear, giveninits=true]{biblatex}
\addbibresource{biblio.bib}

By working in this file is where I experienced the problem.

@manuel-uberti
Copy link
Author

BTW, not sure if this is related, but M-. on \cite or \textcite results in: xref--not-found-error: No definitions found for: LSP identifier at point.

(Happy new year!)

@manuel-uberti
Copy link
Author

Another debug update: hard resetting to commit f1b4202 makes completion and M-. work again.

@astoff
Copy link
Owner

astoff commented Jan 2, 2023

In your original example, I need to add \bibliography{biblio} somewhere to the file, but otherwise it works as expected.

There is a simple integration test for citations on the CI, so if there was a regression it must be a more subtle issue.

@manuel-uberti
Copy link
Author

In your original example, I need to add \bibliography{biblio} somewhere to the file, but otherwise it works as expected.

It does not work for me though with the following file:

\documentclass[12pt, oneside]{book}

\bibliography{biblio}

\begin{document}

\textcite{te|}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Where | is the cursor where I try to complete. Probably something related to recent Emacs changes on master?

@astoff
Copy link
Owner

astoff commented Jan 3, 2023

Okay, the last example doesn't work because \textcite is defined in biblatex and the file doesn't have the corresponding \usepackage call (so \textci TAB also doesn't complete the command name). But when I add \usepackage{biblatex} all is fine again.

@manuel-uberti
Copy link
Author

manuel-uberti commented Jan 3, 2023

I added \usepackage{biblatex} to the example, but still nothing for me here. Eglot event buffer says:

[client-request] (id:2) Tue Jan  3 13:46:02 2023:
(:jsonrpc "2.0" :id 2 :method "textDocument/completion" :params
	  (:textDocument
	   (:uri "file:///tmp/test-complete/test.tex")
	   :position
	   (:line 7 :character 12)
	   :context
	   (:triggerKind 1)))
[server-reply] (id:2) Tue Jan  3 13:46:03 2023:
(:result
 []
 :jsonrpc "2.0" :id 2)

This is so weird.

Also, sorry to waste your time on something that seems to be happening only here. :)

@astoff
Copy link
Owner

astoff commented Sep 1, 2024

I will close this, but feel free to continue the discussion if needed.

@astoff astoff closed this as completed Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants