hyzwar Posted March 10, 2020 Posted March 10, 2020 Hello and I'm very sorry for my English ;) Is this possible to put MOOSE source code (https://github.com/FlightControl-Master/MOOSE/releases) into Visual Studio Code, with IntelliSense and classes descriptions working, like in Lua Development Tools? Available VSC extensions contains pure LUA, without MOOSE Framework. BR
Pikey Posted March 12, 2020 Posted March 12, 2020 I don't remember anyone having luck with the intellisense part so you are on your own here. If you do have any luck try sharing your findings here and on Moose Discord if possible, I know a great many people would like to move away from LDT. ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
hyzwar Posted March 13, 2020 Author Posted March 13, 2020 1. Install Visual Studio Code. 2. Install "Lua Language Server" extension in VSC (I use that one published by sumneko). 3. Download Moose source code ( https://github.com/FlightControl-Master/MOOSE/releases ). 4. Add that folder (from downloaded source code archive ) to your VSC Workspace: "..\Moose Development\Moose". 5. Create .lua file in that workspace. 6. Enjoy. VSC with Lua Language Server treats all workspace .lua files as dictionaries, that's why I recommend you customize the Moose folder. I use everything myself and work very well. VSC at startup extends the LUA dictionaries with the content of the .lua files used in the workspace, which may take a while. For some reasons, some files are skipped (displayed "green") - just open them for a moment. Pt. 5 is crucial - "Menu:> File> New File" does not work until you save the file. PS: sorry for my google-translate English! :D Thank You, sumneko, for Your great job! https://github.com/sumneko 1
Pikey Posted March 13, 2020 Posted March 13, 2020 1. Install Visual Studio Code. 2. Install "Lua Language Server" extension in VSC (I use that one published by sumneko). 3. Download Moose source code ( https://github.com/FlightControl-Master/MOOSE/releases ). 4. Add that folder (from downloaded source code archive ) to your VSC Workspace: "..\Moose Development\Moose". 5. Create .lua file in that workspace. 6. Enjoy. VSC with Lua Language Server treats all workspace .lua files as dictionaries, that's why I recommend you customize the Moose folder. I use everything myself and work very well. VSC at startup extends the LUA dictionaries with the content of the .lua files used in the workspace, which may take a while. For some reasons, some files are skipped (displayed "green") - just open them for a moment. Pt. 5 is crucial - "Menu:> File> New File" does not work until you save the file. PS: sorry for my google-translate English! :D Thank You, sumneko, for Your great job! https://github.com/sumneko Thank you indeed for feeding back, this is a fairly common question and I will relay to MOOSE discord and sticky this information, several people will be delighted this can be done! Cheers!!!!! ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
hyzwar Posted March 13, 2020 Author Posted March 13, 2020 For several hours I was scratching my head, trying to configure something unnecessarily - it was enough to save the file ... :D But maybe it works so iteratively only for me. code from sumneko does the trick! In the extension settings, you can personalize something to your needs, e.g. the "library" management issue: "Lua.workspace.library": {} https://github.com/sumneko/lua-language-server/blob/master/.vscode/settings.json However, this is not necessary. I'm glad I could help a little bit!
uri_ba Posted May 6, 2020 Posted May 6, 2020 thank you @hyzwar for this tip.. much faster then opening every file in the moose library :) Creator of Hound ELINT script My pit building blog Few DIY projects on Github: DIY Cougar throttle Standalone USB controller | DIY FCC3 Standalone USB Controller
kreisch Posted June 16, 2020 Posted June 16, 2020 I just tried it but it seems there are still a few open points :/ E.g. when a group as a moose object is defined, StudioCode says "undefined Global" and it does not refer to the "GROUP" class available in the framework. A part of IntelliSense is working for me, but mostly for self-written code. It does look completely different if I create a new *.lua file directly within the *\Moose_Development\ folder - creating a file within the root-level of the Repository does not enable the intelli sense correctly. Do you guys have it working really as good as the LUA-Tools? Because I would like getting rid of this IDE, it is very slow compared to Studio Code :( Ugly-Squadron GamestarPinboard
Costas_Ch Posted May 7, 2021 Posted May 7, 2021 I did some tests for working with Visual Studio Code (VSC) from Microsoft and Lua Development Tools (LDT) from Eclipse. In general, VSC is very optimized for this function. The main principle is that the file that will be edited (your_script.lua) needs to be in the same workspace as the moose.lua. I found that VSC can be prepared for the MOOSE framework with the following steps: 1. Install VSC. 2. Install "Lua Language Server" extension in VSC (publisher: sumneko). 3. Download the Moose framework. Only the Moose.lua file is required. Find the current file size in KB. 4. IMPORTANT STEP: Go to "Lua Language Server" extension settings and set the "Preload File Size" at any value greater than the Moose file size as found in step above (step 3). (see photo "Settings"). If the file is grater than the "Preload File Size" then the VSC will ignore the moose.lua file. 5. Create a folder that will be your workspace (is the folder that the your_script.lua files will be worked). Place the file Moose.lua file in the workspace. (a folder that will contain the your_script.lua. (see photo workspace) 6. Open the VCS, go to "File > Open Folder" and select the workspace folder in your system. 7. Create a new your_script.lua file and the IntelliSense is ready as the VSC will "scan" the moose.lua file (and any other file in the active workspace). (see workspace as the IntelliSense works as the LDT. Enjoy. 2
trama1983 Posted November 16, 2021 Posted November 16, 2021 Hi all! I think we have some good news regarding this topic. Yesterday I was able with great help from @Wingthor to configure and document all the process to have VSCode fully integrated with MOOSE and the DCS ME Debugging. In this document you will see how to: 1) Have Intellisense configured VSCode for MOOSE (this is something already explained by @Costas_Ch in previous post). 2) Debugging MOOSE from VSCode 3) Integration between MOOSE Repo and our Missions. Making it possible to "debug individual .lua files of MOOSE", "check out between branches", "fetching changes from new commits in the repo" and all that really fast having the advantage of Dynamic Links Note that this last step is optional, and something not many people will find it useful. Because they will be good just by dropping the big Moose.lua file into the workspace. Either way, for those that want to have a better integration between MOOSE and their workspace, in order to be able to fetch latest changes, navigate between branches, etc. And are willing to contribute to the project in the future. For those... I find this information really interesting (eventhough it's some more advanced stuff). Happy Flying + Coding! VSCode_Howto_MOOSE_Intellisense_and_Debugging.pdf 3
Hellfire Posted October 5, 2022 Posted October 5, 2022 There are dead links in this pdf, can anyone update this or supply the missing files?
Apollonaut Posted January 12, 2023 Posted January 12, 2023 (edited) I am getting the following error when trying to debug according to the guide. Mission script error: [string "G:\DCS World OpenBeta\bin\jsDb_m.lua"]:4599: loop or previous error loading module 'debugger.transport.luasocket' This wasn't happening before November at some point. I followed the guide. Edited jsDBm.lua line 771. All the files are in the correct place. Edited January 12, 2023 by Apollonaut
Zyll Posted November 20, 2023 Posted November 20, 2023 can anyone confirm if they are getting intellisense for the DCS ME objects from dcs.lua? In LDT it worked great, in vscode it doesn't work for me. For example, can you get intellisense for Group, Unit, Coalition, etc? Thanks,
Scifer Posted December 3, 2023 Posted December 3, 2023 On 11/16/2021 at 12:00 PM, trama1983 said: 2) Debugging MOOSE from VSCode @trama1983 Your Google Drive links in that document are all broken. Could you please supply those files otherwise? Thank you so much!
Scifer Posted December 4, 2023 Posted December 4, 2023 18 hours ago, Wingthor said: The section regarding debugging in those documents are now obsolite. After an upgrade from ED that solutions stopped working. We never got it back up. Instead try this i recipe...
Wingthor Posted December 4, 2023 Posted December 4, 2023 On 11/20/2023 at 1:07 AM, Zyll said: can anyone confirm if they are getting intellisense for the DCS ME objects from dcs.lua? In LDT it worked great, in vscode it doesn't work for me. For example, can you get intellisense for Group, Unit, Coalition, etc? Thanks, Sorry for late reply. Intellisence works for Visual Studio Code (VSC). You need to add a LUA extension to the VSC eg. EmmyLua. Then you need to add the scrips folder witin DCS world main folder to your worksspace in VSC (if you want). And/or other DCS lua libs. If you are using Moose, you can add the uncommented version of the Moose.lua to your workspace, then not so many problems will be (falsely) reported, since Moose are using LUA docs for documentation. Moose Include Reposotory, use then uncommented static version of Moose (Moose_lua) 2 Moose framework contributor Moose scripting an DCS mission developer
Zyll Posted December 4, 2023 Posted December 4, 2023 (edited) Thanks @Wingthor for taking the time to respond. I unfortunately am still not quite sure I'm getting it. So I do have intellisense working for Moose, as evidenced (I believe) in the screenshot below: For simplicity sake, I have all my scripts in one folder, including Moose.lua, DCS.lua, mist etc. I assume the fact I'm not using the uncommented version of Moose would not impact the ability to show DCS.lua luadoc. I'm using Sumneko's popular lua-language-server extension, which appears to work with vscode-lua-doc, and also gives credit to EmmyLua in the list of software it uses. Are you saying that EmmyLua includes other functionality that extends Sumneko's language server, and I should be loading both extensions together? When I try to bring up intellisense for a DCS coalition object, this is what I see: The popup functions don't correlate to what actually is applicable to coalition (troops doesn't exist yet it came up in intellisense), and the intellisense doco gives the above error. To me, its like the luadoc in DCS.lua does not follow the same conventions used in Moose.lua, and given that its just a prototype file with no code, DCS.lua is just not working as expected for me. LDT on the other hand worked, it seemed to know how to read the DCS.lua prototype, and I'd be thrilled to be able to make vscode behave similarly. EDIT: > Then you need to add the scrips folder witin DCS world main folder to your worksspace in VSC (if you want). And/or other DCS lua libs. this is something I did not do, let me look into this as well. EDIT2: sadly the inclusion of C:\Program Files\Eagle Dynamics\DCS World OpenBeta\Scripts into the workspace didn't help Edited December 4, 2023 by Zyll
Wingthor Posted December 4, 2023 Posted December 4, 2023 8 minutes ago, Zyll said: Thanks @Wingthor for taking the time to respond. I unfortunately am still not quite sure I'm getting it. So I do have intellisense working for Moose, as evidenced (I believe) in the screenshot below: For simplicity sake, I have all my scripts in one folder, including Moose.lua, DCS.lua, mist etc. I assume the fact I'm not using the uncommented version of Moose would not impact the ability to show DCS.lua luadoc. I'm using Sumneko's popular lua-language-server extension, which appears to work with vscode-lua-doc, and also gives credit to EmmyLua in the list of software it uses. Are you saying that EmmyLua includes other functionality that extends Sumneko's language server, and I should be loading both extensions together? When I try to bring up intellisense for a DCS coalition object, this is what I see: The popup functions don't correlate to what actually is applicable to coalition (troops doesn't exist yet it came up in intellisense), and the intellisense doco gives the above error. To me, its like the luadoc in DCS.lua does not follow the same conventions used in Moose.lua, and given that its just a prototype file with no code, DCS.lua is just not working as expected for me. LDT on the other hand worked, it seemed to know how to read the DCS.lua prototype, and I'd be thrilled to be able to make vscode behave similarly. EDIT: > Then you need to add the scrips folder witin DCS world main folder to your worksspace in VSC (if you want). And/or other DCS lua libs. this is something I did not do, let me look into this as well. This is what I get when typing `coalition`: Here `coaltion`is picked from Moose `coalition`enum. Not sure where your intellisence is picking up the `coalition` keyword? Where you get `coalition.troops` from I don't know. Dont think its Moose database enums? Check if the coalition is defined elsewhere. It might get you in to trouble if you redefine Moose keywords. Moose framework contributor Moose scripting an DCS mission developer
Zyll Posted January 10, 2024 Posted January 10, 2024 Hi @Wingthor maybe coalition is a bad example, because as you pointed out there's an enumeration as part of Moose, but it also exists as an enum in the luadoc of DCS.lua. I figured out where coalition.troops came from, I had to disable the "show words" setting in vscode intellisense which was finding all kinds of strings in my lua and suggesting them. Why that is a thing in vscode is beyond me. So now my vscode is only making suggestions based on actual code in my lua scripts folder, great. If you wouldn't mind, would you show me what your vscode returns for country.id.? My vscode identifies country as a table, based on an empty table called country that it finds in DCS.lua, but it has no country.id because it doesn't seem to be able to parse the luadoc to flesh out the intellisense, so vscode just has this and nothing more: On the other hand, Eclipse with the LDT plugin seems able to parse the luadoc in DCS.lua and not just the actual lines of code, so it's intellisense returns the following: these are the lines from DCS.lua where Eclipse is able to retrieve intellisense, and I'd love to be able to get vscode to do the same, because it really is a much better IDE. To me it feels like the language server support in Eclipse LDT is more robust than the lua language servers available for vscode. do -- country --- [DCS Enum country](https://wiki.hoggitworld.com/view/DCS_enum_country) -- @type country -- @field #country.id id --- [DCS enumerator country](https://wiki.hoggitworld.com/view/DCS_enum_country) -- @type country.id -- @field RUSSIA -- @field UKRAINE -- @field USA -- @field TURKEY -- @field UK -- @field FRANCE -- @field GERMANY -- @field AGGRESSORS -- @field CANADA -- @field SPAIN -- @field THE_NETHERLANDS -- @field BELGIUM -- @field NORWAY -- @field DENMARK -- @field ISRAEL -- @field GEORGIA -- @field INSURGENTS -- @field ABKHAZIA -- @field SOUTH_OSETIA -- @field ITALY -- @field AUSTRALIA -- @field SWITZERLAND -- @field AUSTRIA -- @field BELARUS -- @field BULGARIA -- @field CHEZH_REPUBLIC -- @field CHINA -- @field CROATIA -- @field EGYPT -- @field FINLAND -- @field GREECE -- @field HUNGARY -- @field INDIA -- @field IRAN -- @field IRAQ -- @field JAPAN -- @field KAZAKHSTAN -- @field NORTH_KOREA -- @field PAKISTAN -- @field POLAND -- @field ROMANIA -- @field SAUDI_ARABIA -- @field SERBIA -- @field SLOVAKIA -- @field SOUTH_KOREA -- @field SWEDEN -- @field SYRIA -- @field YEMEN -- @field VIETNAM -- @field VENEZUELA -- @field TUNISIA -- @field THAILAND -- @field SUDAN -- @field PHILIPPINES -- @field MOROCCO -- @field MEXICO -- @field MALAYSIA -- @field LIBYA -- @field JORDAN -- @field INDONESIA -- @field HONDURAS -- @field ETHIOPIA -- @field CHILE -- @field BRAZIL -- @field BAHRAIN -- @field THIRDREICH -- @field YUGOSLAVIA -- @field USSR -- @field ITALIAN_SOCIAL_REPUBLIC -- @field ALGERIA -- @field KUWAIT -- @field QATAR -- @field OMAN -- @field UNITED_ARAB_EMIRATES -- @field SOUTH_AFRICA -- @field CUBA -- @field PORTUGAL -- @field GDR -- @field LEBANON -- @field CJTF_BLUE -- @field CJTF_RED -- @field UN_PEACEKEEPERS -- @field Argentinia -- @field Cyprus -- @field Slovenia -- @field BOLIVIA -- @field GHANA -- @field NIGERIA -- @field PERU -- @field ECUADOR country = {} --#country end -- country
titi69 Posted September 14, 2024 Posted September 14, 2024 (edited) there is another way to get IntelliSense for any script file you open without having to add MOOSE folder for any new worspace created you need to create folder where you want, like : C:\lua-addons copy the moose framework folder inside this new folder (btw it works with MIST or even DCS scripting engine) for DCS scripting thx to omltcat , you can find the libraries here: https://github.com/omltcat/dcs-lua-definitions?tab=readme-ov-file in VScode in your setting, you need to add this folder to third party library for the user (it will be apply for every workspace ) or/and for workspace, by going to preferences, settings, and seach for "library" omltcat made also a great extension for VScode than can send your script to running mission to test any script without having to restart the mission https://github.com/omltcat/dcs-lua-runner Edited September 14, 2024 by titi69
Recommended Posts