Skip to content

Feature/deprecated annotation #16

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Jul 30, 2023

Conversation

aske02
Copy link
Contributor

@aske02 aske02 commented Jul 28, 2023

Adds the ability for the scraper to collect tags from the wiki and add them add ---@deprecated tags when generating

Changes to generating
The normal write functions have received a simple if statement that adds the deprecated tag with reason.

The only exception is the changes in GluaApiWriter.writeStruct which changes the syntax from using --@field to instead applying a nil (or default) value directly to the class member in a local table.

Old

---@class SunInfo
---@field direction Vector The suns direction relative to 0,0,0
---@field obstruction number Indicates how obstructed the sun is, 1 not visible, 0 fully visible
local SunInfo = {}

New

---@class SunInfo
local SunInfo = {}

---The suns direction relative to 0,0,0
---@type Vector
SunInfo.direction = nil

---Indicates how obstructed the sun is, 1 not visible, 0 fully visible
---@type number
SunInfo.obstruction = nil

Making these changes to GluaApiWriter.writeStruct and GluaApiWriter.writeClass allows us to use default values where they are needed and use the ---@deprecated tag

aske02 added 5 commits July 28, 2023 10:12
* depricated tags are treates as arrays due to wiki support multiple per page.

* Enum and Structs will collect deprecated tags for each item to later mark the specific entry as deprecated
@luttje
Copy link
Owner

luttje commented Jul 28, 2023

Awesome that you're contributing, I really appreciate it. I'll check out your contributions later, but skimming over it I feel like I'll probably merge it without much feedback.

@luttje
Copy link
Owner

luttje commented Jul 28, 2023

@aske02 Everything looks good and I would merge it, were it not for my shitty tests failing. If you could adjust them so they pass that would be awesome.

Thanks so much for this great contribution!

@aske02
Copy link
Contributor Author

aske02 commented Jul 29, 2023

I will take a look at the quick look at the test later

aske02 added 2 commits July 29, 2023 21:38
This resulted in deprecated always being an empty string instead of being undefined
@luttje luttje merged commit ed4896e into luttje:main Jul 30, 2023
@luttje
Copy link
Owner

luttje commented Jul 30, 2023

I've merged your contributions. Thanks for helping out!

@luttje
Copy link
Owner

luttje commented Jul 30, 2023

Looks like Stylua is complaining. I'll look at this when I'm back at a computer in a few weeks: https://github.com/luttje/glua-api-snippets/actions/runs/5703366710/job/15455948038

@luttje
Copy link
Owner

luttje commented Jul 30, 2023

Need to run "npm run stylua-custom"

@aske02 aske02 deleted the feature/deprecated-annotation branch July 30, 2023 10:44
@aske02 aske02 restored the feature/deprecated-annotation branch July 31, 2023 21:11
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants