@@ -23,6 +23,7 @@ export interface ExtensionInfo {
2323 version : string ;
2424 channel : string ;
2525 path : string ;
26+ disable : boolean ;
2627}
2728
2829export class ExtensionManager implements vscode . Disposable {
@@ -65,7 +66,9 @@ export class ExtensionManager implements vscode.Disposable {
6566 public activate ( context : vscode . ExtensionContext ) {
6667 this . _context = context ;
6768 this . _info = this . checkExtension ( context ) ;
68- this . activateFeatures ( ) ;
69+ if ( ! this . _info . disable ) {
70+ this . activateFeatures ( ) ;
71+ }
6972 }
7073
7174 public dispose ( ) : void {
@@ -150,6 +153,8 @@ export class ExtensionManager implements vscode.Disposable {
150153 // Get channel
151154 let extensionId = 'bewhite.psrule-vscode' ;
152155 let extensionChannel = 'stable' ;
156+ const isStableInstalled = vscode . extensions . getExtension ( extensionId ) !== undefined ;
157+
153158 if ( path . basename ( context . globalStorageUri . fsPath ) === 'bewhite.psrule-vscode-preview' ) {
154159 extensionId = 'bewhite.psrule-vscode-preview' ;
155160 extensionChannel = 'preview' ;
@@ -176,9 +181,9 @@ export class ExtensionManager implements vscode.Disposable {
176181 . getConfiguration ( 'PSRule.notifications' )
177182 . get ( 'showChannelUpgrade' , true ) ;
178183
184+ const showExtension = 'Show Extension' ;
179185 if ( ( extensionChannel === 'preview' || extensionChannel === 'dev' ) && showChannelUpgrade ) {
180186 const showReleaseNotes = 'Show Release Notes' ;
181- const showExtension = 'Show Extension' ;
182187 const alwaysIgnore = 'Always Ignore' ;
183188
184189 vscode . window
@@ -209,11 +214,29 @@ export class ExtensionManager implements vscode.Disposable {
209214 } ) ;
210215 }
211216
217+ let disable = false ;
218+ if ( ( extensionChannel === 'preview' || extensionChannel === 'dev' ) && isStableInstalled ) {
219+ disable = true ;
220+ vscode . window . showWarningMessage (
221+ `You may experience issues running the ${ extensionChannel } version of PSRule, side-by-side with the stable version. Please uninstall one of ${ extensionChannel } or stable version and reload Visual Studio Code for the best experience.` ,
222+ showExtension ,
223+ )
224+ . then ( ( choice ) => {
225+ if ( choice === showExtension ) {
226+ vscode . commands . executeCommand (
227+ 'workbench.extensions.search' ,
228+ 'PSRule'
229+ ) ;
230+ }
231+ } ) ;
232+ }
233+
212234 const result : ExtensionInfo = {
213235 id : extensionId ,
214236 version : extensionVersion ,
215237 channel : extensionChannel ,
216238 path : context . extensionPath ,
239+ disable : disable ,
217240 } ;
218241 return result ;
219242 }
0 commit comments