Defold Editor should drop the code editor

I am a VSCode user, and the above is as of now the main blocker for me returning to the Defold code editor. There may be more features I’m missing, but because I can’t move it to a separate window I haven’t used the Defold code editor since 2018 :sweat_smile:

I have previously felt along the same lines as OP, however I do find the arguments stating that Defold should contain everything needed to get started quite convincing. One of the strengths of Defold is how easy it is to install. As a relatively experienced Defold user it’s not relevant to me anymore, but I shouldn’t forget that this was actually one of the reasons I picked Defold in the first place.

7 Likes

Related feature request: https://github.com/defold/defold/issues/6604

4 Likes

It’s worth noting that the latest sumneko-lua extension for vscode supports defold-api out of the box,. I’m not sure how updated it is or the frequency of the updates. That is the api folder that it was mentioned in previous posts. It’s not as comprehensive as the template from @astrochili though.

I started using vscode recently, but only as a code editor on a project that is mostly code (script) based. When doing visual layout the editor is my go to place. Switching app adds too much friction for my taste.
I still do all my build and debug from the defold editor itself .

2 Likes

Just put this on your settings.json file, then you will not need to add Defold api folder.:

 "Lua.workspace.library": [
        "${3rd}/Defold/library"
    ]

Perhaps this should be added to readme.

7 Likes

I tried Luanalysis (only available in IntelliJ IDEA), compared it with VS Code and so far Luanalysis beats EmmyLua for me. It does a great job at type checking. Exactly what I was looking for! I haven’t tried it in a real project though. With additional annotations you can have type safety even for messages. Yaay! :smiley:

1 Like

The Github feature request mentions the “editor’s web server”. Is it already exists or will it be a new thing? It sounds like something that opens a lot of possibilities. Anyway… for starters, run a project from within an editor would be great!

1 Like

We had a meeting about this topic yesterday. Some takeaways from the meeting:

  • Our current position is that we will not officially maintain any external code editor integrations. Why? As mentioned before there are many different external code editors, and we do not want to pick a single one. And there are already several community created editor integrations, with the VSCode one by @astrochili being one of the more popular.
  • We will document the ports and protocols of the engine to help with external editor integrations. #7273
  • We will create a way for external editors and other tools to interact with the editor to for instance build the open project #6604

Regarding missing features in the built-in code editor:

  • Autocomplete and API discovery
    • We are adding LSP support to the editor. First release soon.
  • Project wide code navigation
    • This can be supported by LSP in the future
  • Conditional breakpoints
    • We can possibly add this in our fork of mobdebug #7274
  • Better debug value inspection
    • @ekt what are you currently missing?
  • Better Git integration #7275
  • Ability to customise keyboard shortcuts and color scheme
    • Possible currently but hard. We need to find ways to simplify this.
18 Likes

Great!

2 Likes

Few points about the existing solution. It works, but I agree that It’s hackish and not user-friendly to setup.

Extension

This is not a VSCode extension, but it would be better if it was. The problem is that I have no experience of integrating with the VSCode API and no desire to go deep into these js/web technologies at the moment. @thejustinwalsh, author of ts-defold, created an issue ‘Join Forces?’ where we exchanged some views on how this could be.

A real VSCode extension would make it easy to install in one click and get the settings integrated into VSCode, which is much more desirable than editing the sh-file top variables.

Running

Right now this is only possible with bob because of known limitations. But after implementing some of the features mentioned above, it will be possible to run an editor build from VSCode.

Debugging

The current proposal is to use local lua debugger, which works perfectly and is very functional thanks to the full integration into the VScode debugging environment (more functional than the built-in debugger in Defold Editor).

If we want to run the game from Defold Editor and continue debugging it in VSCode, we need to connect to mobdebug. But at the moment there is no great working integration mobdebug in VSCode as I know.

Defold API

It’s true, I just copy the lua headers from defold-api-emmylua by @d954mas, thanks to him. Since I haven’t figured out how to run this thing without installing IDEA to generate headers from the public docs (but I didn’t try very hard), the template project has the same API version as the original repository - 1.3.3 at the moment. It’s defenitely a point which can be improved and automated.

