Created
July 5, 2023 19:21
-
-
Save hello-42/9ab1e85e91d32ce417d9d38582c91477 to your computer and use it in GitHub Desktop.
A Windows installer for Sublime Text, Luau LSP, and Roblox definitions and documentation files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sublHasPath = $FALSE | |
$luauLSPHasPath = $FALSE | |
$luauLspFolder = $NULL | |
try { | |
# Install Sublime | |
winget.exe install -e --id SublimeHQ.SublimeText.4 --force | |
# Check if Sublime is under our PATH environment | |
ForEach ($PATH in $env:PATH.Split(';')) { | |
$sublHasPath = ($PATH -like "*$env:HOMEDRIVE\Program Files\Sublime Text*") | |
if ($sublHasPath -eq $TRUE) { | |
break | |
} | |
} | |
} finally { | |
if ($sublHasPath -eq $TRUE) { | |
Write-Host "Sublime Text already in PATH" | |
} else { | |
# Write Sublime to our PATH environment | |
$env:PATH += ";$env:HOMEDRIVE\Program Files\Sublime Text" | |
Write-Host "Sublime Text written to PATH" | |
} | |
# Install Package Control | |
subl.exe --command "install_package_control" | |
## Install LSP (unfortunately, this is impossible, see: | |
subl.exe --command "advanced_install_package {\"packages\": \"LSP\"}" | |
} try { | |
If (Test-Path "$HOME\.luau-lsp\bin") { | |
$luauLspFolder = (Get-Item -Path "$HOME\.luau-lsp\bin" -Force).FullName | |
} else { | |
$luauLspFolder = (New-Item -Path "$HOME\.luau-lsp\bin" -ItemType Directory -Force).FullName | |
} | |
# Remove all files in the luau-lsp folder | |
ForEach ($item in Get-ChildItem $luauLspFolder) { | |
Remove-Item $item.FullName -Force | |
} | |
} finally { | |
## Get luau-lsp.exe | |
curl.exe "https://github.com/JohnnyMorganz/luau-lsp/releases/download/1.22.0/luau-lsp-win64.zip" -L -o "$HOME\.luau-lsp\bin\luau-lsp.zip" | |
Expand-Archive "$HOME\.luau-lsp\bin\luau-lsp.zip" -DestinationPath "$HOME\.luau-lsp\bin" | |
Remove-Item "$HOME\.luau-lsp\bin\luau-lsp.zip" -Force | |
try { | |
# Check to see if we have luau-lsp.exe in our PATH environment | |
ForEach ($PATH in $env:PATH.Split(';')) { | |
$luauLSPHasPath = ($PATH -like "*$env:HOMEDRIVE\Program Files\Sublime Text*") | |
if ($luauLSPHasPath -eq $TRUE) { | |
break | |
} | |
} | |
} finally { | |
if ($luauLSPHasPath -eq $TRUE) { | |
Write-Host "luau-lsp already in PATH" | |
} else { | |
# Add luau-lsp.exe to our PATH environment | |
$env:PATH += ";$HOME\.luau-lsp\bin" | |
Write-Host "luau-lsp written to PATH" | |
} | |
} | |
## Get Roblox api-docs.json and Roblox globalTypes.d.lua | |
curl.exe "https://raw.githubusercontent.com/MaximumADHD/Roblox-Client-Tracker/roblox/api-docs/en-us.json" -o "$HOME\.luau-lsp\api-docs.json" | |
curl.exe "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.lua" -o "$HOME\.luau-lsp\globalTypes.d.lua" | |
## Get Luau LSP and Rojo .sublime-build gists (WIP) | |
# curl.exe "https://gist.githubusercontent.com/hello-42/840a30fb0926a5732d27b59b5ad0338b/raw" -o "$HOME\AppData\Roaming\Sublime Text\Packages\User\luau-lsp-get.sublime-build" | |
# curl.exe "https://gist.githubusercontent.com/hello-42/62ce110081c95d4cb6603f8e162773d1/raw" -o "$HOME\AppData\Roaming\Sublime Text\Packages\User\rojo-builder.sublime-build" | |
## Get LSP Settings | |
curl.exe "https://gist.githubusercontent.com/hello-42/3afe83e91f8ca1d1fd1b876b7ed48f3e/raw" -o "$HOME\AppData\Roaming\Sublime Text\Packages\User\LSP.sublime-settings" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment