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

Add VScode #12089

Merged
merged 11 commits into from
Oct 26, 2024
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public enum JabRefIcons implements JabRefIcon {
APPLICATION_SUBLIMETEXT(JabRefMaterialDesignIcon.SUBLIME_TEXT),
APPLICATION_TEXSHOP(JabRefMaterialDesignIcon.TEXSHOP),
APPLICATION_TEXWORS(JabRefMaterialDesignIcon.TEXWORKS),
APPLICATION_VSCODE(JabRefMaterialDesignIcon.VSCODE),
KEY_BINDINGS(MaterialDesignK.KEYBOARD),
FIND_DUPLICATES(MaterialDesignC.CODE_EQUAL),
CONNECT_DB(MaterialDesignC.CLOUD_UPLOAD),
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/push/PushToApplications.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class PushToApplications {
public static final String WIN_EDT = "WinEdt";
public static final String SUBLIME_TEXT = "Sublime Text";
public static final String TEXSHOP = "TeXShop";
public static final String VSCODE = "VScode";

private static final List<PushToApplication> APPLICATIONS = new ArrayList<>();

Expand All @@ -38,7 +39,8 @@ public static List<PushToApplication> getAllApplications(DialogService dialogSer
new PushToTeXworks(dialogService, preferences),
new PushToVim(dialogService, preferences),
new PushToWinEdt(dialogService, preferences),
new PushToTexShop(dialogService, preferences)));
new PushToTexShop(dialogService, preferences),
new PushToVScode(dialogService, preferences)));

return APPLICATIONS;
}
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToVScode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.jabref.gui.push;

import java.nio.file.Path;

import org.jabref.gui.DialogService;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.preferences.GuiPreferences;

public class PushToVScode extends AbstractPushToApplication {

public static final String NAME = PushToApplications.VSCODE;

public PushToVScode(DialogService dialogService, GuiPreferences preferences) {
super(dialogService, preferences);
}

@Override
public String getDisplayName() {
return NAME;
}

@Override
public JabRefIcon getApplicationIcon() {
return IconTheme.JabRefIcons.APPLICATION_VSCODE;
}

@Override
protected String[] getCommandLine(String keyString) {
// No idea to insert the citation to the open tex file in vscode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refs #6775

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a seperate PR.

But link the issue in the TODO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// No idea to insert the citation to the open tex file in vscode
// TODO - Implementing this will fix https://github.com/JabRef/jabref/issues/6775

return new String[] {commandPath};
}

@Override
public String[] jumpToLineCommandlineArguments(Path fileName, int line, int column) {
return new String[] {commandPath, "--g", "%s:%s:%s".formatted(fileName.toString(), line, column)};
}
}
Loading