Skip to content

Commit 21fb559

Browse files
committed
Make the vsDevMode script more explicit and support lib file override
1 parent a77d39b commit 21fb559

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

scripts/VSDevMode.ps1

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,38 @@ if(!(Test-Path $tsRegKey)){
3737
}
3838

3939
if($tsScript -ne ""){
40-
if(!(Test-Path $tsScript)){
41-
Throw "Could not locate the TypeScript language service script at ${tsScript}"
40+
$tsScriptServices = "${tsScript}\typescriptServices.js"
41+
$tsScriptlib = "${tsScript}\lib.d.ts"
42+
$tsES6Scriptlib = "${tsScript}\lib.es6.d.ts"
43+
44+
if(!(Test-Path $tsScriptServices)){
45+
Throw "Could not locate the TypeScript language service script at ${tsScriptServices}"
46+
}
47+
else {
48+
$path = resolve-path ${tsScriptServices}
49+
Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${path}"
50+
Write-Host "Enabled custom TypeScript language service at ${path} for Dev${vsVersion}"
51+
}
52+
53+
if(!(Test-Path $tsScriptlib)){
54+
Throw "Could not locate the TypeScript default library at ${tsScriptlib}"
55+
}
56+
else {
57+
$path = resolve-path ${tsScriptlib}
58+
Set-ItemProperty -path $tsRegKey -name CustomDefaultLibraryLocation -value "${path}"
59+
Write-Host "Enabled custom TypeScript default library at ${path} for Dev${vsVersion}"
60+
}
61+
62+
if(!(Test-Path $tsES6Scriptlib)){
63+
Throw "Could not locate the TypeScript default ES6 library at ${tsES6Scriptlib}"
64+
}
65+
else {
66+
$path = resolve-path ${tsES6Scriptlib}
67+
Set-ItemProperty -path $tsRegKey -name CustomDefaultES6LibraryLocation -value "${path}"
68+
Write-Host "Enabled custom TypeScript default ES6 library at ${path} for Dev${vsVersion}"
4269
}
43-
Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${tsScript}"
44-
Write-Host "Enabled custom TypeScript language service at ${tsScript} for Dev${vsVersion}"
4570
}
71+
4672
if($enableDevMode){
4773
Set-ItemProperty -path $tsRegKey -name EnableDevMode -value 1
4874
Write-Host "Enabled developer mode for Dev${vsVersion}"

0 commit comments

Comments
 (0)