Skip to content

Support start with other IDEs in Github #59

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tasks:
gp sync-await start &&
gp await-port 6080 &&
for i in `seq 10 -1 1` ; do echo -ne "\rStarting Chrome in $i " && sleep 1 && echo -ne "\r" ; done &&
google-chrome --no-first-run --disable-dev-shm-usage --start-maximized --load-extension=/workspace/browser-extension https://github.com/gitpod-io/template-sveltekit
google-chrome --no-first-run --disable-dev-shm-usage --start-maximized --load-extension=/workspace/browser-extension https://github.com/gitpod-io/template-sveltekit https://github.com/gitpod-io/gitpod/pull/9378 https://github.com/gitpod-io/gitpod/issues/6707 https://github.com/gitpod-io/gitpod/blob/main/components/supervisor-api/notification.proto
- name: Webpack Dev Server
init: yarn install && yarn build && yarn package
command: >
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"dom-loaded": "^2.0.0",
"github-injection": "^1.0.1",
"select-dom": "^5.1.0",
"webextension-polyfill": "^0.7.0"
"webextension-polyfill": "^0.7.0",
"@gitpod/gitpod-protocol": "main"
},
"devDependencies": {
"copy-webpack-plugin": "^7.0.0",
Expand Down
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ export interface Config {
gitpodURL: string;
openAsPopup: boolean;
rewritePeriodKeybind: boolean;
useLatest: boolean;
}

export const DEFAULT_CONFIG: Config = {
gitpodURL: "https://gitpod.io",
openAsPopup: false,
rewritePeriodKeybind: false
rewritePeriodKeybind: false,
useLatest: false,
};

export interface ConfigListener {
Expand Down
2 changes: 1 addition & 1 deletion src/gitpodify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const init = async (injectedByUserClick: boolean = false) => {

if (injectedByUserClick) {
// User clicked on the Gitpod extension icon. We open the Gitpod with this page as context.
window.open(renderGitpodUrl(config.gitpodURL));
window.open(renderGitpodUrl(config.gitpodURL).gitpodUrl);
}

// Perform the actual, initial injection
Expand Down
87 changes: 87 additions & 0 deletions src/ide-options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"clients": {
"jetbrains-gateway": {
"defaultDesktopIDE": "intellij",
"desktopIDEs": [
"intellij",
"goland",
"pycharm",
"phpstorm"
],
"installationSteps": [
"If you don't see an open dialog in your browser, make sure you have the <a target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'>JetBrains Gateway with Gitpod Plugin</a> installed on your machine, and then click <b>${OPEN_LINK_LABEL}</b> below."
]
},
"vscode": {
"defaultDesktopIDE": "code-desktop",
"desktopIDEs": [
"code-desktop"
],
"installationSteps": [
"If you don't see an open dialog in your browser, make sure you have <a target='_blank' class='gp-link' href='https://code.visualstudio.com/download'>VS Code</a> installed on your machine, and then click <b>${OPEN_LINK_LABEL}</b> below."
]
},
"vscode-insiders": {
"defaultDesktopIDE": "code-desktop",
"desktopIDEs": [
"code-desktop"
],
"installationSteps": [
"If you don't see an open dialog in your browser, make sure you have <a target='_blank' class='gp-link' href='https://code.visualstudio.com/insiders'>VS Code Insiders</a> installed on your machine, and then click <b>${OPEN_LINK_LABEL}</b> below."
]
}
},
"defaultDesktopIde": "code-desktop",
"defaultIde": "code",
"options": {
"code": {
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-54b4098031a1a3a600c1fd73d070c4aab27e1cd8",
"label": "Browser",
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code:nightly@sha256:b62ea2f415d46505c1ffa75f171dc00a0b099105e99ef070ee65ec05084fba61",
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
"orderKey": "00",
"title": "VS Code",
"type": "browser"
},
"code-desktop": {
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop:commit-b121fec8e215abd2d0328ef28b8808a59852cb4c",
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop-insiders:commit-b121fec8e215abd2d0328ef28b8808a59852cb4c@sha256:1b65f8959b1eac330e736c18d1824f34c2ad21df81438ba8c3351e04d5f539ad",
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
"orderKey": "02",
"title": "VS Code",
"type": "desktop"
},
"goland": {
"image": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-a4234aa724a4658207fdf6a64e5c07f204da86d1",
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/goland:latest@sha256:2c23f10430fb3fe62d19fe39f40b4dea4869eab31ae72e5f7bddeb6679a4dcd7",
"logo": "https://ide.gitpod.io/image/ide-logo/golandLogo.svg",
"orderKey": "05",
"title": "GoLand",
"type": "desktop"
},
"intellij": {
"image": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-bbdbb44b0a85a2c36e6854d818fe920d0ee5369c",
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:latest@sha256:6109564a542707a8962054d864ee0679388b77bcb66c8fd987924a831cbaf486",
"logo": "https://ide.gitpod.io/image/ide-logo/intellijIdeaLogo.svg",
"orderKey": "04",
"title": "IntelliJ IDEA",
"type": "desktop"
},
"phpstorm": {
"image": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-a4234aa724a4658207fdf6a64e5c07f204da86d1",
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:latest@sha256:81085f80e4227b9e034aa37adb2256c279d2cca4cd3b4101feb3abd8f53e90d2",
"logo": "https://ide.gitpod.io/image/ide-logo/phpstormLogo.svg",
"orderKey": "07",
"title": "PhpStorm",
"type": "desktop"
},
"pycharm": {
"image": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-a4234aa724a4658207fdf6a64e5c07f204da86d1",
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:latest@sha256:4698b906f4852d44b48ef3df858fcef73da69628a2da3188cd6e70116d84865e",
"logo": "https://ide.gitpod.io/image/ide-logo/pycharmLogo.svg",
"orderKey": "06",
"title": "PyCharm",
"type": "desktop"
}
}
}
29 changes: 15 additions & 14 deletions src/injectors/bitbucket-injector.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { InjectorBase, ButtonInjector, checkIsBtnUpToDate } from "./injector";
import { ConfigProvider } from "../config";
import { renderGitpodUrl, makeOpenInPopup } from "../utils";
import { renderGitpodUrl, makeOpenInPopup, UrlInfo } from "../utils";
import select = require("select-dom");

namespace Gitpodify {
export const NAV_BTN_ID = "gitpod-btn-nav";
export const NAV_BTN_CLASS = "gitpod-nav-btn";
export const NAV_BTN_ID = "gitpod-btn-nav";
export const NAV_BTN_CLASS = "gitpod-nav-btn";
export const NAV_BTN_CLASS_SELECTOR = "." + NAV_BTN_CLASS;

export const CSS_REF_BTN_CONTAINER = "gitpod-btn-container";
export const CSS_REF_NO_CONTAINER = "no-container";
}
Expand Down Expand Up @@ -38,8 +38,8 @@ export class BitbucketInjector extends InjectorBase {

checkIsInjected(): boolean {
const button = document.getElementById(`${Gitpodify.NAV_BTN_ID}`);
const currentUrl = renderGitpodUrl(this.config.gitpodURL);
return checkIsBtnUpToDate(button, currentUrl);
const urlInfo = renderGitpodUrl(this.config.gitpodURL);
return checkIsBtnUpToDate(button, urlInfo.gitpodUrl);
}

async inject(): Promise<void> {
Expand All @@ -54,17 +54,17 @@ export class BitbucketInjector extends InjectorBase {

abstract class ButtonInjectorBase implements ButtonInjector {

constructor(protected readonly parent: string, protected btnClasses: string, protected readonly up?: number) {
constructor(protected readonly parent: string, protected btnClasses: string, protected readonly up?: number, protected readonly test?: boolean) {

}

abstract isApplicableToCurrentPage(): boolean;

inject(currentUrl: string, openAsPopup: boolean) {
inject(urlInfo: UrlInfo, openAsPopup: boolean, useLatest: boolean) {
let actionbar = select(this.parent);
if(actionbar && this.up) {
for(let i = 0; i < this.up; i++) {
if(actionbar.parentElement) {
if (actionbar && this.up) {
for (let i = 0; i < this.up; i++) {
if (actionbar.parentElement) {
actionbar = actionbar.parentElement;
} else {
return;
Expand All @@ -75,6 +75,7 @@ abstract class ButtonInjectorBase implements ButtonInjector {
return;
}

const currentUrl = urlInfo.gitpodUrl;
const oldBtn = document.getElementById(Gitpodify.NAV_BTN_ID);
if (oldBtn) {
if (!checkIsBtnUpToDate(oldBtn, currentUrl)) {
Expand All @@ -88,16 +89,16 @@ abstract class ButtonInjectorBase implements ButtonInjector {
const btn = this.renderButton(currentUrl, openAsPopup);

const btnGroup = actionbar.children;
if (btnGroup && btnGroup.length > 0){
if (btnGroup && btnGroup.length > 0) {
actionbar.insertBefore(btn, btnGroup[0]);
}
}
}

protected renderButton(url: string, openAsPopup: boolean, float: boolean = true): HTMLElement {
let classes = Gitpodify.NAV_BTN_CLASS;
if (float) {
classes = `${classes} ${this.btnClasses} aui-button`;
}
}

const container = document.createElement('div');
container.id = Gitpodify.CSS_REF_BTN_CONTAINER;
Expand Down
Loading