There are some screenies in README so you can just take a peek before considering using it.
If you're not familiar with Visual Studio Code, don't mistake it with Visual Studio. These are totally different, despite the name. The former is totally free and pretty lightweight.
The initial setup can be done within minutes, really.
In the past I've attempted to build such extension for Sublime Text. But I failed in developing it further.. it was also awfully slow. The processing backend was written in Python, which isn't known to be fast.. though the slowness was mostly because of design mistakes I made in code parser.
The new backend is written in TypeScript, and is at least x10 faster (I think way more, didn't really measure it). So the feedback is pretty robust - real time code diagnostic messages etc.
I'm quite happy with the overall result. There's a lot that can be added though, and I do plan to work on it.
Backend is LSP compilant, thus it could be ported to other editors with relatively low effort. But I don't plan it myself, as I'm totally settled on VS Code these days. I've been using Sublime and Atom in the past, but in the end I found VS Code to be superior.
As you say in the readme, it do not support typedef, funcref, arrayref, do you still work on it?
I used Galaxy Editor++ before, but it do not support arrayref/structref/funcref, and though I have the source code of GE++, it is hard for me to make a support of it. And I also try to use your subl-sc2-galaxy (and fork your code), but its code linting always do not work, and Sublime is uncomfortable for me. I have a try to make a Galaxy IDE myself, but it still a early version at four years after began.
It looks like that there are so little people use third part tool to write galaxy, or they basically do not use galaxy. But I just write galaxy, do not use the GUI. It is a bad habit from jass, the script of Warcraft III.
Yeah, I'm slowly adding new features. typedef and family will soon be supported. I just focused on other things so far. One of which is proper support of archive dependencies. Currently only content of core.sc2mod was being read, and in order to have other dependencies indexed they had to be added to project workspace. But this is no loger the case, in new version (unreleased yet) dependencies of sc2map/sc2mod are being resolved, and indexed respectively. Although for this to work all revelant archives must be saved as so called sc2component, as there's no support for reading of CASC, nor MPQ. And not sure if there will ever be - I don't think it's really needed. Especially as default SC2 mods are included within the extension. For custom mods you just have to provide additional sources directory in the configuration - that should point to SC2 installation directory.
Having access to complete dependency tree allows it to index all of the existing *Trigger* elements, and their metadata. So now when you hover over your custom functions, extension can display its name and description.
In above example, function was delcared within the script aswell. In *Triggers* there's just a stub element created for it (with Native flag set). This makes it possible to document your codebase. And also bind generic parameters such as *int* to their actual preset constant variables, so it could provide more accurate auto-completins in context of that parameter. Also, I plan do add feature for indexing entries from *Data XML*. In order to be able to provide autocomplete list for these virtual *gamelink* parameters, which are mapped as string. To give an example, when you'd request code completions list for *unittype* parameter of UnitCreate then all possible names would be provided, along with their localized name in the tooltip.
There's not much interest in these kind of tools among the community as you've pointed. But this doesn't stop me from working on it further. In fact it is quite fun to do so, and I've learned a lot in the process.
I didn't had occasion to try Galaxy++ nor Andromeda. I did like the idea itself though. But I think they wanted to accomplish too much too early - get too many features at once.. And that makes it really hard to develop further while maintaining the stability. Also full blown language extension alone won't really be convenient to work with, if there's no tooling around it - dedicated IDEs or support within 3rd party extension for text editors (as this one). I'm not a fan of dedicated IDEs these days though. Their customization capability is often times highly limited. I like to play with many programmiang languages, thus having them all support from single editor is very convenient.
Plugin for Sublime Text was indeed quite poor. But it's the past now! Do you find Visual Studio Code comfortable? It is quite customizable too - I didn't like it's default setup, but you can alter most of it in the settings or via extensions.
If you happen to use it, feel free to report any issues and suggestions.
I have a try of Visual Studio Code, as I always use Notepad++ for text file.
Visual Studio Code looks like more comfortable than Sublime Text, if your extension is finish I will use it as a alternative of Galaxy Editor++. And now, the extension generate many errors in output panel, such as:
Message: Request textDocument/hover failed with message: how did we get here?
Code: -32603
And there is another suggestion, could you take a feature to checking Unicode character in the script, special for the Comments, as we know custom script in SE do not accept non-ASCII characters, and if I use Chinese character "," instead of English character "," I can not copy script text to the SE window. and it is hard for me to find it with eyes.
I think read files from CASC, or MPQ is a wrong way too, it will lock the file so SE can not run or can not load Mod/Map. After SBeier gave up GE++, another people modify GE++ to support newest native.galaxy by this way. And it cause issues like what I say. So I have two SC2 clients at that time, one is CN, the other is EU/KR/US...
Another way to support script/Data form official mod is extract all files (without asserts file). and it is hard to follow the newest version of SC2.
For me, I write galaxy as a Lib, and put them in SE as a Custom script, then encapsulate it to trigger function or trigger action. The Lib is isolated, so I do not need check dependencies except native.galaxy.
If you have finish the work about typedef and family, please release a new version. I write a new mod of terrain editor (rewrite the terrain mod of BLZ Enforcement). And I need these features.
Message: Request textDocument/hover failed with message: how did we get here?
Code: -32603
Haha, yeah.. these messages are not very insigtful.
In new version it will print stack trace, so it will be easier for me address such issues.
This error in particular will be fixed in upcoming version. It occured when hovering over comments/whitespaces at the end of file or within include statements.
If you have finish the work about typedef and family, please release a new version
Sure. Already started work on this, hoping to have it done by the end of the week.
And there is another suggestion, could you take a feature to checking Unicode character in the script, special for the Comments, as we know custom script in SE do not accept non-ASCII characters, and if I use Chinese character "," instead of English character "," I can not copy script text to the SE window. and it is hard for me to find it with eyes.
Not exactly sure what you're requesting there.
I know about the problem related to handling of multibyte characters in Galaxy lexer within SC2, but what you suggest as a solution for this?
Add option to transpile the script and escape these characters using '\x' notation?
But since I'm not making a language extension like `Galaxy++` (at least not yet), not sure how should this be handled at the current moment..
For me, I write galaxy as a Lib, and put them in SE as a Custom script, then encapsulate it to trigger function or trigger action. The Lib is isolated, so I do not need check dependencies except native.galaxy.
Hmm.. so you're not saving galaxy files within map/mod directory? Just copy pasting parts of code one by one to GUI `script code` section seems rather uncomfortable to work with. Especially when you need to go back and update something.
Is there a particular reason you do it this way?
Why not just make one `custom script` element, that would have `include` statement to import your external scripts saved within the mod/map?
I suppose you want to have actual GUI elements for actions/functions, but there's a way to declare dummy element using `Native` flag, so SC2Editor will be able to reference the element while auto-generating script, but it won't generate actual body of a function in its script.
That's what I've been doing, and I don't see any cons of this method.
I can obviously support editing galaxy files without having mod/map in the workspace, in such case however only one dependency is being indexed - `core.sc2mod` and its libraries.
If your code will try to reference some stuff that sits in external library, then it would complain about undeclared symbols.. (since they won't be indexed).
Ideally I was going to implement complete analysis of the script, including typechecking (i.e. when trying to assign `"foo"` to int variable it will highlight it as error). In order to do that all relevant galaxy files must be indexed.
I write a new mod of terrain editor (rewrite the terrain mod of BLZ Enforcement). And I need these features.
I've seen it in Delphinium videos. Cool stuff. Not sure if you guys are still planning to release it publicly, but if so I will certainly check it out.
I was mostly interested about a way to alter terrain textures. But not just swap large part of texture surface using one of prepared presets (which is what you seem to be doing?).
I was hoping for possibility to actually paint.. or rather have handful different shapes of splat models, so that terrain could be customized in detailed way.
I can imagine FPS droping heavly once there's too many splats though...
This error in particular will be fixed in upcoming version. It occured when hovering over comments/whitespaces at the end of file or within include statements.
.....
Sure. Already started work on this, hoping to have it done by the end of the week.
Good job!
I know about the problem related to handling of multibyte characters in Galaxy lexer within SC2, but what you suggest as a solution for this?
Add option to transpile the script and escape these characters using '\x' notation?
But since I'm not making a language extension like `Galaxy++` (at least not yet), not sure how should this be handled at the current moment..
No, just show the multibyte character as a warning or error. This issue always happen in the comment, so your parser can not find it, if the user want to use multibyte character, he can translate it as unicode type ('\x') himself. I have write a tool to do that.......
Hmm.. so you're not saving galaxy files within map/mod directory? Just copy pasting parts of code one by one to GUI `script code` section seems rather uncomfortable to work with. Especially when you need to go back and update something.
Is there a particular reason you do it this way?
My work in Forggy & Catty is write base system in galaxy, and another partner works for game with GUI (Delphinium works for art). I need encapsulate galaxy function to GUI function for him.
I've seen it in Delphinium videos. Cool stuff. Not sure if you guys are still planning to release it publicly, but if so I will certainly check it out.
Thanks, we want to release it, but it have more relations with the underlying systems of BLZ Enforcement. So it need much work, while we do not have enough time to do. We have our formal job in 8 hours.
I was mostly interested about a way to alter terrain textures. But not just swap large part of texture surface using one of prepared presets (which is what you seem to be doing?).
I was hoping for possibility to actually paint.. or rather have handful different shapes of splat models, so that terrain could be customized in detailed way.
Delphinium find a way to make a splat models can use a special terrain texture as its materials. It will use another channel of splat (as Delphinium say there are 16 channels, and the terrain use 8, others are use for splat). Now there are also some issues about splat (relate with generated order of splats).
No, just show the multibyte character as a warning or error. This issue always happen in the comment, so your parser can not find it, if the user want to use multibyte character, he can translate it as unicode type ('\x') himself. I have write a tool to do that.......
Ahh, okay. Indeed my parser allows a lot of things that normally result in error when parsed by SC2. But I of course want it to be on pair, even if I'll have to explictly hardcode rules like 4096 characters single line limit..
(as for the comments - it doesn't validate it yet, as I was sure SC2 could handle it there, but apparently not... will make it to next version.)
My work in Forggy & Catty is write base system in galaxy, and another partner works for game with GUI (Delphinium works for art). I need encapsulate galaxy function to GUI function for him.
Well, I'm not convinced to your workflow, but I'm sure you know what you're doing.
Anyway, new version released. - When .sc2map or .sc2mod is present within the workspace, indexer will attempt to visit every dependency listed. If it fails to load at least one, it will revert to indexing only `core.sc2mod` and its native lib. - Typedef, funcref, arrayref are now entirely supported - Other minor improvements
Feel free to report any issues you encounter, as well as feature requests if you've any.
Code completions prioritize preset constants when valid (function must declare preset type within Triggers metadata).
Gamelinks suggestions (units, effects etc.)
Improved formating of function signature. It now also includes grammar text entry.
Also, I have just realized I didin't package default SC2 archives other than core.sc2mod in last release... it is now fixed. Package size went up ~20MB.
I copy the integer value from Calculator , and paste to the vscode.
It is show me as a error.
This may be a bug of vscode, I install the newest one
in ASCII encode, the copied integer value with two chars (0x3f) as a prefix and suffix.
Encountered invalid character There must be some invalid ASCII character (apparently invisible) pasted in. No idea why would calculator put something like that into clipboard .. 0x3f should be "?" (question mark sign), right? If so, I don't think this is it - otherwise VSCode should render it. It must have been something else (you can check with hex editor). In next version error message will also include character codes.
PS: If you want to add other feature, support the Macro syntax of Trigger Function may a good one.
For triggers there's tgs and tgc. But I'll have to change them, as its current template doesn't follow usual code style convetions of Galaxy, but rather my personal preference: snake_case instead of camelCase, and "{" on new line.
As for the other 2 reports - it's done. But not released yet. Will make one later this week.
And you may not add the new function of 4.0, such as BankBackup, this function is not in natives.galaxy and NativeLib.galaxy, but it is list in the Trigger Library.
Another is could you add the keywords into the Code completions? When I input else it always change to
AIEvalSetCustomIndex. Because after input else, i need input Enter to start a new line.
Macro is a special galaxy syntax for galaxy which only use at custom script in function/action definition.
Ahh, preprocessing macros.. I did know there's such thing, just forgot about it. Mostly because of the reason you mention, these are not actual Galaxy languages macros. This feature is exlusive to Trigger editor, thus I don't think it would be right to treat it as part of Galaxy language.. maybe it could be allowed as opt-in in configuration. I'll think about it - whether it is benefical to have this implemented and how much hassle would it require.
And you may not add the new function of 4.0, such as BankBackup, this function is not in natives.galaxy and NativeLib.galaxy, but it is list in the Trigger Library.
Yeah, I blame Blizzard for that :P They should include new natives into natives.galaxy instead of inserting them exlusively to TriggerLib :/ Some old ones like PlayerOptionOverride are not there aswell.. I'll solve it in next version.
Another is could you add the keywords into the Code completions? When I input else it always change to AIEvalSetCustomIndex. Because after input else, i need input Enter to start a new line.
You can always cancel suggestion list (esc), and then hit enter :P (or force it with ctrl-enter.)
But yes - of course it's valid suggestion. I'll add keywords.
I'll likely release new version later today or tomorrow. It will also include some fancy new features (find all references function and global symbol rename).
Extension for Visual Studio Code, it attempts to provide IDE-like capabilities for Galaxy Script.
More about it: https://github.com/Talv/vscode-sc2-galaxy
There are some screenies in README so you can just take a peek before considering using it.
If you're not familiar with Visual Studio Code, don't mistake it with Visual Studio. These are totally different, despite the name. The former is totally free and pretty lightweight.
Can be downloaded here:
https://code.visualstudio.com/Download
The extension itself is also published on marketplace, thus can be easly installed:
https://marketplace.visualstudio.com/items?itemName=talv.sc2galaxy
The initial setup can be done within minutes, really.
In the past I've attempted to build such extension for Sublime Text. But I failed in developing it further.. it was also awfully slow. The processing backend was written in Python, which isn't known to be fast.. though the slowness was mostly because of design mistakes I made in code parser.
The new backend is written in TypeScript, and is at least x10 faster (I think way more, didn't really measure it). So the feedback is pretty robust - real time code diagnostic messages etc.
I'm quite happy with the overall result. There's a lot that can be added though, and I do plan to work on it.
Backend is LSP compilant, thus it could be ported to other editors with relatively low effort. But I don't plan it myself, as I'm totally settled on VS Code these days. I've been using Sublime and Atom in the past, but in the end I found VS Code to be superior.
Previously known as: SomeoneTookMyNameTT
Great Job!
As you say in the readme, it do not support typedef, funcref, arrayref, do you still work on it?
I used Galaxy Editor++ before, but it do not support arrayref/structref/funcref, and though I have the source code of GE++, it is hard for me to make a support of it. And I also try to use your subl-sc2-galaxy (and fork your code), but its code linting always do not work, and Sublime is uncomfortable for me. I have a try to make a Galaxy IDE myself, but it still a early version at four years after began.
It looks like that there are so little people use third part tool to write galaxy, or they basically do not use galaxy. But I just write galaxy, do not use the GUI. It is a bad habit from jass, the script of Warcraft III.
Thanks for your job!
Thanks for the feedback!
Yeah, I'm slowly adding new features. typedef and family will soon be supported. I just focused on other things so far. One of which is proper support of archive dependencies. Currently only content of core.sc2mod was being read, and in order to have other dependencies indexed they had to be added to project workspace.
But this is no loger the case, in new version (unreleased yet) dependencies of sc2map/sc2mod are being resolved, and indexed respectively. Although for this to work all revelant archives must be saved as so called sc2component, as there's no support for reading of CASC, nor MPQ. And not sure if there will ever be - I don't think it's really needed. Especially as default SC2 mods are included within the extension. For custom mods you just have to provide additional sources directory in the configuration - that should point to SC2 installation directory.
Having access to complete dependency tree allows it to index all of the existing *Trigger* elements, and their metadata. So now when you hover over your custom functions, extension can display its name and description.
In above example, function was delcared within the script aswell. In *Triggers* there's just a stub element created for it (with Native flag set).
This makes it possible to document your codebase. And also bind generic parameters such as *int* to their actual preset constant variables, so it could provide more accurate auto-completins in context of that parameter.
Also, I plan do add feature for indexing entries from *Data XML*. In order to be able to provide autocomplete list for these virtual *gamelink* parameters, which are mapped as string. To give an example, when you'd request code completions list for *unittype* parameter of UnitCreate then all possible names would be provided, along with their localized name in the tooltip.
There's not much interest in these kind of tools among the community as you've pointed. But this doesn't stop me from working on it further. In fact it is quite fun to do so, and I've learned a lot in the process.
I didn't had occasion to try Galaxy++ nor Andromeda. I did like the idea itself though. But I think they wanted to accomplish too much too early - get too many features at once.. And that makes it really hard to develop further while maintaining the stability.
Also full blown language extension alone won't really be convenient to work with, if there's no tooling around it - dedicated IDEs or support within 3rd party extension for text editors (as this one).
I'm not a fan of dedicated IDEs these days though. Their customization capability is often times highly limited.
I like to play with many programmiang languages, thus having them all support from single editor is very convenient.
Plugin for Sublime Text was indeed quite poor. But it's the past now!
Do you find Visual Studio Code comfortable? It is quite customizable too - I didn't like it's default setup, but you can alter most of it in the settings or via extensions.
If you happen to use it, feel free to report any issues and suggestions.
Previously known as: SomeoneTookMyNameTT
I have a try of Visual Studio Code, as I always use Notepad++ for text file.
Visual Studio Code looks like more comfortable than Sublime Text, if your extension is finish I will use it as a alternative of Galaxy Editor++. And now, the extension generate many errors in output panel, such as:
If you have finish the work about typedef and family, please release a new version. I write a new mod of terrain editor (rewrite the terrain mod of BLZ Enforcement). And I need these features.
Thanks a lot.
Previously known as: SomeoneTookMyNameTT
Good job!
Ahh, okay. Indeed my parser allows a lot of things that normally result in error when parsed by SC2.
But I of course want it to be on pair, even if I'll have to explictly hardcode rules like 4096 characters single line limit..
(as for the comments - it doesn't validate it yet, as I was sure SC2 could handle it there, but apparently not... will make it to next version.)
Well, I'm not convinced to your workflow, but I'm sure you know what you're doing.
Anyway, new version released.
- When .sc2map or .sc2mod is present within the workspace, indexer will attempt to visit every dependency listed. If it fails to load at least one, it will revert to indexing only `core.sc2mod` and its native lib.
- Typedef, funcref, arrayref are now entirely supported
- Other minor improvements
Feel free to report any issues you encounter, as well as feature requests if you've any.
Previously known as: SomeoneTookMyNameTT
Thanks for your work.
I am touring in Bali with my company, bu maybe I can not enjoy my travel. because we get some information about the bug of BLZ Enforecement.
The bug is from SC2 4.0, error is function too long, the script of the mod is 120,000+ lines. So it is a hard work and I need spend times on it.
Released v1.5.0 - https://github.com/Talv/plaxtony/releases/tag/v1.5.0
Quick highlight of new features:
Code completions prioritize preset constants when valid (function must declare preset type within Triggers metadata).
Gamelinks suggestions (units, effects etc.)
Improved formating of function signature. It now also includes grammar text entry.
Also, I have just realized I didin't package default SC2 archives other than core.sc2mod in last release... it is now fixed. Package size went up ~20MB.
Configuration settings are described in docs CONFIGURATION.md
I consider this release to be very stable.
I'm gonna try to finalize typechecking for next release.
Previously known as: SomeoneTookMyNameTT
Released 1.6.0 with finalized typechecker!
Previously known as: SomeoneTookMyNameTT
It do not support the funcref array? like the code before.
Ops, minor bug, but none of my test cases covered it. Fixed.
Previously known as: SomeoneTookMyNameTT
Another bug about copy integer from Calculator.
Calculator version is 10.1712.3351.0, in windows 10 1709 with the newest update.
I copy the integer value from Calculator , and paste to the vscode.
It is show me as a error.
This may be a bug of vscode, I install the newest one
in ASCII encode, the copied integer value with two chars (0x3f) as a prefix and suffix.
PS: If you want to add other feature, support the Macro syntax of Trigger Function may a good one.
Another bug is if i declare variables with the same variable name twice, such as
Another bug:
Do not check local variable declare location. Not show as a error when a local variable declare after other codes.
Encountered invalid character
There must be some invalid ASCII character (apparently invisible) pasted in. No idea why would calculator put something like that into clipboard .. 0x3f should be "?" (question mark sign), right? If so, I don't think this is it - otherwise VSCode should render it. It must have been something else (you can check with hex editor).
In next version error message will also include character codes.
Hmm, what you mean by "macro"?
Perhaps snippets is what you refer to? https://code.visualstudio.com/docs/editor/userdefinedsnippets
If so, there are some snippets included with extension: https://github.com/Talv/vscode-sc2-galaxy/blob/master/snippets/general.json
For triggers there's tgs and tgc. But I'll have to change them, as its current template doesn't follow usual code style convetions of Galaxy, but rather my personal preference: snake_case instead of camelCase, and "{" on new line.
As for the other 2 reports - it's done. But not released yet. Will make one later this week.
Previously known as: SomeoneTookMyNameTT
Macro is a special galaxy syntax for galaxy which only use at custom script in function/action definition.
Such as CombineStrings. Its code like this
(#PARAM(str1) + #PARAM(str2))
For "for" in GUI Action is
#INITAUTOVAR(ae,e)
#INITAUTOVAR(ai,increment)
#PARAM(var) = #PARAM(s);
for ( ; ( (#AUTOVAR(ai) >= 0 && #PARAM(var) <= #AUTOVAR(ae)) || (#AUTOVAR(ai) < 0 && #PARAM(var) >= #AUTOVAR(ae)) ) ; #PARAM(var) += #AUTOVAR(ai) ) {
#SUBFUNCS(actions)
}
It is can not use in Galaxy file, it only use in definition.
They are like a macro and when SE generation galaxy file, they will be replaced with generated galaxy code.
I have find the invalid character is not a bug of yours. Maybe it is a bug of calculator itself.
And you may not add the new function of 4.0, such as BankBackup, this function is not in natives.galaxy and NativeLib.galaxy, but it is list in the Trigger Library.
Another is could you add the keywords into the Code completions? When I input else it always change to
Ahh, preprocessing macros.. I did know there's such thing, just forgot about it. Mostly because of the reason you mention, these are not actual Galaxy languages macros. This feature is exlusive to Trigger editor, thus I don't think it would be right to treat it as part of Galaxy language.. maybe it could be allowed as opt-in in configuration.
I'll think about it - whether it is benefical to have this implemented and how much hassle would it require.
Yeah, I blame Blizzard for that :P They should include new natives into natives.galaxy instead of inserting them exlusively to TriggerLib :/
Some old ones like PlayerOptionOverride are not there aswell.. I'll solve it in next version.
You can always cancel suggestion list (esc), and then hit enter :P (or force it with ctrl-enter.)
But yes - of course it's valid suggestion. I'll add keywords.
I'll likely release new version later today or tomorrow. It will also include some fancy new features (find all references function and global symbol rename).
Previously known as: SomeoneTookMyNameTT