IntelliSense for CMO via VSCode Sumneko and Emmy

All discussions & material related to Command's Lua interface

Moderators: michaelm75au, angster, RoryAndersonCDT, MOD_Command

Post Reply
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

IntelliSense for CMO via VSCode Sumneko and Emmy

Post by KnightHawk75 »

So I've been working on this for myself but but figured I'd share it since it's in a ~usable state, for myself anyway.

I've implemented nearly the entire CMO Lua documentation in a EmmyLua/sumneko workspace library that can be used with VSCode if you have sumneko's Lua language extension installed (a few easy clicks and a restart of VSCode).

VSCode: https://code.visualstudio.com/Download (free)
Finding sumneko's plugin for install and configuration after install and restarting VSCode (free)
Image
Configuring your workspace to use the CMO_1147 workspace library files.
Image

Example of what this buys you with a little usage of Emmy Lua comment 'type' tagging. If nothing else it's been handy as hell to not have to leave VSCode to look something up. The CMO__Constants are really just for hints and quick lookup reminders (though there is nothing preventing you from actually using them and loading them into a scene if you wanted too, though I may rework some of them. Also saves one from having to exclude all the built-in CMO functions to be ignored by the undefined-globa-diagnostics.

All functions are in there (unless I forgot one due to eyes glazing over) including some deprecated ones so that it could still be used for CMANO maybe too I think, though flagged a bunch depreciated. Additionally some less than documented ones are in there, along with fields here and there that have never made it into the docs. That said more or less it's the same as the website, with some corrections, and probably now a few of my own goofs.

Now onto the pics to give you idea of how it looks when in use. [click thumbnails for full image (and maybe a second time if better res is needed)]
ImageImageImageImageImage
ImageImageImageImageImage
ImageImageImageImageImage
ImageImageImageImage

Now I don't really use it the way it's demo'd there (I use it more for hints to jog memory), nor is any of that code remotely logical I was just typing random stuff to provoke the IntelliSense. I still have more to do over time, such as circle back to dbquery, implement each specific event trigger and action type separately for more convenience, not to mention lord knows how many spelling mistaking and display formatting that needs more tweaking. But don't expect too much more or things to work like other languages might I'm surprised I got working decently at all tbh give limitations of emmy and lua types in general.


In the attached zip there are two folders:
\CMO_1147 - The content in here represents the emmy-sumneko library.
\CMO_TestWorkspace - A sample VSCode workspace that you should just be able to open and then re-configure the Lua workspace user library setting to point to the path where ever you unzipped \CMO_1147 too.

If any of you actually try it out and have questions or actually find it useful let me know.

Attachments
CMO_1147posted830.zip
(60.04 KiB) Downloaded 149 times
BDukes
Posts: 2623
Joined: Wed Dec 27, 2017 12:59 pm

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by BDukes »

Well done. Will check it out[:)]

Mike
Don't call it a comeback...
BDukes
Posts: 2623
Joined: Wed Dec 27, 2017 12:59 pm

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by BDukes »

Installed tonight.

Very helpful. I've scratched the surface but it's already saved me a buttload of time not having to look something up.. Enjoy Sainthood!

Mike
Don't call it a comeback...
Kushan04
Posts: 1088
Joined: Tue Jun 28, 2005 9:27 pm
Location: USA
Contact:

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by Kushan04 »

Got it setup tonight as well and merged my existing lua workspaces into it.

Thank you for this. Only scratched the surface as well but I can already tell this is going to save me a lot of time.
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by KnightHawk75 »

ORIGINAL: Kushan04

Got it setup tonight as well and merged my existing lua workspaces into it.

Thank you for this. Only scratched the surface as well but I can already tell this is going to save me a lot of time.

Glad to hear it.
Dimitris
Posts: 15197
Joined: Sun Jul 31, 2005 10:29 am
Contact:

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by Dimitris »

This is SUPER helpful, thanks a lot!
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by KnightHawk75 »

ORIGINAL: Dimitris

This is SUPER helpful, thanks a lot!
You're welcome. Thanks for the feedback.
I'll try and keep it up to date and improve it over time (where possible).

User avatar
Struan76
Posts: 38
Joined: Tue Sep 03, 2019 7:38 am

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by Struan76 »

This is really nice, I just got around to setting it up today. Thanks for being so generous in sharing your code and your time.
Parel803
Posts: 932
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by Parel803 »

KnightHawk, thank you, looks great. No doubt I'll gonna have quetions later on :-)
For now it looks for me to be used as reference.
best regards Gert-Jan
jkgarner
Posts: 175
Joined: Thu Apr 30, 2020 12:42 pm

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by jkgarner »

Most excellent!
Thank you Knight Hawkings!
[&o][&o][&o][&o][&o][&o]
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by KnightHawk75 »

