language-nsis

Atom language support for NSIS, including grammar, snippets and build system

Jan T. Sott

16,194

7

8.17.1

MIT OR GPL-2.0

GitHub

This package consumes the following services:

atom-language-nsis

apm apm apm CI David

Language syntax, auto-completions and build system for Nullsoft Scriptable Install System (NSIS), as well as language syntax for NSIS Language Files.

Screenshot

Screenshot of NSIS in Atom with Fira Mono font & the Hopscotch theme

Features

You can further extend this package with snippets for third-party plug-ins.

Installation

apm

Install language-nsis from Atom's Package Manager or the command-line equivalent:

$ apm install language-nsis

Using Git

Change to your Atom packages directory:

Windows

# Powershell
$ cd $Env:USERPROFILE\.atom\packages
:: Command Prompt
$ cd %USERPROFILE%\.atom\packages

Linux & macOS

$ cd ~/.atom/packages/

Clone repository as language-nsis:

$ git clone https://github.com/idleberg/atom-language-nsis language-nsis

Inside the cloned directory, install dependencies using your preferred Node package manager:

$ yarn || npm install

Build the source:

yarn build || npm run build

Package Dependencies

This package automatically installs third-party packages it depends on. You can prevent this by disabling the Manage Dependencies option in the package settings.

Usage

Completion

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:

However, you have to type __LINE__ to complete to ${__LINE__}.

There are several special cases for your convenience:

Drunken NSIS

Fuzzy syntax completions are available through the “Drunken NSIS” snippets, which iron out some of the inconsistencies of the NSIS language, for instance word order.

Example:

Building

There are many ways to compile NSIS scripts in Atom. But before you read on, make sure makensis is in your PATH environment variable.

This package contains a build system to compile your NSIS scripts. To trigger a build, select “NSIS: Save & Compile” from the command-palette or use the keyboard shortcut.

If you prefer working with custom compiler arguments, you can specify them in the package settings. Optionally, you can also specify the path to makensis.

Third-party Build Tools

Should you prefer working with an existing third-party build system, the following packages already have support for NSIS.

Project files for buildium can be created by executing “NSIS: Create .atom-build file” from the command-palette or using the keyboard shortcut. You can specify your preferred build file syntax (JSON/YAML) in the package settings.

You can set up atom-runner by executing “NSIS: Set default runner” from the command-palette or packages menu. To remove it, use “NSIS: Remove default runner”.

Linting

This package will install an Atom linter provider for makensis. By default, NSIS documents get linted when opened or saved. Make sure to refer to the linter-makensis documentation to learn about available lint modes and other settings.

Other Commands

There are several other, previously unmentioned commands available from the command-palette:

Command Description
NSIS: Command Reference Look up NSIS command online
NSIS: Open Package Settings Opens settings page
NSIS: Show Version Info Shows current version of NSIS
NSIS: Show Compiler Flags Shows output of makensis /HDRINFO
NSIS: Convert Language File Converts NLF to JSON and vice versa

Environment Variables

This extension supports a variety of ways to provide environment variables such as NSISDIR or NSISCONFDIR. The following precedence applies:

  1. .env files
  2. system-wide environment variables

Note: Some operating systems require Atom to be launched from terminal in order to access system-wide environment variables.

Additionally, you can pass special environment variables prefixed with NSIS_APP_ as definitions to your installer script.

Example
# .env
NSIS_APP_ENVIRONMENT=development
# installer.nsi
!if ${NSIS_APP_ENVIRONMENT} == "development"
  DetailPrint "Valuable Debug Information"
!endif

Related

License

This work is dual-licensed under The MIT License and the GNU General Public License, version 2.0