Drag & Drop into VS Code

Hey Guys,

I've switched to VS Code as my primary LaTeX editor.

When using TexMaker I was able to drag&drop the citekey from zotero directly into my latex source.

Is it possible to obtain this functionality with VS Code?
If so, how can I configure Zotero to enable it?
  • Set your default export style in the Export pane of Zotero preferences to be BetterBibTeX citekey.
  • Which works perfectly fine with TexMaker but (sadly) not with VSCode.

    Somehow Zotero does not recognize VSCode as editor to perform a drag&drop to.
  • What exactly happens when you try to drag a citation to VSCode? What happens if you go to NotePad?
  • It looks like zotero wants to copy the complete bibliography entry into VSCode.

    Right now the Drag & Drop only works with using Texmaker.

    Notepad, Notepad++ and VSCode are not recognized as quick drop targets (see https://github.com/retorquere/zotero-better-bibtex/issues/1085)

    How can I register an editor as quick drop target?
  • edited November 16, 2018
    There's no such thing as a "target". We just put data into the clipboard as text and (for bibliographic formats) HTML, and it's up to applications what they accept.

    You should see the same behavior as when selecting text in Firefox and dragging that to a text field in another program.
    It looks like zotero wants to copy the complete bibliography entry into VSCode.
    I'm not sure what you mean by that. Zotero only generates data in the format specified in the Quick Copy settings, so if you specified the citekey format it wouldn't generate a bibliography.

    In any case, if drag and drop isn't working, you can just use the Quick Copy keyboard shortcut (C, for an export format) to copy and then paste into VS Code manually.
  • @dstillman and @bwiernik thanks for your help.

    I did some investigation in the problem and it look like VS Code does not support Drag & Drop text from outside the editor. (see https://github.com/Microsoft/vscode/issues/42094)

    To bypass the problem you can indeed just use the quick copy keyboard shortcut (crtl+shift+c) to copy the citation to your clipboard and paste it into the editor.

    I will update this discussion as soon as VS Code supports drag&drop from the outside.
  • Right, you can't register an application as a drop target, an application has to indicate to the OS that some parts of its UI are valid drop targets. This is sometimes taken care of by the UI toolkit the app maker uses, but in any case this is something for the app maker (in this case the vscode devs) to fix.
  • Hey @emilianoeheyns , @dstillman , @sbaeurle and @bwiernik
    I've just released my Zotero extension for VS Code and I would love to hear your feedback and whether this solves your problem. Thank you :)

    https://marketplace.visualstudio.com/items?itemName=mblode.zotero
  • That’s very cool! Could you add it to the list of Zotero plugins?
    https://zotero.org/support/plugins
  • @mblode: Before you do so, could you change the name to something other than "Zotero"? Zotero is a trademark, and we ask that third-party software be named so as to avoid any possible confusion. It's OK to reference Zotero as long as it's clear it's not part of Zotero or distributed by us.
  • (Take a look at some of the other Word processor plugins linked above to see the types of names that are commonly used)
  • @dstillman I'm changing the name to "Zotero Citation Picker", is that suitable? Is it also fine if I use the current icon to identify the plugin or that trademarked too?

    Once this is resolved, I'll add it to the plugin page :)
  • "Citation Picker for Zotero" would be better. We know that's a bit unwieldy, but it makes it clear that it's a third-party tool.

    Using the logo in some form is fine, but if you do we'd ask that you use a combo image, similar to what the Brackets integration does. Our guidelines say that the icon can be used to promote Zotero, but using it as the sole icon for another piece of software is a bit confusing.

    Thanks, and sorry for the trouble.
  • Thank you for helping me out with this. I've updated the name of my Visual Studio Code extension to "Citation Picker for Zotero" and I've also changed the icon so I don't use the trademarked logo. Here is the URL: https://marketplace.visualstudio.com/items?itemName=mblode.zotero

    I don't believe I have the admin privileges to update the https://www.zotero.org/support/plugins docs
  • You just have to request editing access (there are a lot of spam bots otherwise). Otherwise, I will try to add it in the next week or so.
Sign In or Register to comment.