Sumneko CMO Library Updated for CMO 1.04 - build 1147.35

I have tested this with Sumneko 2.4.0 and vscode 1.59.1, 2.4.7 I think is current sumneko extention build and it should work fine, but I wanted to bang out this update first before touching\updating my vscode and extentions environment to the latest.

Attachment: CMO_1147_35-posted_11-13-2021.zip (~63k) - distribution includes latest and basically same sample workspace as original.

To update one only needs copy the contents of CMO_1147 over the existing old files, actually really only need copy CMO_1147\library\CMO_FuncsAndClasses.lua over where ever you put your install as it's all that's really changed.

Idk if there is an equivalent recent pro release that these updates apply to as well but I'm assuming most of these are either there already or will be very shortly, but here is the changelog(also included in the zip):

11-13-2021 (change in CMO Builds 1147.31 through 1147.35)
----
Unit Wrapper/Object:
+airbornetime_v property (thank you thank you thank you!)
~airbornetime property tweaked comment. (removed notice about lack of _v version)
+readytime_v property (thank you thank you thank you!)
~readytime property tweaked comment. (removed notice about lack of _v version)
+crew property
+jammed property (This is gonna be sooo useful!)
+jammer property (This also makes life sooo much easier for certain things)
+groundspeed property
+pitch property
~filterOnComponent() method - updated for optional dbid second param. (handy)
+angleOnBowToUnit() method
+getUnitMagazine() method (handy)
  ^ Added related CMO__DeviceMagazine class and properties.
  Added setExactWeaponQuantity() method to CMO__DeviceMagazine class.
  Added related CMO__TableOfDeviceWeaponLoads alias for table of <number,DeviceWeaponLoaded>
  Added related CMO__DeviceWeaponLoaded class and properties (for .weapons table entries as it's different from regular CMO__WeaponLoaded table as it's missing wpn_type).
+getUnitMountMagazine() method (handy)

CMO__Loadout Wrapper/Object:
+setExactWeaponQuantity() method (boy will these make life easier)

Scenario Wrapper/Object:
+fields property
+ContentTag property (included but I purposely didn't go into detail)
+GameMode property byte (don't know what values represent yet have to playtest)
+GameStatus property byte (don't know what values represent yet have to playtest)
+ResetLossExp() method
+ResetScore() method

Contact Wrapper/Object:
+ lastDetections property table (so stoked this exists now!!!!!)
+ CMO__ContactDetection class containing properties for each lastDetection table entry (though little unclear what the values for special_mode are just yet as haven't had chance to play around much yet).
+ CMO__TableOfContactDetections alias representing table of <number,CMO__ContactDetection>

Other:
+Added CMO__DeviceMount definition (wasn't really necessary atm but maybe in future)
~tweaked a few field types for CMO__WeaponLoaded (couple of things were marked as strings when they were ints/numbers)
~minor text\descriptions tweaked in a few other places.
~updated build numbers and release info in the header of CMO_FuncAndClasses.lua
~changelog added to distribution.
----


If at least one of you could update and verify that thing seems to be working with this release and just post that when you have time, that would be helpful. Then I'll update the top post with the attachment from this post so there aren't too many different versions floating around over time (then again maybe it's useful having at least the last 2 around? [&:]). Much thanks to the dev team for all the recent additions, most of them I know were fulfilling specific user requests.
Attachments
CMO_1147_3..132021.zip
(62.82 KiB) Downloaded 94 times
BDukes
Posts: 2623
Joined: Wed Dec 27, 2017 12:59 pm

RE: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by BDukes »

Can somebody pin this post to the top? Nice tool[:)]
Don't call it a comeback...
hanzawa1991
Posts: 71
Joined: Tue Apr 05, 2022 9:05 am

Re: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by hanzawa1991 »

Great. It would be better if there were a video tutorial on how to use it :ugeek:
Karejar
Posts: 20
Joined: Mon Aug 19, 2019 4:45 pm

Re: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by Karejar »

Fantastic job and very helpful. Thank you very much.

Alfonso.
User avatar
blu3s
Posts: 962
Joined: Fri Jul 08, 2022 9:45 am

Re: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by blu3s »

Continuing the great work of KH, I share with you my own github repository to which I have been adding the latest functions/data, fixing some things etc, to keep it updated to version 1328.9.

Any comment or suggestion will be welcome

https://github.com/blu3ser/CMO_Intellisense
Parel803
Posts: 932
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

Re: IntelliSense for CMO via VSCode Sumneko and Emmy

Post by Parel803 »

Good morning,
Thank you for the work and the sharing.
and ofcourse thanks to KH.
best regards GJ
Post Reply

Return to “Lua Legion”