@@ -115,6 +115,7 @@ export default class PHPValidationProvider {
115115 this . diagnosticCollection . delete ( textDocument . uri ) ;
116116 delete this . delayers [ textDocument . uri . toString ( ) ] ;
117117 } , null , subscriptions ) ;
118+ subscriptions . push ( vscode . commands . registerCommand ( 'php.untrustValidationExecutable' , this . untrustValidationExecutable , this ) ) ;
118119 }
119120
120121 public dispose ( ) : void {
@@ -140,6 +141,9 @@ export default class PHPValidationProvider {
140141 }
141142 this . trigger = RunTrigger . from ( section . get < string > ( 'validate.run' , RunTrigger . strings . onSave ) ) ;
142143 }
144+ if ( this . executableIsUserDefined !== true && this . workspaceStore . get < string > ( CheckedExecutablePath , undefined ) !== void 0 ) {
145+ vscode . commands . executeCommand ( 'setContext' , 'php.untrustValidationExecutableContext' , true ) ;
146+ }
143147 this . delayers = Object . create ( null ) ;
144148 if ( this . pauseValidation ) {
145149 this . pauseValidation = oldExecutable === this . executable ;
@@ -161,6 +165,11 @@ export default class PHPValidationProvider {
161165 }
162166 }
163167
168+ private untrustValidationExecutable ( ) {
169+ this . workspaceStore . update ( CheckedExecutablePath , undefined ) ;
170+ vscode . commands . executeCommand ( 'setContext' , 'php.untrustValidationExecutableContext' , false ) ;
171+ }
172+
164173 private triggerValidate ( textDocument : vscode . TextDocument ) : void {
165174 if ( textDocument . languageId !== 'php' || this . pauseValidation || ! this . validationEnabled ) {
166175 return ;
@@ -193,19 +202,14 @@ export default class PHPValidationProvider {
193202 title : localize ( 'php.no' , 'No' ) ,
194203 isCloseAffordance : true ,
195204 id : 'no'
196- } ,
197- {
198- title : localize ( 'php.more' , 'Learn More' ) ,
199- id : 'more'
200205 }
201206 ) . then ( selected => {
202207 if ( ! selected || selected . id === 'no' ) {
203208 this . pauseValidation = true ;
204209 } else if ( selected . id === 'yes' ) {
205210 this . workspaceStore . update ( CheckedExecutablePath , this . executable ) ;
211+ vscode . commands . executeCommand ( 'setContext' , 'php.untrustValidationExecutableContext' , true ) ;
206212 trigger ( ) ;
207- } else if ( selected . id === 'more' ) {
208- vscode . commands . executeCommand ( 'vscode.open' , vscode . Uri . parse ( 'https://go.microsoft.com/fwlink/?linkid=839878' ) ) ;
209213 }
210214 } ) ;
211215 return ;
0 commit comments