diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2d01d71 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/CI_build.yml b/.github/workflows/CI_build.yml new file mode 100644 index 0000000..43d552f --- /dev/null +++ b/.github/workflows/CI_build.yml @@ -0,0 +1,33 @@ +name: CI_build + +on: [push, pull_request] + +jobs: + build: + + runs-on: windows-latest + strategy: + max-parallel: 6 + matrix: + build_configuration: [Release, Debug] + build_platform: [x64, Win32, ARM64] + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: MSBuild of plugin dll + working-directory: .\ + run: msbuild LuaScript.sln /m /p:configuration="${{ matrix.build_configuration }}" /p:platform="${{ matrix.build_platform }}" /p:PlatformToolset="v143" + + - name: Archive artifacts + if: matrix.build_configuration == 'Release' + uses: actions/upload-artifact@v3 + with: + name: plugin_dll_${{ matrix.build_platform }} + path: | + bin\${{ matrix.build_configuration }}_${{ matrix.build_platform }}\LuaScript.dll + bin\${{ matrix.build_configuration }}_${{ matrix.build_platform }}\Lua.dll diff --git a/.gitignore b/.gitignore index f7d7d2e..28a90c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,56 @@ -## From https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.suo *.user +*.userosscache *.sln.docstates -# Build results +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs +# Build results [Dd]ebug/ +[Dd]ebugPublic/ [Rr]elease/ +[Rr]eleases/ x64/ -build/ +x86/ +bld/ [Bb]in/ [Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + *_i.c *_p.c +*_i.h *.ilk *.meta *.obj @@ -42,21 +70,31 @@ build/ *.vssscc .builds *.pidb -*.log +*.svclog *.scc +# Chutzpah Test files +_Chutzpah* + # Visual C++ cache files ipch/ *.aps *.ncb +*.opendb *.opensdf *.sdf *.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess *.vsp *.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ # Guidance Automation Toolkit *.gpState @@ -64,6 +102,10 @@ ipch/ # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode # TeamCity is a build add-in _TeamCity* @@ -71,9 +113,21 @@ _TeamCity* # DotCover is a Code Coverage Tool *.dotCover +# Visual Studio code coverage results +*.coverage +*.coveragexml + # NCrunch -*.ncrunch* +_NCrunch_* .*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ # Installshield output folder [Ee]xpress/ @@ -92,68 +146,148 @@ DocProject/Help/html publish/ # Publish Web Output -*.Publish.xml +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted *.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ -# NuGet Packages Directory -## TODO: If you have NuGet Package Restore enabled, uncomment the next line -#packages/ +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets -# Windows Azure Build Output -csx +# Microsoft Azure Build Output +csx/ *.build.csdef -# Windows Store app package directory +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ # Others -sql/ -*.Cache ClientBin/ -[Ss]tyle[Cc]op.* ~$* *~ *.dbmdl -*.[Pp]ublish.xml +*.dbproj.schemaview +*.jfm *.pfx *.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ # RIA/Silverlight projects Generated_Code/ -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm # SQL Server files -App_Data/*.mdf -App_Data/*.ldf +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml -# ========================= -# Windows detritus -# ========================= +# CodeRush +.cr/ -# Windows image file caches -Thumbs.db -ehthumbs.db +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc -# Folder config file -Desktop.ini +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config -# Recycle Bin used on file shares -$RECYCLE.BIN/ +# Telerik's JustMock configuration file +*.jmconfig -# Mac crap -.DS_Store +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs -/Unicode Release -/Unicode Debug -/Release -/Debug -/ResEdit-x64 LuaDist -gh-pages /docs_gen/Editor.lua +bin/ +src/build/ diff --git a/LuaScript.sln b/LuaScript.sln index 10bf81f..341b109 100644 --- a/LuaScript.sln +++ b/LuaScript.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.645 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LuaScript", "src\LuaScript.vcxproj", "{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}" ProjectSection(ProjectDependencies) = postProject @@ -12,24 +12,34 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lua", "src\Lua.vcxproj", "{ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release|ARM64 = Release|ARM64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|ARM64.Build.0 = Debug|ARM64 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|Win32.ActiveCfg = Debug|Win32 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|Win32.Build.0 = Debug|Win32 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|x64.ActiveCfg = Debug|x64 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|x64.Build.0 = Debug|x64 + {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|ARM64.ActiveCfg = Release|ARM64 + {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|ARM64.Build.0 = Release|ARM64 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|Win32.ActiveCfg = Release|Win32 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|Win32.Build.0 = Release|Win32 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|x64.ActiveCfg = Release|x64 {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|x64.Build.0 = Release|x64 + {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|ARM64.Build.0 = Debug|ARM64 {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|Win32.ActiveCfg = Debug|Win32 {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|Win32.Build.0 = Debug|Win32 {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|x64.ActiveCfg = Debug|x64 {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|x64.Build.0 = Debug|x64 + {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|ARM64.ActiveCfg = Release|ARM64 + {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|ARM64.Build.0 = Release|ARM64 {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|Win32.ActiveCfg = Release|Win32 {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|Win32.Build.0 = Release|Win32 {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|x64.ActiveCfg = Release|x64 diff --git a/README.md b/README.md index e6c8812..12f886a 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,42 @@ # LuaScript -Notepad++ plugin for [Lua](http://www.lua.org/) scripting capabilities. Provides control over all of Scintilla's features and options with a light-weight, fully-functional programming language. Download it from the [Release](https://github.com/dail8859/LuaScript/releases) page. + +[![Build status](https://ci.appveyor.com/api/projects/status/lxmu20jgggdm0xl3?svg=true)](https://ci.appveyor.com/project/dail8859/luascript) + +Notepad++ plugin for [Lua](http://www.lua.org/) scripting capabilities. This provides control over all of Scintilla's features and options with a light-weight, fully-functional programming language. Major features include: - Assign Lua functions to shortcut keys -- Register callbacks to specific events +- Register callback functions for events - Full Lua 5.3 functionality - Interactive console with auto-completion - Requires no special permissions -## Documentation -The full API documentation can be found [here](http://dail8859.github.io/LuaScript/). +## Getting Started +Install the plugin using the Notepad++ Plugin Admin, or you can manually download it from the [Release](https://github.com/dail8859/LuaScript/releases) page and extract the zip into your `plugins` folder. -## Examples -Just show me what it can do! Also, check out the [examples](/examples/) directory. +#### Lua Console +LuaScript provides an interactive console for running Lua commands. This can be shown by `Plugins > LuaScript > Show Console`. -- Change Notepad++'s ugly marker symbols: -```lua --- Notepad++ uses 24 internally -editor:MarkerDefine(24, SC_MARK_BOOKMARK) -editor.MarkerFore[24] = 0x0000EE -editor.MarkerBack[24] = 0x6060F2 -``` +#### Startup Script +LuaScript looks for the `\plugins\config\startup.lua` file and automatically runs it on Notepad++ startup. You can easily edit this file via `Plugins > LuaScript > Edit Startup Script`. You can include any commands you want to immediately execute on program startup, as well as register any additional shortcuts or callbacks. -- Find all instances of `image345.jpg`, `image123.png`, etc and modify the number: -```lua -for m in editor:match("(image)(\\d+)(\\.(jpg|png))", SCFIND_REGEXP) do - i = tonumber(editor.Tag[2]) - m:replace(editor.Tag[1] .. i + 1 .. editor.Tag[3]) -end -``` +#### Registering New Shortcuts +New functions can be added as shortcuts by using [AddShortcut](https://dail8859.github.io/LuaScript/classes/Notepad.html#Notepad.AddShortcut). The new menu items are listed under the `Plugins > LuaScript` menu. For example [this script](https://dail8859.github.io/LuaScript/examples/visualstudiolinecopy.lua.html) adds 2 new menu items. -- Get some of Visual Studio's copy and paste functionality: -```lua --- Mimic Visual Studio's "Ctrl+C" that copies the entire line if nothing is selected -npp.AddShortcut("Copy Allow Line", "Ctrl+C", function() - editor:CopyAllowLine() -end) +#### Registering Callback Functions +Scripts can also register functions to be called when certain events occur, such as a file being opened, text being modified, etc. Each callback provides a different set of parameters. See the documentation for [callbacks](https://dail8859.github.io/LuaScript/topics/callbacks.md.html) to see the entire list of possible events and parameters provided. --- Mimic Visual Studio's "Ctrl+X" that cuts the line if nothing is selected -npp.AddShortcut("Cut Allow Line", "Ctrl+X", function() - if editor.SelectionEmpty then - editor:CopyAllowLine() - editor:LineDelete() - else - editor:Cut() - end -end) -``` +## Documentation +The full API documentation can be found [here](http://dail8859.github.io/LuaScript/). Also be sure to check out the [examples](/examples/) directory. ## Development -The code has been developed using MSVC 2013. To compile the code: +The code has been developed using Visual Studio 2019. To compile the code: 1. Open the `LuaScript.sln` file -2. Select the `Win32` platform (x64 is currently experimental) -3. Press `F7` and that's it! +1. Press `F7` and that's it! -For convenience, MSVC automatically copies the DLL into the Notepad++ plugin directory. +For convenience, Visual Studio automatically copies the DLL into the Notepad++ plugin directory. ## License This code is released under the [GNU General Public License version 2](http://www.gnu.org/licenses/gpl-2.0.txt). diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..b2609f9 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,93 @@ +version: 0.10.1.{build} +image: Visual Studio 2019 + +platform: + - x64 + - Win32 + - arm64 + +configuration: + - Release + - Debug + +install: + - if "%platform%"=="x64" set archi=amd64 + - if "%platform%"=="x64" set build_platform=x64 + + - if "%platform%"=="Win32" set archi=x86 + - if "%platform%"=="Win32" set build_platform=Win32 + + - if "%platform%"=="arm64" set archi=amd64_arm64 + - if "%platform%"=="arm64" set build_platform=arm64 + + - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %archi% + + +build_script: + - cd "%APPVEYOR_BUILD_FOLDER%" + - msbuild LuaScript.sln /m /p:Configuration="%configuration%" /p:Platform="%build_platform%" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + +after_build: + - cd "%APPVEYOR_BUILD_FOLDER%" + - ps: >- + + $BuildPath = "$($env:APPVEYOR_BUILD_FOLDER)\bin\$($env:CONFIGURATION)_$($env:BUILD_PLATFORM)" + + Push-AppveyorArtifact "$($BuildPath)\LuaScript.dll" -FileName LuaScript.dll + + Push-AppveyorArtifact "$($BuildPath)\Lua.dll" -FileName Lua.dll + + if ($env:BUILD_PLATFORM -eq "x64") { + $SdkFileName = "LuaScript_SDK_x64.zip" + } + if ($env:BUILD_PLATFORM -eq "arm64") { + $SdkFileName = "LuaScript_SDK_arm64.zip" + } + if ($env:BUILD_PLATFORM -eq "Win32") { + $SdkFileName = "LuaScript_SDK.zip" + } + + 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lauxlib.h" + + 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lua.h" + + 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lua.hpp" + + 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\luaconf.h" + + 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lualib.h" + + 7z a $SdkFileName "$($BuildPath)\Lua.lib" + + Push-AppveyorArtifact $SdkFileName -FileName $SdkFileName + + if ($($env:APPVEYOR_REPO_TAG) -eq "true" -and $env:CONFIGURATION -eq "Release") { + if ($env:BUILD_PLATFORM -eq "x64") { + $ZipFileName = "LuaScript_$($env:APPVEYOR_REPO_TAG_NAME)_x64.zip" + } + if ($env:BUILD_PLATFORM -eq "arm64") { + $ZipFileName = "LuaScript_$($env:APPVEYOR_REPO_TAG_NAME)_arm64.zip" + } + if ($env:BUILD_PLATFORM -eq "Win32") { + $ZipFileName = "LuaScript_$($env:APPVEYOR_REPO_TAG_NAME).zip" + } + 7z a $ZipFileName "$($BuildPath)\LuaScript.dll" + + 7z a $ZipFileName "$($BuildPath)\Lua.dll" + } + +artifacts: + - path: LuaScript*.zip + name: releases + +deploy: + provider: GitHub + auth_token: + secure: qrw+nu8dQKFLG+lNmky6buHsvHFwlibAai0r0aJ3MYbyBniONVxvgnmyx37bPh44 + artifact: releases + draft: true + prerelease: false + force_update: true + on: + appveyor_repo_tag: true + configuration: Release diff --git a/docs/classes/Editor.html b/docs/classes/Editor.html index d2236c3..2a586a6 100644 --- a/docs/classes/Editor.html +++ b/docs/classes/Editor.html @@ -23,7 +23,7 @@
-Generated by LDoc 1.4.3 +generated by LDoc 1.4.6