WoWDevelopment Sublime Package
I updated the auto completion and syntax highlighting for WoW API Sublime package created by fRodzet, original forum here.
So whats new?
The syntax highlighing is a lot smarter and it does not depends on the default lua syntax at all. The XML one still reuses everything from the default XML syntax. The Syntax have:
You install it and use it the same way as before. (Sublime Package support coming soon™) After i dump the snippet files into one big sublime-completions file, it would be nice if you guys could help me parametering the remaining API functions. Because there are a lot of them! (16k files) Please report back any weirdness. Download |
I LOVE IT!!
The reason that I moved to Visual Studio Code was because there was an up-to-date WoW bundle created by a user. But now I can stick to ST3 :banana:!! btw, could I cautiously ask you to add a simple syntax highlight for TOC files if you some spare time? Such as:
|
Quote:
But i can put that into the package so it'll be complete. |
Open a lua file, go to: Tool -> Build System -> select: WoW Global Finder Every time you run the build (ctrl+b) it will list every global variables lines in the Sublime console window from that file. |
- Updated for 7.2.5.
- Remove every files, since there was a lot of changes in the file dir tree. |
Okay team, the package is ready for your help.
Most work lies in the API Reference folder: 1. Pick an API from API Reference (parameterless). 2. Parameter it with arguments then move the snippet to API Reference, and delete it from API Reference (parameterless). (Would be nice to keep stuff alphabetically.) 4. If you find a function which should not be on the autocomplete list, Global Blizzard FrameXML/AddOn/GlueXML or any other Interface files, then move it to API Reference (blizzard) and delete it from API Reference (parameterless) (This file will be reviewed, saved and removed later.) 5. (If you would like to add stuff to the Widget References, just add them into the files directly. (Widget API, Widget Handlers)) How to parameter an API? This is how a raw API will look like: Code:
{ The contents is what the autocomplete will print out $1 is where the cursor will land first, $2 for second, $3 for third...$0 is the last cursor position. If you want to highlight a whole words then it should looks like this: ${1:unit}, ${2:value}, \"${3:stringWithNoQuotationMark}\", ${4:\"stringWithQuotationMark\"}, ${5:[\"stringWithQuotationMarkInsideBrackets\"]} So after we search for AbbreviateLargeNumbers in the Blizzard Interface code, we will see it accepts a single string value, and returns a formatted string. So we modify the code like this: Code:
{ 1. " needs to be escaped to \". 2. Tabs and new lines needs to be escaped like \t and \n. 3. Space, (, ), [, ], and , does not need escaping. Since AbbreviateLargeNumbers has a return value that means we also want to make another snippet with _ added in front of it, which autocompletes it with the return value like this: Code:
{ It's very-very important to keep in mind if you make any typo in the .sublime-completions file than the whole file will not get loaded! Also you have to reopen Sublime sometimes after you made some changes in the completions files else you won't see the effect of the changes you made. I plan to do 10-20 API functions per day myself. Would be nice to have some other volunteers too. The best would be if everyone could take care a whole letter of APIs, then there wouln't be any collisions. You can fork/pull request, upload files, post here, send me a mail, send me a mail ingame, send me a pidgeon, i don't care as long as it's copyable/accessible. |
I'm not sure if I'd be helpful, but I'll try to give it a shot.
Btw, would there be any style guide that you are expecting from us to follow? |
I tried this out for a bit and it's quite nifty.
That said, your global functions scope will tag a block such as this: Lua Code:
With that having been noted, why even include local/global as a highlighted scope in the syntax? Isn't that the purpose of the global finder? |
Quote:
The better solution would a script which reads the whole file, collect all functions, and marks the global ones somehow if thats even possible. |
Quote:
|
Quote:
|
Quote:
Maybe we can just combine p3lims method which highlight stuff on the view, and the global finder itself. However this probably means that we need to rewrite the global finder to python and parse that through the current file. And my python knowledge is not that good. At least i don't think we can pass the global finder tables to another python script directly, i could be wrong tho. |
Here's what I've got so far :p
https://pastebin.com/UqzfiqzQ (I'm not yet confident with GitHub, so................) Referred from: |
Quote:
SublimeLinter handles the indicators, and luacheck tells it what to indicate and where via the package in my previous post. It's on the user to install and set up the pieces, which imo is well worth it. |
Quote:
|
Quote:
The goal would be to get rid of some functions so the autocompete could be more efficient and faster. And removing those blizzard functions would be the best solution, since authors don't really use those. |
Quote:
|
Quote:
|
Resike asked me on IRC to make something for highlighting globals, could look like this:
(Yes, io and arg should be highlighted, this was just an example while I work out the kinks) The only downside is that you'd have to have Lua installed (it don't run Lua scripts, but it requires the Lua compilator to find the globals properly). |
Quote:
The actual luacheck binary can be installed in a few ways, all of which are in the GitHub README. Two of these methods will require you to install a lua interpreter, but they also have a windows .exe that bundles everything needed. That said, my original main point was that how locals and globals are highlighted should be determined by the user and not a static part of the syntax. |
Are there any plans to include major libraries written by the community, such as Ace3, LibStub, CBH, LDB, etc?
|
Quote:
|
Completed functions starting with 'E'!
https://pastebin.com/JCwH55hn As you've said, I've ignored those functions belong to Blizzard frame. I've tested them all, but will need some review :) |
Quote:
One question tho, how the hell do i filter what to highlight, since it cries for every little stuff like line length, upvalue and whatever. If you can filter this for only (accessing undefinied variable) that would probably cover the globals, however you still don't know if it's a fucntion or not. |
Quote:
|
Quote:
|
Quote:
|
Quote:
Code:
cmd = 'luacheck - --formatter=plain --no-unused --no-redefined --no-unused-args --no-unused-secondaries --no-self --no-max-line-length --no-max-code-line-length --no-max-string-line-length --no-max-comment-line-length --codes --ranges --filename @' However things that i don't like: - It's sooo slow, i'm not sure why, but it doesn't fit into the Sublime "policy" where everything is lightning fast. - You can't change colors, you have 1 color for errors and 1 for warnings and thats it. Would be nice to have a separate color for global functions. But besides that it's nice. I still think a standalone python script would be better or at least faster, also we could have more control over everything of course. |
Quote:
Reason 1: It has a tendency to slow/crash sublime because the Lua compiler can be slow or return errors. It could be handled, but it's not preferred. Reason 2: The current method can't match the same global multiple times on one line, which could of course be improved. Just dumping the code here in public domain in case anyone wants to use it. Python Code:
|
Quote:
Serious question though, why do you want a separate indicator for global functions? If a variable is global, it has the same implications regardless of it's type. |
Quote:
|
Added the highlighing with Sublime Linter and luacheck:
The globals found by the global finder should match the errors found by luachecker now: |
|
Quote:
|
I still need more volunteers guys, i'm not gonna go through 40 KLOC by myself, and i also have a lot more other stuff to do in the proejct. Any yet only Layback helped.
Currently i'm adding the complete widget API, i have a cool feature where you select lets say the _Texture help autocomplete it prints out every info from that widget type handlers/scripts/inherits in a formatted lua table. |
Would adding the console variables be useful for the package?
They are just strings so I'm not sure if it would be bloat rather than helpful |
Quote:
|
It's been a while since the last commit(?)
Here's an API list for "F" https://pastebin.com/mZajXEBr Please review them. Thank you! |
Quote:
|
I am not sure if this has been discussed before though I read through the 2 pages here and didn't see anything about it. Is it at all possible to set this so when we run something like this it will quit highlighting/reporting a global?
For example Lua Code:
Obviously, it is going to call KkthnxUIConfig and print Now want I am wanting to happen is if I were to call this up at the top of my file like so it will quit highlighting/reporting them so in theory s I know I have covered them. Lua Code:
of even in that case as I handle it Lua Code:
Code:
-- Global variables that we don't need to cache, list them here |
Quote:
I think you might have the default luacheker set as a linter for SublimeLinter instead of my special globalfinder linter script: Go to Tools -> SublimeLinter -> Toggle Linter then enable globalfinder and disable luacheck. I might forgot to include this step from the how to set up the linter. :P |
Quote:
Okay, guess it works. Reset everything to default. Now, how do we handle it if we do not wanna cache a global? In Atom with "mikk's FindGlobals script" linter we could just run -- GLOBALS: GLOBANAME and it would stop reporting it. |
Quote:
|
Quote:
|
Quote:
Lua Code:
This will ignore math and string globals. |
Pushed a full update for 7.3.0.
|
|
Any chance this could be added to package control? I believe it was previously included, so you may just need to update the repo url.
Also, by including luacheck in the package, this causes anyone who already had lua and luacheck installed to get two notifications per error. It may be better to have that feature split into a separate package. It would be good for those like myself who already have luacheck installed on a system level, and just want the wow specific stuff. It's also good for those who don't want the syntax stuff, but are looking global checker without having to install lua, etc. |
Quote:
https://packagecontrol.io/packages/WoW%20Development You can toggle SublimeLinter by linters, if you disable the global finder linter, then you should only get the luacheck results. (aka only one global errors per line) Open the command panel (cltr+shift+p) and search for toggle linter: But moving the Linter/GlobalFinder/SyntaxHighlighter into a different projects are also could be better. |
Quote:
|
Quote:
|
Yeah that did it.
|
Updated for 7.3.5.
|
Not sure if Resike is still on this project, but any advice on how I should set path of WoW Global Finder for portable version of Sublime Text 3?
So, basically Sublime Text Build 3143 x64 is a top folder and WoW Global Finder is located in Sublime Text Build 3143 x64\Data\Packages\WoWDevelopment\WoW Global Finder. I tried the following, but it doesn't seem to be a right syntax :( Code:
// SublimeLinter Settings - User |
You need to use the full path with driver letters and everything which points to your packages folder, i'm not exactly sure what would that be on a portable version, but you should see the packages folder when you open Preferences -> Browse Packages in Sublime.
|
Quote:
C:\Users\<UserName>\Desktop\Sublime Text Build 3143 x64\Data\Packages\WoWDevelopment\WoW Global Finder (It's currently placed on Desktop as you can see) and I guess that's the main problem here. Since it's a portable version, the driver and its root folder would possibly change for each different PCs if I place it on my USB. Of course, I could change the path whenever it does not match, but I'm guessing that there must be a way to solve this issue either by SublimeLinter or Sublime Text 3, itself. |
You could just copy the luacheck.exe into one of your system PATH environment folders where you have write access, for example: "c:\windows\system32". Or if you can edit the system PATH variable adding any folder that contains luacheck.exe. Then Windows should find the exe with no issues.
Also since SublimeLinter 4 got updated the info about making the linter work at the GitHub page is outdated, gonna update it for SL4 too sometime. |
Did a major update for 8.1.5, almost everything is covered (Widget support is not full) using the proper Lua syntax based on this:
https://www.lua.org/manual/5.3/manual.html#9 The new system makes loading times around 10 times faster.
Available: Directly from Sublime's package control. (release versions only) Or from GitHub: https://github.com/Resike/WoWDevelopment |
I've done all of the steps and I've gotten it working... mostly. However, it seems to scream at every single variable as undefined. "globalfinder: W113 - accessing undefined variable 'table'". Is this expected to happen? The only part of the instructions I was unable to execute was "In Sublime Tools -> SublimeLinter -> Toggle Linter then enable globalfinder and disable any other installed linters.". I'm guessing it's for an older version of Sublime as I'm not finding Sublime Tools. Bringing up the overlay I only have "Toggle highlights" and no "Toggle Linter", nor globalfinder. Any insight?
|
Quote:
Then you can enable/disable linters there and call them with custom parameters: If you would like to customize which warnings/errors you want to show/hide with the linter, then i suggest you to install SublimeLinter-luacheck, and you can enable that linter after you disable the globalfinder one and filter stuff for your needs. You can read more about the command line arg options here: https://luacheck.readthedocs.io/en/s...d-line-options And exclude different warning codes with the `--only [XXX,YYY,ZZZ,...]` argument based on these codes: https://luacheck.readthedocs.io/en/stable/warnings.html You can also create a `.luacheckrc` file that you can put into your project folder, then the linter will always load those settings for that particular project: https://luacheck.readthedocs.io/en/stable/config.html |
All times are GMT -6. The time now is 06:39 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI