Fuse setup for Vs Code?

User avatar
bryanfordney
Fusioneer
Posts: 86
Joined: Tue Jan 29, 2019 1:10 pm
Location: Atlanta, GA
Been thanked: 5 times

Fuse setup for Vs Code?

#1

Post by bryanfordney » Sat Jun 08, 2019 11:33 am

I use VS Code for all my coding projects.

I have gotten pretty addicted to Intellisense (code completion). Especially for languages without static typing, it makes learning the API and catching bugs much easier.

Does anyone have any experience using VS Code for Lua, specifically adding Fusions API to VS Code's Intellisense?

So far I have at least found this VSCode extension (seems more fleshed out than others):

https://github.com/sumneko/lua-language-server

User avatar
SecondMan
Site Admin
Posts: 3487
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 5
Location: Vancouver, Canada
Been thanked: 95 times
Contact:

Re: Fuse setup for Vs Code?

#2

Post by SecondMan » Sun Jun 09, 2019 5:46 pm

Honestly I have only ever used a combination of Scite and Notepad++ (ever since @AndrewHazelden did an excellent Reactor Atom for it) for Macro, Fuse and Script editing. Tried Sublime and a couple of others but they never really stuck.

That said, my interest is piqued. Would you care to do a bit of a write-up on how you prefer to work and the advantage of Intellisense?

Have you tested that particular extension?

User avatar
bryanfordney
Fusioneer
Posts: 86
Joined: Tue Jan 29, 2019 1:10 pm
Location: Atlanta, GA
Been thanked: 5 times

Re: Fuse setup for Vs Code?

#3

Post by bryanfordney » Tue Jun 11, 2019 11:26 am

Thanks, I will check out that atom. I haven't used Notepad++, I'm more of a macOS person myself.

I am going to attempt to get VS Code and that extension to recognize the Fuse API as I learn the API myself.

There is an annotation system called "Emmy" it seems, documented here: https://emmylua.github.io/annotation.html

The VS Code extension recognizes this syntax, which allows you to add "type hinting" to Lua, which is something I love to use when working in Python or Javascript (using Typescript). It means that it, for example, will put a red squiggly line under mistakes where you're trying to pass a string into a function that only accepts a number, etc.

When using a new API I find it infinitely useful to have instant access to the members and methods of a class. For example as I type "Image", I am immediately presented with a list of "Merge", "MergeOf", etc. Maybe NotePad++ with that atom does that! So I'll check that out.

User avatar
digitalvideo
Posts: 4
Joined: Tue May 21, 2019 5:39 am

Re: Fuse setup for Vs Code?

#4

Post by digitalvideo » Fri Jun 14, 2019 4:25 am

Hi,

if you find the solution for vscode i'm also insterrested in.

regards,

User avatar
bryanfordney
Fusioneer
Posts: 86
Joined: Tue Jan 29, 2019 1:10 pm
Location: Atlanta, GA
Been thanked: 5 times

Re: Fuse setup for Vs Code?

#5

Post by bryanfordney » Thu Jun 20, 2019 7:12 pm

I spent a bit of time writing a quick script to parse the documentation and translate it into EmmyLua definition files.

It works pretty well, but the documentation is sparse in places and I was not able to get the return type of most functions.

If you think it would be useful, I can put it up on Github. But it would need some manual work to get to a truly useful level.

Here's a snippet of the kind of output I'm generating.

