NSIS for Visual Studio Code
Language syntax, IntelliSense and build system for Nullsoft Scriptable Install System (NSIS).
Screenshot of NSIS in Visual Studio Code with Hopscotch theme
Features
- Language syntax for NSIS, NSIS Language Files, nsL Assembler, and BridleNSIS
- IntelliSense for core NSIS commands, variables and predefines
- IntelliSense for core plug-ins:
- AdvSplash
- Banner
- BgImage
- Dialer
- InstallOptions
- LangDLL
- Math
- nsDialogs
- nsExec
- NSISdl
- Splash
- StartMenu
- System
- UserInfo
- VPatch
- IntelliSense for core libraries (“Useful Headers”):
- FileFunc
- LogicLib
- Memento
- Modern UI
- MultiUser
- Sections
- StrFunc
- WinMessages
- WinVer
- WordFunc
- x64
- IntelliSense for nsL Assembler
- IntelliSense for BridleNSIS
- IntelliSense for Haskell
- Drunken NSIS
- Build Tools
You can further extend NSIS support with snippets for third-party plug-ins.
Installation
Extension Marketplace
Launch Quick Open, paste the following command, and press Enter
ext install nsis
Packaged Extension
Download the package extension from the the release page and install it from the command-line:
$ code --install-extension nsis-*.vsix
Clone Repository
Change to your Visual Studio Code extensions directory:
# Windows
$ cd %USERPROFILE%\.vscode\extensions
# Linux & macOS
$ cd ~/.vscode/extensions/
Clone repository as nsis
:
$ git clone https://github.com/idleberg/vscode-nsis nsis
Usage
IntelliSense
With most commands, you can specify available options before completion. For instance, rather than completing RequestExecutionLevel
and then specifying an option, you can directly choose RequestExecutionLevel user
from the completion menu.
To complete compile time commands, variables or predefines, make sure to omit special characters like !
, $
and brackets:
include
completes to!include
INSTDIR
completes to$INSTDIR
NSIS_VERSION
completes to${NSIS_VERSION}
However, you have to type __LINE__
to complete to ${__LINE__}
.
There are several special cases for your convenience:
MB_OK
completes toMessageBox MB_OK "messagebox_text"
onInit
completes to aFunction .onInit
blockLogicLib
completes to!include "LogicLib.nsh"
Drunken NSIS
Fuzzy syntax completions are available through “Drunken NSIS”, which tries to iron out some of the inconsistencies of the NSIS language, for instance word order.
Example:
Interchangable word order of NSIS language and library functions
FileRead
equalsReadFile
ReadINIStr
equalsINIStrRead
SectionSetText
equalsSetSectionText
LogSet
equalsSetLog
FindFirst
equalsFirstFind
${FindLine}
equals${LineFind}
Building
Before you can build, make sure makensis
is in your PATH environmental variable. Alternatively, you can specify the path to makensis
in your user settings.
makensis
Example:
"nsis.compilerArguments": "/WX /V3",
"nsis.pathToMakensis": "/usr/local/bin/makensis"
To trigger a build, select NSIS: Save & Compile” from the command-palette or use the default keyboard shortcut Ctrl+Shift+B. The strict option treats warnings as errors and can be triggered using Ctrl+Alt+Shift+B.
nsL Transpiler
As of version 2.0, you can transpile nsL Assembler using the NSIS: Transpile nsL code command from the command-palette. The path to nsL.jar
is specified in your user settings.
Example:
"nsis.nsl.pathToJar": "/full/path/to/nsL.jar",
"nsis.nsl.customArguments": "/nomake /nopause",
BridleNSIS Transpiler
As of version 2.6, you can transpile BridleNSIS using the NSIS: Transpile BridleNSIS code command from the command-palette. The path to BridleNSIS.jar
is specified in your user settings.
Example:
"nsis.bridlensis.pathToJar": "/full/path/to/BridleNSIS.jar",
"nsis.bridlensis.customArguments": "-n /usr/local/bin/",
Options
You can tweak your default settings by editing your user settings.
Setting | Description |
---|---|
pathToMakensis |
Specify the full path to makensis |
compilerArguments |
Specify the default arguments for makensis |
showNotifications |
Show build notifications indicating success or failure |
alwaysShowOutput |
If false the output channel will only be shown on errors |
alwaysOpenBuildTask |
Specify whether to open the newly created build task |
nsl.pathToJar |
Specify the full path to nsL.jar |
nsl.customArguments |
Specify the default arguments for nsL Assembler |
bridlensis.pathToJar |
Specify the full path to BridleNSIS.jar |
bridlensis.customArguments |
Specify the default arguments for BridleNSIS |
bridlensis.nsisHome |
Specify the NSIS home directory |
Shortcuts
Action | Syntax | Shortcut |
---|---|---|
Compile NSIS | source.nsis |
Ctrl+Shift+B |
Compile NSIS (strict) | source.nsis |
Ctrl+Alt+Shift+B |
Transpile nsL Assembler | source.nsl |
Ctrl+Shift+B |
Transpile BridleNSIS | source.nsis.bridle |
Ctrl+Shift+B |
Task Runner
If you prefer Visual Studio Code's in-built Task Runner to build scripts, you can create tasks.json
in the project root using the NSIS: Create Build Task command from the command-palette.
Note: The created Task Runner will adapt to the user settings specified in settings.json
.
License
If not otherwise specified (see below), files in this repository fall under The MIT License and the GNU General Public License, version 2.0.
An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”.
Donate
You are welcome support this project using Flattr or Bitcoin 17CXJuPsmhuTzFV2k4RKYwpEHVjskJktRd