kapiainen / sublimepapyrus Goto Github PK
View Code? Open in Web Editor NEWA Sublime Text 2 and 3 package for the Papyrus scripting language.
License: MIT License
A Sublime Text 2 and 3 package for the Papyrus scripting language.
License: MIT License
Since I updated to version 2.4.0 yesterday, I noticed that the sublime commands for toggling comments are no longer working for 'Papyrus - Skyrim' files.
Edit -> Comment -> Toggle Comment (Ctrl+/) | Toggle Block Comment (Ctrl+Shift+/)
I'm not sure if this is this is really a issue with SublimePapyrus, but it was working with the previous version I was using (v1.x, don't remember exactly which one I had before).
If I press CTRL+SHIFT+P I can see the SublimePapyrus Create Default INI command, but when I choose it nothing happens. There is no INI in My Documents. I tried creating the INI there manually, but it doesn't seem recognize it. Running as admin. Tried in SublimeText 2, 3, and portable, same result. What am I doing wrong?
A setting to prevent the folder containing the vanilla Skyrim .psc files from being batch compiled would be an enhancement. Maybe as an ini setting? If I remember correctly I read on the CK wiki you should never batch compile the scripts folder from the CK script editor so maybe it should be prevented on the command line anyway.
First off: This is not talking about the Selection Focus, but the Screen Focus.
I believe this is related to the Linter portion of the Skyrim Syntax. Whenever there is an error in the .psc file, it will jump to that line and put it in the center of my screen. Great, incredibly helpful...until every time i modify the source code it steals focus from where i was, to try and show me the error i already knew about.
It would be great if you stored the last errors line #, and ensured that the # didn't change >2 lines before stealing focusing.
Reproducible steps: On a large .psc file (I was modifying a 2.7k line script), copy and paste an if statement on a variable, and change the variable name. Return to the top of the script to create the new variable for it, and do the same for the properties (Lazy coding ftw :>), but after pasting the property, the focus will be returned to the last error.
Also, are you taking feature requests? If so, i have one but not sure if it's possible to (cleanly) implement.
When attempting to generate completions for Skyrim SE, it fails to complete with the following console error:
Exception in thread Thread-5:
Traceback (most recent call last):
File "./python3.3/threading.py", line 901, in _bootstrap_inner
File "./python3.3/threading.py", line 858, in run
File "Plugin in C:\Users\Verteiron\AppData\Roaming\Sublime Text 3\Installed Packages\SublimePapyrus - Skyrim.sublime-package", line 62, in generate_completions
File "./python3.3/encodings/cp1252.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 557: character maps to <undefined>
I always get 288 completion files, and the last one is always "SublimePapyrus - Skyrim - CWFortSiegeBarricadeScript".
Edit: I get the same thing now when trying to generate completions for vanilla Skyrim, too. This started after a clean install of Windows 10, Sublime 3, and the latest SublimePapyrus.
Fallout 4 I believe added some new opcodes meaning an update is now required to handle highlighting.
Freshly installed Sublime Text 2 and Sublime Papyrus. Only change I made to SublimePapyrus.sublime-settings was:
"compiler":"F:/Games/Steam/SteamApps/common/Skyrim/Papyrus Compiler/ScriptCompile.bat"
and
"import": ["F:/Games/Steam/SteamApps/common/Skyrim/Data/Scripts/Source"]
When I open a vanilla Skyrim script, I can compile it fine. If I put any argument into the "arguments" setting, it gives the error "The arguments setting has to be a list of strings." I've tried an argument list that looks like [""], ["hi"], ["hi", "hello"], ["F:/Games/Steam/SteamApps/common/Skyrim/Data/Scripts/Source"], and they all give the error.
I was working on re-writing the Get() function of a non-auto property when the crash occurred. I was inserting an if statement, and was moving some portion of the code so that it was inside the new conditional statement. I had written the if keyword, but not the endif keyword. My code selection accidentally included one line more than I had intended, and the return statement was grabbed and moved with it. Also, I had just grabbed and moved the return value (it was another function call) to an earlier point in the same function, assigning it to a variable which would contain the return value, but had not yet put the variable after the return statement, so that the line with the return statement did not have any return value. I noticed that something was wrong when I tabbed to indent a line, but instead the cursor jumped to the end of some other line further down, such as the EndFunction line, instead of indenting. The console output is below:
Traceback (most recent call last):
File ".\sublime_plugin.py", line 190, in on_post_save
File ".\sublime_plugin.py", line 154, in run_timed_function
File ".\sublime_plugin.py", line 189, in
File ".\Plugin.py", line 174, in on_post_save
File ".\Plugin.py", line 398, in Linter
AttributeError: 'EventListener' object has no attribute 'scriptContents'
As an aside, but not related directly to the crash, I've noticed that there doesn't seem to be any completion features for writing non-auto properties. If I may make a small feature request, it would be to add completion functionality for the Get() and Set() Functions, as well as the EndProperty Keyword. This isn't really a big deal for me, though, but I thought I'd ask.
Thanks!
Jim
The linter doesn't seem to recognize the length property of arrays.
Example:
int[] myArray = new int[3]
int len = myArray.Length
Error in line xxx: 'INT' does not have any properties, functions, nor events...
I had another issue with Code Completion. I wasn't sure if you'd prefer me to append it to my previous report as a new comment, or start a new thread this way. But, since the new error seems to be caused in some other part of the plugin's code, I figured that creating a new thread was preferable.
As near as I can tell, the code completion stopped working while I was in the middle of creating either an if statement or a while loop. This time around, I did not save or compile the code as a precursor to the failure. Instead, it seemed as if everything was working fine while editing one line, then stopped in the middle of editing the next. The console reported this error:
Traceback (most recent call last):
File ".\sublime_plugin.py", line 236, in on_query_completions
File ".\Plugin.py", line 507, in on_query_completions
File ".\Plugin.py", line 604, in Completions
AttributeError: 'EmptyStateCancel' object has no attribute 'keywords'
The failure occurred while I was writing some control code that accessed properties and functions in another script of mine that is part of the same project, However, neither script extends the other, and the script I was referencing had no syntactical errors and did compile fine both before and after this point. Code completion was working while referencing properties from the same script just one or two lines before.
I should mention that I had not yet updated to version 2.6.4, but that I had previously turned linter_panel_error_messages to false as a temporary workaround for the previous bug I reported.
EDIT: I just updated to 2.6.4, and got the same problem almost right away. Code completion worked on one line (the one where it failed last time), I moved on to writing another function, and it stopped again. The circumstances were similar: I was referencing a function in another script, same as before. The console error is also nearly identical. I've copied it below.
Traceback (most recent call last):
File ".\sublime_plugin.py", line 236, in on_query_completions
File ".\Plugin.py", line 509, in on_query_completions
File ".\Plugin.py", line 606, in Completions
AttributeError: 'EmptyStateCancel' object has no attribute 'keywords'
See the fallout4-dev and fallout4-experimental branches
TODO:
When ready for a public release:
Autocomplete for OnStoryAddToPlayer prouduces:
However, this is missing a lot of possible parameters for the Event
.
You can see in the Creation Kit Wiki that the full Event
declaration should look like:
Here is a sample of some papyrus code that breaks the syntax highlighter.
;1 = Newline
;2 = Tab
;3 = Double quote
;4 = Backslash
string Function GetDelimiter(int aiDelimiter = 1) Global
If(aiDelimiter == 1)
return "\n"
ElseIf(aiDelimiter == 2)
return "\t"
ElseIf(aiDelimiter == 3)
return "\""
ElseIf(aiDelimiter == 4)
return "\\"
return "\\" ; this fixes the sublime syntax highlighter
Else
return ""
EndIf
EndFunction
I use this silly function solely to prevent the highlighter from breaking. If you remove the extra return then everything under that line will use the yellow "string" highlighting.
Thanks a lot for making SublimePapyrus! It's great! I use it every day.
In the below screenshot you can see the syntax highlighting of the FormID inside the GetForm()
function call starts out purple but then SublimeText switching to white because the x
character throws off its expectations. The whole text in there should be purple, yeah?
[edit] figured it out.
Steps to reproduce:
Inside a Papyrus script, type Event OnI
. You should see completion options, including Event OnInit
. Press Enter to select that completion option. You'll see that it inserts the completion text and you end up with:
The initial Event
keyword wasn't replaced so you end up with Event Event
, which won't compile.
PackageControl
is the de-facto way to install ST2/3 packages.
I would like to suggest that this package be added to their repository. Instructions on how to do that can be found here: https://packagecontrol.io/docs
I'm using your TextMate grammar bundle in PyCharm. Syntax highlighting breaks on the first function call in any script.
Tested all versions from 1.0.0 to 2.7.1.
For example:
If I comment out that call, highlighting breaks on the next function call.
;Debug.Trace("Master of Disguise: PlayerScript> " + asMessage)
If I remove the first parenthesis, highlighting breaks on the next function call, but that's obviously incorrect.
Debug.Trace"Master of Disguise: PlayerScript> " + asMessage)
If I remove the value altogether, highlighting breaks on the next function call, but that's obviously incorrect, too.
Debug.Trace()
I'm having an intermittent problem with code completion in Sublime 2. When I first fire up Sublime, everything works as expected after I save the script once (The message in the status bar says the Linter needs to be run once. After I save the script, even without making changes, autocomplete begins to work). However, I find that it may stop working if I make changes to my code that temporarily cause a number of lines to be invalid. As an example, with code like this:
1 Event myevent()
2 dosomething()
3 EndEvent
4
5 Function dosomething()
6
7 EndFunction
I changed Event myevent() to Function mynewfunction(), and neglected to change the EndEvent keyword until some point later, probably following a save. I noticed that the status bar had a message that dosomething() on line 2 wasn't valid in this scope, and that this message persisted even after I made the correction and even if I commented out line 2. At this point the code would compile just fine, but the code completion feature would not work EXCEPT for basic keywords, as well as functions and variables I had defined in that specific file. That is to say, it would not complete for any inherited functions or properties, or for any of the functions defined in Skyrim's source scripts. The only solution I've found so far is to restart Sublime, after which everything works again as expected.
This is just one example, but I've experienced the code completion failing several times recently in various similar circumstances. I should mention that I'm working with multiple files that extend each other, and the changes I'm making would effect more than one script at a time, but that even when any errors are corrected the code completion continues to fail for all of the open scripts until I restart Sublime. If it would help, I can attach several files I'm working on with specific instruction on how I can reliably reproduce the problem.
I'm really not sure what caused this one. I didn't notice the crash for a little while, and I can't say exactly what preceded it. Hopefully the console error is useful to you, though.
Exception in thread Thread-3490:
Traceback (most recent call last):
File ".\threading.py", line 532, in __bootstrap_inner
File ".\threading.py", line 736, in run
File ".\Plugin.py", line 413, in Linter
File "C:\Users\Kaisers\AppData\Roaming\Sublime Text 2\Packages\SublimePapyrus - Skyrim\Linter.py", line 530, in Process
if self.Statement() >= 0:
File "C:\Users\Kaisers\AppData\Roaming\Sublime Text 2\Packages\SublimePapyrus - Skyrim\Linter.py", line 780, in Statement
elif self.token.type == self.KW_STATE or (self.token.type == self.KW_AUTO and self.Peek().type == self.KW_STATE):
AttributeError: 'NoneType' object has no attribute 'type'
Hello.
When I try to Ctrl+B (Compile the .psc to .pex in Fallout 4) it tells me this in the console.
Sublime Text 3, Windows 10 x64
By the way, for the package settings, they were both empty (Default and User) so I had to go into the package folder (SublimePapyrus) and find SublimePapyrus.sublime-settings from \AppData\Roaming\Sublime Text 3\Packages\SublimePapyrus-master\Source\Core
Certain keywords (e.g. self, parent, as, auto) are still missing proper syntax highlighting.
Thanks to Scrivener07 for bringing this to my attention.
The installation instructions don't seem to be correct for the latest repository. I'm a complete newbie to sublime text, however there did not seem to be any 'sublime-package' file in the repo. There is also no SublimePapyrus INI command that shows up when doing Ctrl+Shift+P, although both the Syntax highlighting and the Build system show up. When attempting to build (F7) with a valid Papyrus 'hello world' style script, it would say it could not find target command 'compile_papyrus'. I looked in all files in the repository for the text 'compile_papyrus', and only found it in one file (I think it was a sublime-build file, but nothing else).
I'd love to use the latest editions :D
Ran into another instance where the linter crashed, partially. I did not notice that there was a problem at first because the plugin continued to work as expected when dealing entirely with locally defined functions, variables, etc. However, it no longer was able to supply completions for anything in parent scripts, or any other script for that matter. I found the following error in the console:
Exception in thread Thread-14621:
Traceback (most recent call last):
File ".\threading.py", line 532, in __bootstrap_inner
File ".\threading.py", line 736, in run
File ".\Plugin.py", line 465, in Linter
File "C:\Users\Kaisers\AppData\Roaming\Sublime Text 2\Packages\SublimePapyrus - Skyrim\Linter.py", line 1703, in Process
extends = self.GetLineage(self.header.data.parent)
File "C:\Users\Kaisers\AppData\Roaming\Sublime Text 2\Packages\SublimePapyrus - Skyrim\Linter.py", line 1551, in GetLineage
if not self.CacheScript(name, fullPath):
File "C:\Users\Kaisers\AppData\Roaming\Sublime Text 2\Packages\SublimePapyrus - Skyrim\Linter.py", line 1619, in CacheScript
if statements[0].type == self.STAT_SCRIPTHEADER:
IndexError: list index out of range
It seems to have occurred when attempting to save or build a file that had an error in it. I'm not sure of the exact circumstances, however, since I did not notice the problem for a little while. I can say, however, that I was working on changing how inheritance worked on a few scripts. Whereas previously I had something like:
ScriptName parentscript Extends quest
ScriptName childscript Extends parentscript
I was inserting a script in between the two, so I had:
ScriptName parentscript Extends quest
ScriptName intermediary Extends parentscript
ScriptName childscript Extends intermediary
The condole error occurred in the middle of making these changes.
I am trying to configure the papyrus build system to compile every single script in a specified folder where that folder is the directory of the currently selected tab in ST3, to avoid rebuilding unwanted directories such as ..\Skyrim\Data\Scripts\Source*.psc. Ive read this is done by passing a directory instead of a file as the first argument and setting the -all flag.
Here is how Ive configured the ini file.
[Skyrim]
scripts=D:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source
compiler=D:\Games\Steam\steamapps\common\skyrim\Papyrus Compiler\PapyrusCompiler.exe
output=D:\Games\Steam\steamapps\common\skyrim\Data\Scripts
flags=TESV_Papyrus_Flags.flg
[Import]
path0=M:\TES5\Wrye\Bash Installers\Scribe Gameplay\Scripts\Source
path1=M:\TES5\Wrye\Bash Installers\Scribe Toxicity\Scripts\Source
path2=M:\TES5\Wrye\Bash Installers\Scribe Vitality\Scripts\Source
[Debug]
arg0=all
When I execute the build system I get this output..
Folder "D:\Games\Steam\steamapps\common\skyrim\Papyrus Compiler\ScribeVitality_ConfigBase.psc" does not exist
[Finished in 0.1s]
And further Ive also tried adding a new build system with the absolute directory.
{
"target": "compile_papyrus",
"cmd": "M:\\TES5\\Wrye\\Bash Installers\\Scribe Vitality\\Scripts\\Source",
"file_regex": "^(.*\\.psc)\\(([0-9]*),([0-9]*)\\):\\s*(.*)$",
"selector": "source.papyrus"
}
Which gives the following output..
Folder "D:\Games\Steam\steamapps\common\skyrim\Papyrus Compiler\Source" does not exist
[Finished in 0.1s]
This -all parameter seems to be changing the working directory to PapyrusCompiler.exe its self. I would appreciate any help configuring this as its been a very long time since Ive done any TES5 modding.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.