Libraries

Defold has more comfortable way to interact with libraries and built-ins files, wich are not available in VSCode. There is a hack way to get library headers in VSCode, but, again, it is done manually.

Built-ins

Right now there is no way to view or copy the built-in files outside of the editor. Only if attach all these files to the template, it’s possible I think, but will require more manual work to update the extension for each engine update.

Help

I’ll be happy for any help, even if someone takes and rewrite everything, as long as the current working functionality is preserved. I mean, I don’t think it makes sense to create another extension with only one specific running function or only lua headers, otherwise those who need to debug with breakpoints or bundle and deploy a game on devices won’t be able to combine it all into one system.

7 Likes

Excellent write-up @astrochili ! Do you have these issues/feature requests collected on GitHub?

I really encourage others in the community to get involved in this project. We will do our part and open up the editor for integration in external tools. And perhaps we can also assist with some other things, such as API header generation in a format which VSCode can use.

8 Likes

Yes, now there are! :slight_smile:

6 Likes

Me neither))) I had IntelliJ installed but I couldn’t run the defold-api-emmylua, so I reinvented the wheel. You can grab annotations for v1.4.1 here. They might not work 100% in VS Code. For me Luanalysis is sooo much better than extensions in VS Code for Lua. Some things there are different than in EmmyLua though. Feel free to create an issue if something is not right. I can help with generating more stuff like that if anyone needs.

Defold API Docs

Thank you for it! :slight_smile: It is detailed and good to work with!

Only a few minor issues that required custom code and custom types to be used for certain functions and messages. Not a big deal.
For annotations 3 msg.post functions with different parameters have to be “merged” into one element with different overloads, and “table” types are not intellisense friendly (i.e. [play_properties]).

Debugging

As of now I have no idea if it’s possible to debug Lua with mobdebug in IntelliJ. I’m ok with debugging inside Defold editor.

My personal top request for debugging is not related to a code editor at all. An ability to see all instances at runtime and their go.properties while the game is running. :slight_smile: It’s a HUGE asking, and not like I’m making any games anyway :smiley:

Something more pragmatic would be to add custom expressions/variables and “Watch” them in a window, rather than typing every time. That’s only because I can’t or don’t know how to debug in IntelliJ.

IDEA + Luanalysis + Annotations = :heart:

My dream setup so far. + 2 helper modules generated from the API docs.

idea64_gMf7ZbAOwh

6 Likes

Thanks for Defold-Lua-Annotations, looks more updated than others.

According to the description, Luanalysis looks very good, but it’s for IDEA as I understand it.

3 Likes

To VS Code Users,

Improved Defold-Lua-Annotations for ‘table’ parameters and callback functions for better Intellisense and autocompletion. I tried with sumneko.lua plugin. For EmmyLua they should work too, but I haven’t tried it.

4 Likes

Have only just seen this thread and theres one thing I dont quite understand.
With a dual monitor setup, you can have one with Defold open, and another with VSCode open.
You can edit all you want from VSCode and run from Defold (as it will pickup you changes) or you can use the extension setup (I think I used a different one). Heck you can even call bob yourself, probably hook it up to Emacs or Sublime and run it however you want?

Yes, debugging and such can be more complicated, but Ive also used a number of Lua based remote debuggers that work fine, so there are options for your flavour of editing and debugging.

I personally believe the Defold Foundation needs to focus and design around a single tool suite, otherwise their resources will be spread too thin. And if people want something different, then please build something? Its all open source. I find this the most frustrating thing when I see people demanding features when not a single cent has been transacted, and theyve not made an attempt themselves to understand what they are asking, nor attempt to apply a solution of their own design.

I commend @astrochili and the Defold Foundation members for doing such a large amount of work for such little compensation - honestly, theres very few people in the world what would work like this, and be happy to then also take on demanding suggestions.

So… @ekt - you seem to want something like unity where you can select your editor of choice. If so, have a look at the editor codebase see how much work it might be, make a PR and help Defold provide a solution. I think thats a highly fair way to move forward. You could even engage others on the Defold forum, and build a team to create such a solution if your time and software skills are limited. Theres lots of good ways to go about this. Making a complaint thread… dunno I agree with that process.

