From what I can see, currently Visual Studio Code for Lua supports only syntax colorization and we can have formatting and some snippets with extensions. What I need to know is if there are or is planned some kind of Intellisense.
For custom syntax highlighting and code completion.
In VSCode, install extension: Lua by sumneko
I don't know how to properly use emmyLua so my example is not perfect, but it's easy to setup with minimal effort. My use case is NLua integrated in C#. Just need to edit files with some code completion.
create file: Demo.lua
-- set the class a dummy name, since creator is the same name
-- eg. class name Point, creator name also Point will work
-- but will result in messy suggestions
---@class cPoint
---@field X number
---@field Y number
-- creator
---@type fun( x:number, y:number ) : cPoint
Point = {};
---@class Shapes
---@field Origin cPoint
local Shapes = nil;
---@type fun( x:number, y:number )
function Shapes:Move( x, y ) end
---@class cCircle : Shapes
---@field Radius number
local cCircle = {}; -- define to be able to ...
---@type fun( angle:number )
function cCircle:Roll( angle ) end -- ... add methods
---@type fun( x:number, y:number, r:number ) : cCircle
Circle = {};
---@class cRectangle:Shapes
---@field Width number
---@field Height number
local cRectangle = {};
---@type fun( origin:cPoint, w:number, h:number ) : cRectangle
Rectangle = nil;
-- no method overload, so just force it
---@type fun( x:number, y:number, w:number, h:number ) : cRectangle
Rectangle = nil;
create another file: test.lua
c = Circle( 10, 10, 10 );
c.Origin.X = 10;
c.Move( 10, 10 );
c.Roll( 10 );
r = Rectangle( Point( 0, 0 ), 10, 10 );
r = Rectangle( 10, 10, 10, 10 );
-- DETECTED ERRORS
c.origin.X = 10;
s = Shapes();
r.Roll( 10 );
-- NOT DETECTED
r = Rectangle( "hello" );
c = Circle(10,10);
c = Circle();
c.Roll();
Rectangle()
Three years later and we have vscode-lua. From what I gather it has some kind of Intellisense and could possibly pe configured to find paths to the needed libraries, version specification (5.1, 5.2, 5.3), indent, line-width and other formatting related things... Give it a try!
For custom syntax highlighting and code completion.
In VSCode, install extension: Lua by sumneko
I don't know how to properly use emmyLua so my example is not perfect, but it's easy to setup with minimal effort. My use case is NLua integrated in C#. Just need to edit files with some code completion.
create file: Demo.lua
-- set the class a dummy name, since creator is the same name
-- eg. class name Point, creator name also Point will work
-- but will result in messy suggestions
---@class cPoint
---@field X number
---@field Y number
-- creator
---@type fun( x:number, y:number ) : cPoint
Point = {};
---@class Shapes
---@field Origin cPoint
local Shapes = nil;
---@type fun( x:number, y:number )
function Shapes:Move( x, y ) end
---@class cCircle : Shapes
---@field Radius number
local cCircle = {}; -- define to be able to ...
---@type fun( angle:number )
function cCircle:Roll( angle ) end -- ... add methods
---@type fun( x:number, y:number, r:number ) : cCircle
Circle = {};
---@class cRectangle:Shapes
---@field Width number
---@field Height number
local cRectangle = {};
---@type fun( origin:cPoint, w:number, h:number ) : cRectangle
Rectangle = nil;
-- no method overload, so just force it
---@type fun( x:number, y:number, w:number, h:number ) : cRectangle
Rectangle = nil;
create another file: test.lua
c = Circle( 10, 10, 10 );
c.Origin.X = 10;
c.Move( 10, 10 );
c.Roll( 10 );
r = Rectangle( Point( 0, 0 ), 10, 10 );
r = Rectangle( 10, 10, 10, 10 );
-- DETECTED ERRORS
c.origin.X = 10;
s = Shapes();
r.Roll( 10 );
-- NOT DETECTED
r = Rectangle( "hello" );
c = Circle(10,10);
c = Circle();
c.Roll();
Rectangle()
If you want to know if a software has certain features or if they are planned, StackOverflow is the wrong place.
Go and read the information provided by the software's developer. If you don't find and answer there, contact the software's developer and ask them.
Think of a restaurant. If you want to know if they have something special on the menu or if they plan to put it on there, you better look into the menu and ask the chef or manager. Don't ask random people on the street if someone can help you...
As already mentioned in some comments there is a nice lightweight Lua IDE called ZeroBrane. Other than that there are plenty of extensible text editors.
http://lua-users.org/wiki/LuaIntegratedDevelopmentEnvironments
© 2022 - 2024 — McMap. All rights reserved.