derpius / nanosworld-vscode Goto Github PK
View Code? Open in Web Editor NEWNanos World annotated stubs for sumneko’s Lua language server
Nanos World annotated stubs for sumneko’s Lua language server
nanosworld-vscode/src/index.ts
Lines 231 to 246 in 0d4caa0
When adding the Subscribe/Unsubscribe functions to the annotations it should always be static. If you leave it with : it will give an error in the game but not in the IDE. So to fix it I think that lines 231-246 should be changed to this:
subOverloads += `\n---@overload fun(event_name: "${event.name}", callback: ${callbackSig}): ${callbackSig} ${generateInlineDocstring(event)}`;
unsubOverloads += `\n---@overload fun(event_name: "${event.name}", callback: ${callbackSig}) ${generateInlineDocstring(event)}`;
});
events = `
---Subscribe to an event
---@param event_name string @Name of the event to subscribe to
---@param callback function @Function to call when the event is triggered
---@return function @The callback function passed${subOverloads}
function ${cls.name}.Subscribe(event_name, callback) end
---Unsubscribe from an event
---@param event_name string @Name of the event to unsubscribe from
---@param callback? function @Optional callback to unsubscribe (if no callback is passed then all callbacks in this Package will be unsubscribed from this event)${unsubOverloads}
function ${cls.name}.Unsubscribe(event_name, callback) end`;
Is your feature request related to a problem? Please describe.
There's no concept of structs for nanos types, so for example Client.Trace just returns a table
. Additionally, metamethods of classes aren't handled right now (Like Vector - Vector)
Describe the solution you'd like
Operator support could be hardcoded for the nanos-utils structs here: https://github.com/nanos-world/nanos-world-lua-lib/blob/master/Classes
And specific functions like Client.Trace could be overridden to return the more specific table return:
---@class TraceResult
---@field Success boolean
---@field Location Vector
---@field Normal Vector
---@field Entity Actor?
---@field BoneName string
---@field ActorName string
---@field SurfaceType SurfaceType
Describe alternatives you've considered
Could maybe PR some sort of "operator" schema to the https://github.com/nanos-world/api, not sure how this would go though
Describe the bug
Due to the way the language server loads EmmyLua extensions via the config, and due to not being able to edit the config during the deactivate
event, it's currently impossible (to my knowledge) to actually remove the bindings automatically when disabling/uninstalling the extension
I have however added code to disable the extension from deactivate
in the event that this limitation is removed
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
The extension would disable its bindings on deactivation
Additional context
microsoft/vscode#45474
Ketho/vscode-wow-api#20
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Until a full on mdx
parser is implemented to get proper docs from https://docs.nanos.world, I can grab roughly the parameters of a function (typeless).
Describe the solution you'd like
Use a comment at the top of a file to denote being serverside, clientside, or shared, ie ---@CLIENT
to match the EmmyLua style.
Describe alternatives you've considered
There may be some way to determine the realm automatically from the file path but I can't think of a reliable way to do it that would work with all scenarios.
Describe the bug
UtilityClasses
isnt currently emitted as part of the annotations
Need to check the schema matches other classes then add it to the class generator
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.