Giter Club home page Giter Club logo

nanosworld-vscode's People

Contributors

derpius avatar negativenamengt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

negativenamengt

nanosworld-vscode's Issues

Issue with the Subscribe/Unsubscribe function

subOverloads += `\n---@overload fun(${cls.staticClass ? "" : `self: ${cls.name}, `}event_name: "${event.name}", callback: ${callbackSig}): ${callbackSig} ${generateInlineDocstring(event)}`;
unsubOverloads += `\n---@overload fun(${cls.staticClass ? "" : `self: ${cls.name}, `}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}${cls.staticClass ? "." : ":"}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}${cls.staticClass ? "." : ":"}Unsubscribe(event_name, callback) end`;

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`;

[feature] Hardcoded typings

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

Additional context
This is painful
image

[bug] Disabling the extension wont actually disable highlighting

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:

  1. Install the extension
  2. Open a Lua file
  3. Disable the extension and reload vscode
  4. The bindings are still active

Expected behaviour
The extension would disable its bindings on deactivation

Additional context
microsoft/vscode#45474
Ketho/vscode-wow-api#20

[feature] Auto detect realm of current script

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.

[bug] Union types not properly generating

Describe the bug
Union types (e.g. Prop|Pickable) are generated by just concatenating the type names for some reason.

Expected behaviour
Should just leave them as is, considering emmylua / sumneko lua supports union types with the same syntax.c

Screenshots
Below should be string|table
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.