Giter VIP home page Giter VIP logo

blu3mania / npp-papyrus Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 7.0 844 KB

Notepad++ plugin to provide Papyrus scripting language support to Notepad++, such as syntax highlighting with automatic recognition of class names/functions/properties, keywords matching, and hyperlinks to referenced scripts. It also comes with a compiler that can provide compilation errors in a separate list window, as well as inline annotation and indication where errors are reported, plus support anonymization of compiled .pex files.

License: GNU General Public License v3.0

C++ 99.69% CMake 0.31%
papyrus notepad-plusplus-plugin papyrus-language skyrim-modding notepadplusplus notepad-plus-plus skyrim skyrim-special-edition skyrim-se fallout4

npp-papyrus's Introduction

Papyrus Plugin for Notepad++

GPL v3 License Notepad++ Plugin Visual Studio 2022 Visual Studio Code C++

Build Status CodeQL Status Microsoft C++ Code Analysis Status Latest Release

This plugin adds support for Bethesda's Papyrus scripting language to Notepad++. It provides syntax highlighting with automatic recognition of class names/functions/properties, supports keywords matching and hyperlinks to referenced scripts. It also comes with a compiler that can provide compilation errors in a separate list window, as well as inline annotation and indication where errors are reported, plus anonymization of compiled .pex files.

This plugin is derived from the original PapyrusPlusPlus plugin created by tschilkroete, with many bug fixes, enhancements, and made to work with the latest Notepad++ release.

Changes from original work

Bug fixes

  • [Lexer] Syntax highlighting with lexer now properly works with the latest Notepad++ version, so you no longer need to use a separate user-defined language XML, which defeats the purpose of a lexer.
  • [Compiler] Can now handle huge compilation error list (this usually happens when a referenced script has errors or referenced script source does not exist), so that status message no longer gets stuck at "Compiling...".
  • [Compiler] In error list window, clicking on an error from a file that has not been opened yet will now correctly move cursor to the error line.
  • [Compiler] Any exceptions while trying to compile the script are now properly shown to user (exceptions likely won't happen anyway).
  • [Lexer] Operators are now correctly styled with defined Operator style, instead of the wrong Type style.
  • [Lexer] Proper syntax highlighting with strings that contain double quote escapes.
  • [Lexer] Proper syntax highlighting with integer literals that start with minus sign.
  • [Lexer] Proper syntax highlighting with float literals that contain decimal point.
  • [Lexer] Proper syntax highlighting with comments where "/" appears before/after ";" with spaces in between.
  • [Lexer] Word "property" in comments is now correctly excluded from property handling.
  • [Lexer] Correctly detect properties in edge cases like copying property lines and then editing.
  • [Lexer] White spaces are now styled correctly.
  • [Compiler] Only run compiler if active file is using Papyrus Script lexer. Configurable behavior, default on.
  • [Compiler] Properly release process handle after compilation.

Improvements

  • [Lexer] Upgrade to support Scintilla's ILexer5.
  • [Lexer] Support folding on properties. Original plugin likely omitted properties from folding since it could not exclude those that have definitions done in a single line.
  • [Lexer] Support "folding in code, middle" so that Else and ElseIf can be folded as well. Configurable behavior, default on.
  • [Compiler] Compilation error list window will be hidden when starting a new compilation.
  • [Compiler] Compilation error list window will not contain duplicate error messages.
  • [Compiler] Support more compilation flags:
    • -optimize (all games)
    • -release and -final (Fallout 4)
  • [Compiler] Handle the rare compilation error cases with "-op" flag when errors are reported on .pas files.
  • [Compiler] Handle generic compilation errors that are not reported on source files or .pas files, e.g. when one of the import directories is invalid.
  • [Lexer] Separate the list of Papyrus language defined keywords into 2, so Parent/Self/True/False/None can be styled differently.
  • [Compiler] Status bar shows the game name for current Papyrus script file.
  • [Compiler] Status bar shows compiling status if switching to another file and back while compiling.
  • [Compiler] When compilation succeeds or fails, status bar shows the file name alongside result message, if current file window is not the same as the one that got compiled.
  • [Lexer] Slightly better performance in syntax highlighting with property name caching, especially with big script files.
  • [Lexer] In addition, class name caching can be turned on in Settings menu. However, there is a caveat. See configuration guide for details. Configurable behavior, default off.
  • [Settings] No more forced setup on startup.
  • [Settings] Revamped UI with many more settings now configurable.

New features

  • [Compiler] Anonymize compiled .pex file. In case you are not aware, when you use PapyrusCompiler to compile any script your user account and machine name are stored inside the generated .pex file, so it's a big privacy concern.
  • [Annotator] Show annotation below error lines, and/or show indications where errors are. Configurable behavior, default on.
  • [Compiler] Skyrim SE/AE and Fallout 4 support.
  • [Compiler] Auto detection of game/compiler settings to be used based on source script file location.
  • [Lexer] Support of new Papyrus syntax/keywords of Fallout 4.
  • [Lexer] Syntax highlighting of function names.
  • [Lexer] Class names can be styled as links to open the script files. FO4's namespace support is included. Configurable behavior, default on (Ctrl + double click).
  • [Lexer] Hover support on properties.
  • [Matcher] Highlight on matching keywords.
  • [Matcher] Go to matching keyword.
  • [UI] A new Advanced submenu with:
    • Show langID - can be used to find out internal langID assigned to Papyrus Script lexer, which is useful if you need to manually configure Notepad++'s functionList feature.
    • Install auto completion support - provides auto-completion support for functions defined in base game, SKSE, and even SkyUI.
    • Install function list support - allows using View -> Function List menu to show all defined functions in a Papyrus script file.
  • [UI] Dark mode support.

Download

Get the latest release from here.

Installation

Please find installation guide here.

WARNING:

  • Do not install versions prior to v0.3.0 if you are using Notepad++ v8.3+.
  • Do not install v0.3.0+ if you are using a Notepad++ version prior to v8.3.

Configuration

Please find configuration guide here.

Building

The project comes with the needed Scintilla/Lexilla and Notepad++ files for building. It also references GSL and TinyXML2 as submodules, which means if you clone the repository, you should specify --recurse-submodules to also get these modules in your local repository.

  • To build the project in Visual Studio 2022, just open the solution file in VS2022 and build.

  • For those who use Visual Studio Code, a .vscode folder is provided at top level, with tasks defined and the default build task uses MSBuild to generate the Release|x64 output. Note, you need to download and install Build Tools for Visual Studio 2022 from this page. Make sure to include Desktop development with C++ workload during installation.

    Launch VSCode from Developer Command Prompt for VS 2022 by running "code ." from src directory, so that environment needed by MSBuild is set up properly.

  • The third option is cmake. A CMakeLists.txt file is provided in src directory. It is recommended to use a separate build directory at top level. For example, "cmake -S src -B build" creates a build directory at top level and prepares the build environment, then, "cmake --build build --config Release" builds the project in release mode.

Code Structure

├── .github - GitHub related files
│   └── workflows - GitHub action workflows
├── .vscode - configuration files for VS Code
├── dist - output folder, used by build script to create the release package
│   ├── extras - extra configuration files that can be used in Notepad++
│   │   ├── autoCompletion - auto completion configuration file for Papyrus scripts
│   │   ├── functionList - function list configuration file for Papyrus scripts
│   │   └── userDefineLangs - user-defined Papyrus language instead of this plugin's lexer
│   └── themes - lexer configuration files for specific themes
│       └── DarkModeDefault - lexer configuration file for Dark Mode
└── src - source code
    ├── external - source files from external projects (may be modified)
    │   ├── gsl - references GSL as submodule
    │   ├── lexilla - Lexilla source files
    │   ├── npp - Notepad++ source files
    │   ├── scintilla - Scintilla source files
    │   ├── tinyxml2 - references TinyXML2 as submodule
    │   └── XMessageBox - adopted and modified XMessageBox to provide dark mode support
    └── Plugin - source files of this plugin
        ├── Common - common definitions and utilities shared by all modules
        ├── CompilationErrorHandling - show/annotate compilation errors
        ├── Compiler - invoke Papyrus compiler in a separate thread
        ├── Lexer - Papyrus script lexer that provides syntax highlighting
        ├── KeywordMatcher - matching keywords highlighter
        ├── Settings - read/write Papyrus.ini and provide configuration support to other modules
        └── UI - other UI dialogs, such as About dialog

Disclaimer

Both original work and this plugin are licensed under GPL v3, so make sure you read and understand it if you are creating derived work. Most importantly, you cannot modify the code and only publish binary output without making the modified code also publicly available.

npp-papyrus's People

Contributors

blu3mania avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

npp-papyrus's Issues

NP++ crashing on versions after 8.2.1

Just updated to the latest NP++ 8.3.1 (64bit) and unless I disable the Papyrus Lexer plugin (by renaming the folder) NP++ crashes on launch, occasionally it doesn't crash but then when selecting a .psc file it then crashes. When I go back to 8.2.1 all is fine
There is a comment in the NP++ forums regarding recompilation due to some change in how NP++ interfaces with plugins, is this relevant?
https://community.notepad-plus-plus.org/topic/22619/notepad-8-3-1-crashes-and-closes-without-warning

diziet

SkyrimSE scripts compiling outside game directory

When compiling a script outside data/script/source (which I do accidentally all the time comparing one script with another!) the script is still compiled but into a 'scripts' subdirectory of the location of the psc file.
I'd like to have the option to turn this off (maybe with a notification when tried as well) or to have the pex file placed into the data/scripts directory that I have already specified in the settings for the plugin.
This is with SkyrimSE .

diziet

Function List not showing arrays

The function list doesn't seem to show functions that return arrays, such as:
Form[] Function dz_make_inventory_array(Actor NPCref)
or
String[] Function dz_make_strings_array(Form[] array,Int array_length)
When I remove the [] and save the document then the function shows up in the list.

diziet

Thick composition underline in the Keyword Matcher has a duller tone than selected

Under keyword matcher, selecting "Thick composition underline" turns the colour selected dull in the latest version of the plugin (v1.0.0 (Build 31) ) using the latest version of Notepad++ (v8.5.4 64-bit).

What I have tested:

  • Both "Matched Style" and "Unmatched Style" have a dull tone when selecting "Thick composition underline".
  • It doesn't change when switching between light mode and dark mode in Notepad++ .
  • Resetting the lexar styles under advanced for this plugin doesn't fix the issue.
  • The colour is not dull using an older version of plugin (Papyrus Plugin = v0.3.0 (Build 24), Notepad++ v8.3.3 64-bit).

What happens in an older version of the plugin:

Papyrus Plugin = v0.3.0 (Build 24)
Notepad++ v8.3.3 64-bit

  • "Thick composition underline" has the same tone as "Thin composition underline".

What happens in the newer version of the plugin

Papyrus Plugin = v1.0.0 (Build 31)
Notepad++ v8.5.4 64-bit

  • "Thick composition underline" has a duller tone compared to "Thin composition underline".

Image:

Untitled

Batch compile

If I wanted to compile a whole load of psc files is there way to use your plugin and notepad++ to do this?

diziet

FO4 namespaces

Does the comment on the latest commit mean that I can now compile a script in user subfolder in FO4 without using a project file?
I could never get that to work before and gave up; just put everything in ../source:)

diziet

NameSpace

I can't compile any script after version 0.5, compiler doesn't recognize name space (folder path) and throw a warning about script name mismatch. v0.5 works fine.
Game: Fo4.

Can't properly set up the output directory

This is so odd that I feel like I must be doing something wrong, but the compiler simply ignores the path that I enter into the "Output Directory" field in the game settings. Instead, whatever folder name I have entered in the "Default output directory" field in the compiler settings, it creates inside the Source\Scripts folder. By default it is set to "Scripts", so when I compile, it places the compiled script in "Data\Source\Scripts\Scripts". If I clear that field the compiler simply gives out an error. This can't be by design, can it? I am compiling into a mod organizer mod folder, so maybe that's it?

EDIT: Nevermind I'm dumb, I had to put the entire filepath in the default directory field, pls ignore

Papyrus plugin settings didn't save

I made changes to directories for Skyrim compiling, and after closing dialog and then restarting Notepad++, the old settings are always back.

I figured a workaround from your configuration doc file; from "%APPDATA%\Notepad++" i found Papyrus.ini and Papyrus++.ini that were actually saved with info i had changed. It's weird that they weren't actually loaded though. I copied those 2 files to "C:\Program Files\Notepad++\plugins\Config" and then they loaded.

This is on Win10-64bit, also 64-bit plugin because of that.

Request fro more keyword categories

Other user defined versions of Papyrus language I have found for notepad++ had more categorys of keywords (although they were not able to be configured from the style configurator of course).
It would be cool to have two or three extra user sets of keywords available in the style configurator. Personally I would like to have a different colour for SKSE/F4SE functions etc.
I tried editing the xml file but I had no joy, I read online that the lexer itself (dll) must support the keywrod categories?

diziet

edit: apparently I can't spell:)

Dark mode support

Enabling dark mode results in undesirable text and background coloring

화면 캡처 2022-09-04 234650

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.