It would be fairly easy to make this generate Python definition files in the same way.
Code: [Select all] [Expand/Collapse] [Download] (fusion-api.lua)
  1.  
  2. ---@class Fusion:Object @define Fusion.
  3. ---@field FileLogging any
  4. ---@field HotkeyManager any
  5. ---@field CacheManager any
  6. ---@field QueueManager any
  7. ---@field RenderManager any
  8. ---@field Build any
  9. ---@field Version any
  10. ---@field CurrentComp any
  11. local fusion = {}
  12. ---@return any @define This function does not return a value.
  13. function fusion:ClearFileLog()end
  14. ---@param show any @define True if you want to show the window, false if you want to hide.
  15. ---@return any @define This function does not return a value.
  16. function fusion:ShowWindow(show)end
  17. ---@param path string @define A standard fully-qualified path to a file or directory
  18. ---@return any @define A path with the Fusion path map handles re-inserted wherever possible.
  19. function fusion:ReverseMapPath(path)end
  20. ---@param path string @define A file or directory path that can contain Fusion's path maps.
  21. ---@return any @define A file or directory path with all path maps expanded into their literal path equivalents.
  22. function fusion:MapPath(path)end
  23. --- None
  24. ---@return any @define This function returns a table containing the Global Path mappings, as seen in the Global Path Preferences within Fusion.
  25. function fusion:GetGlobalPathMap()end
  26. ---@return any @define A MailMessage object handle that can be manipulated with other mail related functions.
  27. function fusion:CreateMail()end
  28. --- Specifies the full path and name of the file to open
  29. ---@param filename string @define Specifies the full path and name of the file to open
  30. ---@param mode constant @define Specifies the mode(s) of file access required, from a combination of the following constants:
  31. ---@return any @define An eyeonScript File object (see the IOClass documentation), or nil if the open fails.
  32. function fusion:OpenFile(filename,mode)end
  33. ---@param name string
  34. ---@return any @define When called without an argument, GetData returns a table listing the index names for all current custom data. If no custom data has been assigned to the object, then the function returns an empty table.
  35. function fusion:GetData(name)end
  36. --- A string value used as the index, or name, of the custom data.
  37. ---@param name string @define A string value used as the index, or name, of the custom data.
  38. ---@param value any @define The custom data to be assigned to the index specified in the first argument.
  39. ---@return any @define No return value.
  40. function fusion:SetData(name,value)end
  41. --- The tools argument should be a table containing a tool object for each tool which will be saved to the clipboard.
  42. ---@param tools table @define The tools argument should be a table containing a tool object for each tool which will be saved to the clipboard.
  43. ---@param information string @define The string argument can be any string value.
  44. ---@return any @define A boolean value indicating success or failure.
  45. function fusion:SetClipboard(tools,information)end
  46. --- none
  47. ---@return any @define A string or table of the current contents of the clipboard, or nil if empty.
  48. function fusion:GetClipboard()end
  49. ---@return any @define A table containing a summary of the Name, ID, ClassType, and OpIconString of every item in the registry. Useful for returning a lightweight version of the information presented by Fusion:GetRegList.
  50. function fusion:GetRegSummary()end
  51. ---@return any @define A table of registry IDs.
  52. function fusion:GetRegList()end
  53. ---@param envname string @define the name of the process environment variable to retrieve.
  54. ---@return any @define The value of the environment variable specified as an argument, or nil if that variable does not exist.
  55. function fusion:GetEnv(envname)end
  56. --- none
  57. ---@return any @define none
  58. function fusion:SavePrefs()end
  59. ---@param prefs_table table @define A table where the index for each record is the name of the preference to be set, and the value of the record is the value that the preference will be set to.
  60. ---@param prefname string @define A string naming the preference setting to be changed. Use dots to indicate subtables.
  61. ---@return any @define This function does not return a value.
  62. function fusion:SetPrefs(prefs_table,prefname)end
  63. ---@return any @define A table of preferences, or a specific preference value.
  64. function fusion:GetPrefs()end
  65. ---@return any @define A registry object, or nil if no match is found.
  66. function fusion:FindReg()end
  67. ---@param ID number @define An integer specifying the unique id of the registry entry that this function will return attributes for.
  68. ---@return any @define A table of registry ids.
  69. function fusion:GetRegAttrs(ID)end
  70. --- none
  71. ---@return any @define A table containing a list of available preview objects.
  72. function fusion:GetPreviewList()end
  73. ---@return any @define This function returns a table of composition object handles.
  74. function fusion:GetCompList()end
  75. --- The name of the specific page (or panel) of the preferences to show. The name should be chosen from one of the following :
  76. ---@return any @define none
  77. function fusion:ShowPrefs()end
  78. ---@param comp_path string @define A string describing the full path to the composition which is to be queued.
  79. ---@param render_start number @define A number which describes the first frame in the render range.
  80. ---@param render_end number @define A number which describes the last frame in the render range.
  81. ---@param slave_group string @define Specifies the slave group to use for this job.
  82. ---@param args_table table @define Specifies the slave group to use for this job.  The following keys are valid:
  83. ---@return any @define This function returns true if it succeeds in adding the composition to the Queue, and false if it fails.
  84. function fusion:QueueComp(comp_path,render_start,render_end,slave_group,args_table)end
  85. ---@return any @define Composition Object.
  86. function fusion:LoadComp()end
  87. ---@param locked boolean @define A true or false value to determine if the composition opens as locked, or unlocked. Defaults to false.
  88. ---@param close boolean @define A true or false value to determine if the composition will close automatically when the script exits. Defaults to false.
  89. ---@param hidden boolean @define If this value is true, the comp will be created invisibly, and no UI will be available  to the user. Defaults to false.
  90. ---@return any @define Composition Object.
  91. function fusion:NewComp(locked,close,hidden)end
  92. ---@return any @define This function does not return a value.
  93. function fusion:Quit()end
  94. ---@return any @define This function does not return a value
  95. function fusion:GetCurrentComp()end
  96. ---@return any @define This function does not return a value
  97. function fusion:ToggleBins()end
  98. ---@return any @define This function does not return a value.
  99. function fusion:ToggleRenderManager()end
  100. ---@return any @define Two numeric values representing the handle to the main windows for the Fusion application.
  101. function fusion:GetMainWindow()end
  102. ---@return any @define The current CPU load as a percentage between 0 and 100
  103. function fusion:GetCPULoad()end
  104. --- none
  105. ---@return any @define Returns a table containing information about the current application's name, executable, version, and build number.
  106. function fusion:GetAppInfo()end
  107. ---@return any @define none
  108. function fusion:Execute()end
  109. ---@return any @define none
  110. function fusion:RunScript()end
  111.