Note: I think its important not to strain an open sourced project team like Defold. Ive recently seen many large open sourced project fall down and disappear purely from the weight of demand and growth in codebase maintenance. A bit of patience, with a bit of good contributions to source code really helps them.

6 Likes

hi @dlannan
I don’t know you but I respect you for your activity in the community so I want to answer you trying to clarify why I don’t think you interpreted my thoughts correctly. please also read the answer I gave to @britzl later in the thread.

no. that’s not what I’m asking. in fact the possibility to choose an editor is already there in preferences\code editor.
and there are already two different extensions thanks to @mikatuo and @astrochili. they’re not perfect (difficult debugging, slower build times) but they do what I want, I use them and I’m happy! thanks @mikatuo and @astrochili :slight_smile:

Precisely because Defold is maintained by a small group of developers, I think they need to choose carefully which battles to fight.

My point is that as much as the Defold developers try, the Defold code editor it will always lag behind products like VSCode

My hope and suggestion was that the Defold developers would stop evolving the internal editor but would officially support the integration of an existing code editor of their choice.

Mine wasn’t a complaint but I was suggesting a change in strategy that in the long term would relieve them of work that I don’t consider core. I completely agree that an open source project can succumb to feature creep, in fact exactly for this reason I suggested reducing the effort in the code editor, and leaving it to others. because the (few) defold developers are better used for core stuff.

Having said all this, later in this thread there is a response from @britzl with the official position of the Defold team which I fully respect and for me this is a closed topic. I’m just sorry that you read it as a ‘whiny complaint thread’, that wasn’t my intent.

7 Likes

Not a problem. The title doesnt help, but nor does the process (from my perspective). The editor is an integral part of the Defold “plug and play” framework. Its one of the great drawcards of Defold (imo of course). I dont really know of any other framework where you can download an entire cross_platform engine and start coding as soon as you have it. No sdk setup, no editor setup, no graphics or audio, its all gtg.

And as such, I dont think it should be treated like Unity or other engines because it is unlike that. And I would much prefer to see people being proactive rather than reactive to features to go into Defold. Ive mentioned this on many threads for differing feature sets.

Defold being such an amazingly extensible framework means that anyone can easily extend how Defold works, and by many degrees, what Defold is, to suit the developers own needs. This is high customisation which means its far more productive to get like minded people together to actually add a solution for a problem, if there exists one.

I myself have been a disappointing contributor, its taken me 3 yrs to organise myself to get a working source code build of the engine and the editor (got there just a few moments ago in fact). Which means I can be a far more valuable contributor for helping Defold move forward, if my contributions make sense to their forward looking goals. And I make no assumptions about this, it is their wheel to steer.

Which is why… I tagged this a little more complaint oriented than that of a necessarily useful promotion of “what can we do”. Ie to make this much more clearer in words, rather than a first post point out all the things you dont like (this is a list of complaints btw) and trying to invoke discussion, I think it might be more productive to talk about the editor as it stands, and specifically how you would go about improving it and more importantly how you might garner like minded people to make an effort to help make that happen?

The difference may be subtle, but one is not so nice on the ears of developers and the other method will invoke their interest which is what you want. Ive seen this type of request for many different types of features and this is not a slight on yourself at all, it is more a suggestion on how you might end up with better results if you work with the flow of development and potentially the community at large.

Hope that makes some sense from a rambling old man who has trouble following compilation instructions (sorry Defold ppl for hassling on Discord).

8 Likes

Hi! Defold editor should have a button to collapse all folders just like VScode has a button to collapse all repositories. IMO.

Hi!
It’s possible to do already:

  1. Alt + Click on your root folder triangle
  2. Click to the root folder triangle again (without Alt this time)
3 Likes

I mean a button to collapse all folders altogether, here there is a picture explains what I mean

Schermata del 2023-10-19 15-14-38

I tried your hint, thank you. I think that a button could improve the usability of the editor.

1 Like