rojo-rbx / vscode-rojo

Visual Studio Code plugin for Rojo
https://marketplace.visualstudio.com/items?itemName=evaera.vscode-rojo
Mozilla Public License 2.0
35 stars 23 forks source link

Support top-level services without $className #69

Closed ThatTimothy closed 2 years ago

ThatTimothy commented 2 years ago

Issue

Currently, the valid Rojo syntax allows for services in a DataModel to omit the $className value at the top level.

Example:

{
  "name": "testing",
  "tree": {
    "$className": "DataModel",

    "ReplicatedStorage": {
      "Common": {
        "$path": "src/shared"
      }
    }
  }
}

The extension does not currently recognize this, and outputs an warning regardless: image

This has annoyed me for the past year, so I figured it was time to solve this issue 😄.

Solution

This PR fixes this issue by modifying the schema to not require $className for top-level objects when the root $className is a DataModel. It also includes support for nested services (StarterPlayer/StarterPlayerScripts and StarterPlayer/StarterCharacterScripts). I also factored out a lot of the refs so it's easier to read.

As a side note, I did also fix the formatting because it was abysmal. Hope that isn't too much of an issue.

I did test this pretty extensively, but if you find any issues or have any feedback, let me know! Thanks!

evaera commented 2 years ago

So the current development branch is v2 with the rewrite of the extension. Also, it looks like this PR conflicts with #66, can this PR be made to supercede that one?

evaera commented 2 years ago

I just changed the master branch to v2, so you might need to open a new PR or change the base branch on this one to reopen

ThatTimothy commented 2 years ago

So the current development branch is v2 with the rewrite of the extension. Also, it looks like this PR conflicts with #66, can this PR be made to supercede that one?

I'll get on it!

Created PR #71