From ca442621a1b453073d27695a3af4840dc7fd59ab Mon Sep 17 00:00:00 2001 From: "Jan T. Sott" Date: Tue, 17 Mar 2026 22:57:03 +0100 Subject: [PATCH 1/3] add Goto Reference support --- NSIS.sublime-syntax | 20 ++++++++++++++++++++ Symbol List.tmPreferences | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Symbol List.tmPreferences diff --git a/NSIS.sublime-syntax b/NSIS.sublime-syntax index dbbc8d7..8c940ef 100644 --- a/NSIS.sublime-syntax +++ b/NSIS.sublime-syntax @@ -18,6 +18,26 @@ variables: definitions: '\$\{[\!\w\.:\^-]+\}' contexts: main: + # Function definition + - match: '^\s*(?i)(Function)\s+(\.?\w+)' + captures: + 1: keyword.nsis + 2: entity.name.function.nsis + # Macro definition + - match: '^\s*(?i)(\!macro)\s+(\w+)' + captures: + 1: keyword.other.nsis + 2: entity.name.function.macro.nsis + # Define definition + - match: '^\s*(?i)(\!define)\s+(?:/\w+\s+)*(\w+)' + captures: + 1: keyword.other.nsis + 2: entity.name.constant.define.nsis + # Variable declaration + - match: '^\s*(?i)(Var)\s+(?:/GLOBAL\s+)?\"?(\w+)\"?' + captures: + 1: keyword.nsis + 2: entity.name.variable.nsis - match: ^\s*(?i)(Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CPU|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|Function(End)?|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetRegView|GetShellVarContext|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfAltRegView|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestAppendCustomString|ManifestDisableWindowFiltering|ManifestDPIAware|ManifestGdiScaling|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PageEx(End)?|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadMemory|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(End)?|SectionGroup(End)?|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressionLevel|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|UnsafeStrCpy|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b scope: keyword.nsis - match: ^\s*(?i)(CompareDLLVersions|CompareFileTimes|DirShow|DisabledBitmap|EnabledBitmap|GetFullDLLPath|GetParent|LangStringUP|PackEXEHeader|SectionDivider|SetPluginUnload|SubSection(End)?|UninstallExeName)\b diff --git a/Symbol List.tmPreferences b/Symbol List.tmPreferences new file mode 100644 index 0000000..db4f15d --- /dev/null +++ b/Symbol List.tmPreferences @@ -0,0 +1,15 @@ + + + + + scope + entity.name.function.nsis, entity.name.function.macro.nsis, entity.name.constant.define.nsis, entity.name.variable.nsis + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + From 6ba6e144fbece8e444f581b88adf97408d2bfe3b Mon Sep 17 00:00:00 2001 From: "Jan T. Sott" Date: Wed, 18 Mar 2026 17:50:13 +0100 Subject: [PATCH 2/3] include Sections in Goto Reference support --- NSIS.sublime-syntax | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NSIS.sublime-syntax b/NSIS.sublime-syntax index 8c940ef..7929e0e 100644 --- a/NSIS.sublime-syntax +++ b/NSIS.sublime-syntax @@ -38,6 +38,17 @@ contexts: captures: 1: keyword.nsis 2: entity.name.variable.nsis + # Section/SectionGroup with explicit ID + - match: '^\s*(?i)(Section(?:Group)?)\s+(?:/[oe]\s+)?(?:"[^"]*"\s+)(\w+)' + captures: + 1: keyword.nsis + 2: entity.name.section.nsis + # Section/SectionGroup with name only (no ID) + - match: '^\s*(?i)(Section(?:Group)?)\s+(?:/[oe]\s+)?(?:"([^"]+)"|([\w.-]+))\s*$' + captures: + 1: keyword.nsis + 2: entity.name.section.nsis + 3: entity.name.section.nsis - match: ^\s*(?i)(Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CPU|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|Function(End)?|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetRegView|GetShellVarContext|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfAltRegView|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestAppendCustomString|ManifestDisableWindowFiltering|ManifestDPIAware|ManifestGdiScaling|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PageEx(End)?|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadMemory|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(End)?|SectionGroup(End)?|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressionLevel|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|UnsafeStrCpy|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b scope: keyword.nsis - match: ^\s*(?i)(CompareDLLVersions|CompareFileTimes|DirShow|DisabledBitmap|EnabledBitmap|GetFullDLLPath|GetParent|LangStringUP|PackEXEHeader|SectionDivider|SetPluginUnload|SubSection(End)?|UninstallExeName)\b From 74424c09997a68214c992d52a0e9d73fe7c5bf61 Mon Sep 17 00:00:00 2001 From: "Jan T. Sott" Date: Wed, 18 Mar 2026 18:05:22 +0100 Subject: [PATCH 3/3] exclude variables from Goto Reference --- NSIS.sublime-syntax | 5 ----- Symbol List.tmPreferences | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/NSIS.sublime-syntax b/NSIS.sublime-syntax index 7929e0e..6ee702c 100644 --- a/NSIS.sublime-syntax +++ b/NSIS.sublime-syntax @@ -33,11 +33,6 @@ contexts: captures: 1: keyword.other.nsis 2: entity.name.constant.define.nsis - # Variable declaration - - match: '^\s*(?i)(Var)\s+(?:/GLOBAL\s+)?\"?(\w+)\"?' - captures: - 1: keyword.nsis - 2: entity.name.variable.nsis # Section/SectionGroup with explicit ID - match: '^\s*(?i)(Section(?:Group)?)\s+(?:/[oe]\s+)?(?:"[^"]*"\s+)(\w+)' captures: diff --git a/Symbol List.tmPreferences b/Symbol List.tmPreferences index db4f15d..77a8f41 100644 --- a/Symbol List.tmPreferences +++ b/Symbol List.tmPreferences @@ -3,7 +3,7 @@ scope - entity.name.function.nsis, entity.name.function.macro.nsis, entity.name.constant.define.nsis, entity.name.variable.nsis + entity.name.function.nsis, entity.name.function.macro.nsis, entity.name.constant.define.nsis settings showInSymbolList