Skip to content

Commit a93bf54

Browse files
committed
try to fix style issue
1 parent 082bc54 commit a93bf54

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

lib/find-visualstudio.js

+26-26
Original file line numberDiff line numberDiff line change
@@ -125,40 +125,40 @@ VisualStudioFinder.prototype = {
125125

126126
// Invoke the PowerShell script to get information about Visual Studio 2017
127127
// or newer installations
128-
findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer(cb) {
128+
findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) {
129129
const ps = path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe')
130130
const csFile = path.join(__dirname, 'Find-VisualStudio.cs')
131131
const basePsArgs = ['-ExecutionPolicy', 'Unrestricted', '-NoProfile', '-Command',]
132132
const findLanguageModePsCmd =
133-
`&{ try { $ExecutionContext.SessionState.LanguageMode } catch { try { (Get-PSSessionConfiguration -Name Test).LanguageMode } catch { 'error' } } }`
133+
`&{ try { $ExecutionContext.SessionState.LanguageMode } catch { try { (Get-PSSessionConfiguration -Name Test).LanguageMode } catch { 'error' } } }`
134134

135135
const psArgs = [...basePsArgs, findLanguageModePsCmd]
136136
this.log.silly('Running', ps, psArgs)
137137
const childFindPsLanguageMode = execFile(
138-
ps,
139-
psArgs,
140-
{encoding: 'utf8'},
141-
(err, stdout, stderr) => {
142-
this.log.silly('PS stderr = %j', stderr)
143-
if (err) {
144-
this.log.silly('PS err = %j', err && (err.stack || err))
145-
this.addLog(
146-
'could not determine PowerShell LanguageMode, try re-running with \'--loglevel silly\' for more details')
147-
return cb(null)
148-
}
149-
const findVscDataPsCmd = `&{Add-Type -Path '${csFile}';[VisualStudioConfiguration.Main]::PrintJson()}`
150-
const psArgs = [...basePsArgs, findVscDataPsCmd]
151-
// the Add-Type command requires powershell to run with languageMode == FullLanguage
152-
// Because languageMode feature is not introduced yet in powershell v2, we can try to use it.
153-
// If powershell v2 is not installed (a problem only if languageMode is not FullLanguage), then it is not
154-
// possible to use feature Add-Type.
155-
if (stdout.toString('utf8').trim().toLowerCase() !== 'fulllanguage') {
156-
psArgs.unshift('-Version', '2',)
157-
}
158-
this.log.silly('Running', ps, psArgs)
159-
const child = execFile(ps, psArgs, {encoding: 'utf8'}, (err, stdout, stderr) => this.parseData(err, stdout, stderr, cb))
160-
child.stdin.end()
161-
})
138+
ps,
139+
psArgs,
140+
{ encoding: 'utf8' },
141+
(err, stdout, stderr) => {
142+
this.log.silly('PS stderr = %j', stderr)
143+
if (err) {
144+
this.log.silly('PS err = %j', err && (err.stack || err))
145+
this.addLog(
146+
'could not determine PowerShell LanguageMode, try re-running with \'--loglevel silly\' for more details')
147+
return cb(null)
148+
}
149+
const findVscDataPsCmd = `&{Add-Type -Path '${csFile}';[VisualStudioConfiguration.Main]::PrintJson()}`
150+
const psArgs = [...basePsArgs, findVscDataPsCmd]
151+
// the Add-Type command requires powershell to run with languageMode == FullLanguage
152+
// Because languageMode feature is not introduced yet in powershell v2, we can try to use it.
153+
// If powershell v2 is not installed (a problem only if languageMode is not FullLanguage), then it is not
154+
// possible to use feature Add-Type.
155+
if (stdout.toString('utf8').trim().toLowerCase() !== 'fulllanguage') {
156+
psArgs.unshift('-Version', '2',)
157+
}
158+
this.log.silly('Running', ps, psArgs)
159+
const child = execFile(ps, psArgs, { encoding: 'utf8' }, (err, stdout, stderr) => this.parseData(err, stdout, stderr, cb))
160+
child.stdin.end()
161+
})
162162
childFindPsLanguageMode.stdin.end()
163163
},
164164

0 commit comments

Comments
 (0)