vscode integration helper
Summary: VSCode integration helpers to call extensions Reviewed By: passy Differential Revision: D21641284 fbshipit-source-id: dd978520ea541dbd6a96b8398ce28744a0fc97ad
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0da766f27b
commit
2283bbd313
@@ -79,3 +79,7 @@ export async function getFlipperMediaCDN(
|
||||
): Promise<string> {
|
||||
throw new Error('Feature not implemented');
|
||||
}
|
||||
|
||||
export async function getPreferredEditorUriScheme(): Promise<string> {
|
||||
return 'vscode';
|
||||
}
|
||||
|
||||
@@ -183,3 +183,4 @@ export {KeyboardActions} from './MenuBar';
|
||||
export {getFlipperMediaCDN} from './fb-stubs/user';
|
||||
export {Rect} from './utils/geometry';
|
||||
export {Logger} from './fb-interfaces/Logger';
|
||||
export {callVSCode, getVSCodeUrl} from './utils/vscodeUtils';
|
||||
|
||||
27
desktop/app/src/utils/vscodeUtils.tsx
Normal file
27
desktop/app/src/utils/vscodeUtils.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {getPreferredEditorUriScheme} from '../fb-stubs/user';
|
||||
import {shell} from 'electron';
|
||||
|
||||
const preferredEditorUriScheme: Promise<string> = getPreferredEditorUriScheme();
|
||||
|
||||
export function callVSCode(plugin: string, command: string, params?: string) {
|
||||
getVSCodeUrl(plugin, command, params).then((url) => shell.openExternal(url));
|
||||
}
|
||||
|
||||
export async function getVSCodeUrl(
|
||||
plugin: string,
|
||||
command: string,
|
||||
params?: string,
|
||||
): Promise<string> {
|
||||
return `${await preferredEditorUriScheme}://${plugin}/${command}${
|
||||
params == null ? '' : `?${params}`
|
||||
}`;
|
||||
}
|
||||
Reference in New Issue
Block a user