Last active
May 22, 2024 14:11
-
-
Save EdieLemoine/a20af730723563366f829ba892a6af54 to your computer and use it in GitHub Desktop.
Patches GitHub Copilot for IntelliJ plugin to work with any IDE version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
### | |
# This script will patch the IntelliJ Copilot plugin to work with any version of IntelliJ IDEs. | |
# - Download the latest plugin from https://plugins.jetbrains.com/plugin/17718-github-copilot/versions/stable | |
# - Run ./this-script.sh <path-to-plugin-jar (or zip)> | |
# Example: ./this-script.sh github-copilot-intellij-1.0.0.jar | |
# - The patched plugin will be located at ./copilot-plugin/github-copilot-intellij-1.0.0.jar. | |
### | |
file=$1 | |
last_dir=$(pwd) | |
working_dir="copilot-plugin-tmp" | |
rm -r "${working_dir}" | |
unzip "${file}" -d "${working_dir}" | |
cd "${working_dir}" | |
unzip github-copilot-intellij/lib/github-copilot-intellij-*.jar | |
sed -i -E 's/until-build="[0-9.*]*"/until-build="999\.\*"/g' META-INF/plugin.xml | |
zip -r github-copilot-intellij/lib/github-copilot-intellij-*.jar META-INF/ | |
rm -r META-INF | |
zip -r "../patched-${file}" github-copilot-intellij/ | |
rm -r github-copilot-intellij | |
rm -r "${working_dir}" | |
cd "${last_dir}" | |
echo "The plugin has been patched and is located at $last_dir/patched-${file}." |
nafg
commented
May 23, 2023
- Can we automate downloading the latest plugin?
- Can we automate installing it into IntelliJ (like the "Get" button on the plugin page)?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment