@@ -26,7 +26,7 @@ const axios = require('axios');
26
26
27
27
export const puppetLangID = 'puppet' ; // don't change this
28
28
export const puppetFileLangID = 'puppetfile' ; // don't change this
29
- const debugType = 'Puppet' ; // don't change this
29
+ const debugType = 'Puppet' ; // don't change this
30
30
31
31
let extContext : vscode . ExtensionContext ;
32
32
let connectionHandler : ConnectionHandler ;
@@ -48,13 +48,15 @@ export function activate(context: vscode.ExtensionContext) {
48
48
configSettings = CreateAggregrateConfiguration ( settings ) ;
49
49
logger = new OutputChannelLogger ( configSettings . workspace . editorService . loglevel ) ;
50
50
if ( configSettings . workspace . installType !== previousInstallType ) {
51
- logger . debug ( `Installation type has changed from ${ previousInstallType } to ${ configSettings . workspace . installType } ` ) ;
51
+ logger . debug (
52
+ `Installation type has changed from ${ previousInstallType } to ${ configSettings . workspace . installType } `
53
+ ) ;
52
54
}
53
55
54
56
reporter . sendTelemetryEvent ( 'config' , {
55
- ' installType' : configSettings . workspace . installType ,
56
- ' protocol' : configSettings . workspace . editorService . protocol ,
57
- ' pdkVersion' : configSettings . ruby . pdkVersion
57
+ installType : configSettings . workspace . installType ,
58
+ protocol : configSettings . workspace . editorService . protocol ,
59
+ pdkVersion : configSettings . ruby . pdkVersion
58
60
} ) ;
59
61
60
62
const statusBar = new PuppetStatusBarFeature ( [ puppetLangID , puppetFileLangID ] , configSettings , logger , context ) ;
@@ -66,24 +68,23 @@ export function activate(context: vscode.ExtensionContext) {
66
68
statusBar
67
69
] ;
68
70
69
- if ( configSettings . workspace . editorService . enable === false ) {
71
+ if ( configSettings . workspace . editorService . enable === false ) {
70
72
notifyEditorServiceDisabled ( extContext ) ;
71
73
reporter . sendTelemetryEvent ( 'editorServiceDisabled' ) ;
72
74
return ;
73
75
}
74
76
75
-
76
- if ( checkInstallDirectory ( configSettings , logger ) === false ) {
77
+ if ( checkInstallDirectory ( configSettings , logger ) === false ) {
77
78
// If this returns false, then we needed a local directory
78
79
// but did not find it, so we should abort here
79
80
// If we return true, we can continue
80
81
// This can be revisited to enable disabling language server portion
81
82
return ;
82
83
}
83
-
84
+
84
85
// this happens after checkInstallDirectory so that we don't check pdk version
85
86
// if it's not installed
86
- if ( settings . pdk . checkVersion ) {
87
+ if ( settings . pdk . checkVersion ) {
87
88
notifyIfNewPDKVersion ( extContext , configSettings ) ;
88
89
}
89
90
@@ -96,12 +97,14 @@ export function activate(context: vscode.ExtensionContext) {
96
97
break ;
97
98
}
98
99
99
- extensionFeatures . push ( new FormatDocumentFeature ( puppetLangID , connectionHandler , configSettings , logger , extContext ) ) ;
100
+ extensionFeatures . push (
101
+ new FormatDocumentFeature ( puppetLangID , connectionHandler , configSettings , logger , extContext )
102
+ ) ;
100
103
extensionFeatures . push ( new PuppetNodeGraphFeature ( puppetLangID , connectionHandler , logger , extContext ) ) ;
101
104
extensionFeatures . push ( new PuppetResourceFeature ( extContext , connectionHandler , logger ) ) ;
102
105
extensionFeatures . push ( new DebuggingFeature ( debugType , configSettings , extContext , logger ) ) ;
103
-
104
- if ( settings . hover . showMetadataInfo ) {
106
+
107
+ if ( settings . hover . showMetadataInfo ) {
105
108
extensionFeatures . push ( new PuppetModuleHoverFeature ( extContext , logger ) ) ;
106
109
}
107
110
}
@@ -135,7 +138,7 @@ function checkForLegacySettings() {
135
138
}
136
139
}
137
140
138
- function checkInstallDirectory ( config : IAggregateConfiguration , logger : ILogger ) : boolean {
141
+ function checkInstallDirectory ( config : IAggregateConfiguration , logger : ILogger ) : boolean {
139
142
if ( config . workspace . editorService . protocol === ProtocolType . TCP ) {
140
143
if ( config . connection . type === ConnectionType . Remote ) {
141
144
// Return if we are connecting to a remote TCP LangServer
@@ -151,13 +154,11 @@ function checkInstallDirectory(config: IAggregateConfiguration, logger: ILogger)
151
154
if ( SettingsFromWorkspace ( ) . installType === PuppetInstallType . AUTO ) {
152
155
let m = [
153
156
'The extension failed to find a Puppet installation automatically in the default locations for PDK and for Puppet Agent.' ,
154
- 'While syntax highlighting and grammar detection will still work, intellisense and other advanced features will not.' ,
157
+ 'While syntax highlighting and grammar detection will still work, intellisense and other advanced features will not.'
155
158
] ;
156
159
message = m . join ( ' ' ) ;
157
- } else {
158
- message = `Could not find a valid Puppet installation at '${
159
- config . ruby . puppetBaseDir
160
- } '. While syntax highlighting and grammar detection will still work, intellisense and other advanced features will not.`;
160
+ } else {
161
+ message = `Could not find a valid Puppet installation at '${ config . ruby . puppetBaseDir } '. While syntax highlighting and grammar detection will still work, intellisense and other advanced features will not.` ;
161
162
}
162
163
163
164
showErrorMessage (
@@ -186,7 +187,7 @@ function showErrorMessage(message: string, title: string, helpLink: string, logg
186
187
}
187
188
188
189
async function notifyOnNewExtensionVersion ( context : vscode . ExtensionContext ) {
189
- const puppetExtension = vscode . extensions . getExtension ( 'jpogran .puppet-vscode' ) ! ;
190
+ const puppetExtension = vscode . extensions . getExtension ( 'puppet .puppet-vscode' ) ! ;
190
191
const version = puppetExtension . packageJSON . version ;
191
192
192
193
const viewReleaseNotes = 'View Release Notes' ;
@@ -211,7 +212,7 @@ async function notifyOnNewExtensionVersion(context: vscode.ExtensionContext) {
211
212
if ( result . title === viewReleaseNotes ) {
212
213
vscode . commands . executeCommand (
213
214
'vscode.open' ,
214
- vscode . Uri . parse ( 'https://marketplace.visualstudio.com/items/jpogran .puppet-vscode/changelog' )
215
+ vscode . Uri . parse ( 'https://marketplace.visualstudio.com/items/puppet .puppet-vscode/changelog' )
215
216
) ;
216
217
} else {
217
218
context . globalState . update ( suppressUpdateNotice , true ) ;
@@ -241,31 +242,32 @@ async function notifyEditorServiceDisabled(context: vscode.ExtensionContext) {
241
242
}
242
243
}
243
244
244
- async function notifyIfNewPDKVersion ( context : vscode . ExtensionContext , settings :IAggregateConfiguration ) {
245
+ async function notifyIfNewPDKVersion ( context : vscode . ExtensionContext , settings : IAggregateConfiguration ) {
245
246
const suppressPDKUpdateCheck = 'suppressPDKUpdateCheck' ;
246
247
const dontCheckAgainNotice = "Don't check again" ;
247
- const viewPDKDownloadPage = " More info" ;
248
+ const viewPDKDownloadPage = ' More info' ;
248
249
249
250
if ( context . globalState . get ( suppressPDKUpdateCheck , false ) ) {
250
251
return ;
251
252
}
252
253
253
254
let version = '' ;
254
- if ( settings . ruby . pdkVersion ) {
255
+ if ( settings . ruby . pdkVersion ) {
255
256
version = settings . ruby . pdkVersion ;
256
- } else {
257
+ } else {
257
258
// should we throw a warning here? technically this is only reached *if* a
258
259
// PDK install is found, so the only way this is null is if the PDK_VERSION
259
260
// file was removed.
260
261
return ;
261
262
}
262
263
263
- axios . get ( 'https://s3.amazonaws.com/puppet-pdk/pdk/LATEST' )
264
+ axios
265
+ . get ( 'https://s3.amazonaws.com/puppet-pdk/pdk/LATEST' )
264
266
. then ( response => {
265
267
return response . data ;
266
268
} )
267
269
. then ( latest_version => {
268
- if ( version !== latest_version ) {
270
+ if ( version !== latest_version ) {
269
271
return vscode . window . showWarningMessage (
270
272
`The installed PDK version is ${ version } , the newest version is ${ latest_version } . To find out how to update to the latest version click the more info button` ,
271
273
{ modal : false } ,
@@ -274,11 +276,11 @@ async function notifyIfNewPDKVersion(context: vscode.ExtensionContext, settings:
274
276
) ;
275
277
}
276
278
} )
277
- . then ( result => {
279
+ . then ( result => {
278
280
if ( result === undefined ) {
279
281
return ;
280
282
}
281
-
283
+
282
284
if ( result . title === dontCheckAgainNotice ) {
283
285
context . globalState . update ( suppressPDKUpdateCheck , true ) ;
284
286
}
@@ -308,25 +310,25 @@ function setLanguageConfiguration() {
308
310
}
309
311
] ,
310
312
brackets : [
311
- [ "{" , "}" ] ,
312
- [ "[" , "]" ] ,
313
- [ "(" , ")" ]
313
+ [ '{' , '}' ] ,
314
+ [ '[' , ']' ] ,
315
+ [ '(' , ')' ]
314
316
] ,
315
317
comments : {
316
- lineComment : "#" ,
317
- blockComment : [ "/*" , "*/" ]
318
+ lineComment : '#' ,
319
+ blockComment : [ '/*' , '*/' ]
318
320
}
319
321
} ) ;
320
322
vscode . languages . setLanguageConfiguration ( puppetFileLangID , {
321
323
onEnterRules : [ ] ,
322
324
brackets : [
323
- [ "{" , "}" ] ,
324
- [ "[" , "]" ] ,
325
- [ "(" , ")" ]
325
+ [ '{' , '}' ] ,
326
+ [ '[' , ']' ] ,
327
+ [ '(' , ')' ]
326
328
] ,
327
329
comments : {
328
- lineComment : "#" ,
329
- blockComment : [ "/*" , "*/" ]
330
+ lineComment : '#' ,
331
+ blockComment : [ '/*' , '*/' ]
330
332
}
331
333
} ) ;
332
334
}
0 commit comments