Issues using Visual Studio Code

So, i don’t even know if i can ask this kind of help here, so im already appologizing.
recently i decided to learn how to create my own games. i use some video lessons
and the guy said to use VS Code.

i wrote the same things that he made but it seems that im writing the worng code
(i never used VS Code btw)
i also dont know what this yellow line means.

im i using the wrong extentions?
please i tried everything

Yellow lines are just warning because those are Defod global functions.
What you need to do is open settings.json in VSCode and add following:

"Lua.diagnostics.globals": [
    "bit",
    "buffer",
    "collectionfactory",
    "collectionproxy",
    "crash",
    "factory",
    "go",
    "gui",
    "html5",
    "http",
    "image",
    "json",
    "label",
    "model",
    "msg",
    "particlefx",
    "physics",
    "profiler",
    "render",
    "resource",
    "socket",
    "sound",
    "spine",
    "sprite",
    "sys",
    "tilemap",
    "timer",
    "vmath",
    "window",
    "zlib",
    "editor",
    "hash",
    "hash_to_hex",
    "pprint",
    "init",
    "final",
    "on_message",
    "on_input",
    "on_reload",
    "update",
    "defos",
    "fmod",
    "describe",
    "context",
    "spec",
    "it",
    "test",
    "expect",
    "should",
    "they",
    "before",
    "setup",
    "after",
    "teardown",
    "assert_blank",
    "assert_empty",
    "assert_equal",
    "assert_error",
    "assert_false",
    "assert_greater_than",
    "assert_gte",
    "assert_less_than",
    "assert_lte",
    "assert_match",
    "assert_nil",
    "assert_true",
    "assert_type",
    "assert_not_blank",
    "assert_not_empty",
    "assert_not_equal",
    "assert_not_error",
    "assert_not_false",
    "assert_not_greater_than",
    "assert_not_gte",
    "assert_not_less_than",
    "assert_not_lte",
    "assert_not_match",
    "assert_not_nil",
    "assert_not_true",
    "assert_not_type",
    "assert_same",
    "assert_unique"
  ],

and it should no longer treat them as undefined globals.

1 Like

You don’t need to use VSCode to write scripts in Defold, but it has a lot more features than the built-in editor. If you do want to use VSCode, there are some extra steps involved to make it play nice with Defold: https://github.com/astrochili/defold-vscode-guide

2 Likes