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 sublime text editor as external push application #10104

Merged
merged 16 commits into from
Jul 31, 2023
Merged

Add sublime text editor as external push application #10104

merged 16 commits into from
Jul 31, 2023

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented Jul 22, 2023

Fixes #10098

grafik

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@Siedlerchr
Copy link
Member Author

@AdamWysokinski you can test the version here if it already works


@Override
protected String[] getCommandLine(String keyString) {
return new String[] {commandPath, "--command \'insert {\"characters\": \"\\", getCiteCommand() + "{" + keyString + "}\\}\'"};
Copy link
Contributor

@AdamWysokinski AdamWysokinski Jul 22, 2023

Choose a reason for hiding this comment

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

I've placed some backslashes incorrectly, I think the returned string should be:

return new String[] {commandPath, "--command \'insert {\"characters\": \"", getCiteCommand() + "{" + keyString + "}\"}\'"};

@Siedlerchr
Copy link
Member Author

I installed Sublime text on mac as well and tested around, from the command line it works

/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl  --command 'insert {"characters": "\\cite{Woblewsky2020}"}'

but not from JabRef yet, not exactly sure, Maybe it works for you?

New version wil be built automatically

@AdamWysokinski
Copy link
Contributor

It doesn't work here, either. Now it switches the focus to Sublime Text, but does not paste anything. Previously it has been creating an empty file named \cite{wysokinski_2023}.

Can we log or output the command string that is being generated?

Also, the Sublime command should be subl by default (now it's sublime).

Also also, I thinks this icon: https://icon-sets.iconify.design/simple-icons/sublimetext/ is perfect for the job.

@Siedlerchr
Copy link
Member Author

I tested with setting path to subl and various simple arguments like -v. That works. My valid guess is that something in the ProcessBuilder does not work the json string arg, but I don't know why.
Running it on the terminal works.
I added output for the generated String

@AdamWysokinski
Copy link
Contributor

Ok, let's try again, I think I know where the problem is. Please try this:

return new String[] {commandPath, "--command \'insert {\"characters\": \"", getCiteCommand() + "\{" + keyString + "\}\"}\'"};

todo test with windows
* upstream/main: (32 commits)
  Bump org.junit.platform:junit-platform-launcher from 1.9.3 to 1.10.0
  New translations JabRef_en.properties (Indonesian)
  New translations JabRef_en.properties (Italian)
  New translations JabRef_en.properties (French)
  Bump org.openrewrite.rewrite from 6.1.16 to 6.1.19
  Bump org.junit.jupiter:junit-jupiter from 5.9.3 to 5.10.0
  Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.0.7 to 2.1.0
  Bump appleboy/ssh-action from 0.1.10 to 1.0.0
  New translations JabRef_en.properties (Tagalog)
  New translations JabRef_en.properties (Persian)
  New translations JabRef_en.properties (Indonesian)
  New translations JabRef_en.properties (Portuguese, Brazilian)
  New translations JabRef_en.properties (Vietnamese)
  New translations JabRef_en.properties (Chinese Traditional)
  New translations JabRef_en.properties (Chinese Simplified)
  New translations JabRef_en.properties (Ukrainian)
  New translations JabRef_en.properties (Turkish)
  New translations JabRef_en.properties (Swedish)
  New translations JabRef_en.properties (Russian)
  New translations JabRef_en.properties (Portuguese)
  ...
@Siedlerchr
Copy link
Member Author

@AdamWysokinski I made it work now by starting a shell first and giving the whole application path + command string as argument for the shell.

In the log the caller string is shown as well

Regarding your string: The process builder takes the first array arg as program and every. In your case, the argument getCitecommand was interpreted as the file argument

I am having a mac and here it works, guess lInux should work as well. Windows needs probably some more escaping of double quotes

@AdamWysokinski
Copy link
Contributor

It works great on Linux after entering the whole path for subl command (/usr/bin/subl).
Many thanks!

@Siedlerchr
Copy link
Member Author

Now with proper icon

@JabRef JabRef deleted a comment from github-actions bot Jul 26, 2023
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Small code style comments. If it does not work on Windows, we can fix later

* upstream/main:
  New translations JabRef_en.properties (Dutch)
  New translations JabRef_en.properties (Dutch)
  New translations JabRef_en.properties (German)
@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jul 31, 2023
@github-actions
Copy link
Contributor

Your code currently does not meet JabRef's code guidelines. The tool reviewdog already placed comments on GitHub to indicate the places. See the tab "Files" in you PR. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.

More information on code quality in JabRef is available at https://devdocs.jabref.org/getting-into-the-code/development-strategy.html.

* upstream/main:
  Bump org.apache.commons:commons-lang3 from 3.12.0 to 3.13.0
  Bump com.puppycrawl.tools:checkstyle from 10.12.1 to 10.12.2
  Bump org.bouncycastle:bcprov-jdk18on from 1.75 to 1.76
  New translations JabRef_en.properties (Dutch)
@github-actions
Copy link
Contributor

github-actions bot commented Jul 31, 2023

The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build.

@koppor koppor merged commit ebc1c37 into main Jul 31, 2023
@koppor koppor deleted the subblime branch July 31, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add SublimeText to external programs
3 participants