Page 1 of 1

Typehints and documentation in vscode

Posted: 09 Jan 2022, 21:11
by erksmit
If you've done any lua programming, you will probably have run into the annoyance of having to check the luadocs every time you writte a function to see if you've written it correctly.
In order to improve the experience i made a script for turning the luadocs into EmmyLua notations.
Advantages
By using the annotations you will have
  • Autofill when typing
    autofill.png
  • Type hints on return values
    returnType.png
    returnType.png (8.91 KiB) Viewed 5081 times
  • Documentation when hovering over api functions, including information about parameter and return types
    documentation (2).png
Limitations
Because of the way the lua plugin works, the theodocs.lua file must be kept open for the docs to show up.
Since im too lazy to manually document every type of gui object all their functions are listed under the same GUI type, meaning it will show functions like getLastPart on gui objects that are not layouts.

Installation
  1. To use the annotations you will need to install vscode first, download vscode
  2. Install the Lua Language Server coded by Lua
    Install In VSCode.gif
    Install In VSCode.gif (76.4 KiB) Viewed 5081 times
  3. Open your desired workspace, i use the theotown folder (just make sure you dont accidentally publish it with your plugin).
  4. In the top level of your folder, create a folder named ".vscode", if it already exists you dont need to change anything
  5. Put the contents of this zip into the folder
    .vscode.zip
    (26.38 KiB) Downloaded 126 times
  6. Enjoy a more comfortable coding experience
I will be updating these docs when i improve my parsing script or when new functions are added
Naamloos.png
Naamloos.png (7.42 KiB) Viewed 5062 times

Re: Typehints and documentation in vscode

Posted: 28 Aug 2022, 17:28
by Simon142
Epic (amazing) (I love this)

Re: Typehints and documentation in vscode

Posted: 03 Oct 2022, 20:55
by The26
This is epic (real) (epic) (real epic) (epic (real))