-
-
Notifications
You must be signed in to change notification settings - Fork 377
File Structure
⚠️ WarningThis wiki has been replaced by the wiki on our website. This wiki will be removed in the future.
Below is an explanation of the project file structure. Hovering an item will show a description, clicking a linked item will jump to more detailed info, if available.
Files marked with ⛔
are ignored by git.
📦 lua-language-server/ ├── 📁 .github/ ├── 📁 .vscode/ ├── 📁 3rd/ ├── 📁 bin/ ⛔ ├── 📁 doc/ ├── 📁 locale/ ├── 📁 log/ ⛔ ├── 📁 make/ ├── 📂 meta/ │ ├── 📁 3rd/ │ ├── 📁 template/ │ └── 📂 Lua ${LUA_VERSION} ${LANGUAGE_ID} ${ENCODING}/ ⛔ ├── 📂 script/ │ ├── 📁 brave/ │ ├── 📁 cli/ │ ├── 📁 config/ │ ├── 📁 core/ │ ├── 📁 encoder/ │ ├── 📁 glob/ │ ├── 📂 parser/ │ │ ├── 📜 guide.lua │ │ ├── 📜 luadoc.lua │ │ ├── 📜 newparser.lua │ │ └── 📜 tokens.lua │ ├── 📂 proto/ │ │ ├── 📜 converter.lua │ │ ├── 📜 define.lua │ │ └── 📜 proto.lua │ ├── 📂 provider/ │ │ ├── 📜 diagnostic.lua │ │ └── 📜 provider.lua │ ├── 📁 pub/ │ ├── 📁 service/ │ ├── 📁 test │ ├── 📁 tools │ ├── 📂 vm/ │ │ ├── 📜 compiler.lua │ │ ├── 📜 def.lua │ │ ├── 📜 doc.lua │ │ ├── 📜 field.lua │ │ ├── 📜 generic.lua │ │ ├── 📜 global.lua │ │ ├── 📜 infer.lua │ │ ├── 📜 local-id.lua │ │ ├── 📜 node.lua │ │ ├── 📜 ref.lua │ │ ├── 📜 runner.lua │ │ └── 📜 sign.lua │ ├── 📂 workspace/ │ │ ├── 📜 loading.lua │ │ ├── 📜 require-path.lua │ │ ├── 📜 scope.lua │ │ └── 📜 workspace.lua │ ├── 📜 await.lua │ ├── 📜 client.lua │ ├── 📜 files.lua │ ├── 📜 language.lua │ ├── 📜 lclient.lua │ ├── 📜 library.lua │ ├── 📜 plugin.lua ├── 📜 debugger.lua ├── 📜 test.lua └── 📜 main.lua
Github-specific files for metadata, issue templates, etc.
Visual Studio Code specific files for development.
Contains Lua defintion files for various included libraries like love2d
and OpenResty
.
Parses Lua code into an abstract syntax tree (AST).
Turns:
x = 10 y = 20
into:
{ type = 'main', start = 0, finish = 20000, [1] = { type = 'setglobal', start = 0, finish = 1, range = 5, [1] = 'x', value = { type = 'integer', start = 4, finish = 6, [1] = 10 }, }, [2] = { type = 'setglobal', start = 10000, finish = 10001, range = 10005, [1] = 'y', value = { type = 'integer', start = 10004, finish = 10006, [1] = 20 }, }, }
i️ Note: first line is
0
, start is cursor position on the left and finish is cursor position on the right.
i️ Note:
position = row * 10000 + col
, therefore, only codes with fewer than 10000 bytes in a single line are supported. These nodes are generally named source.
i️ Note: Most of the children files are obsolete, only the ones still in use are documented.
Parses Lua code into an AST then wraps it into state
.
local state = { version = 'Lua 5.4', lua = [[local x = 1]], ast = { ... }, errs = { ... }, -- syntax errors comms = { ... }, -- comments lines = { ... }, -- map of offset and position }
Semantic analysis of the AST and binding status according to the workspace.
Turns:
---@class myClass local mt
into:
vm.compileNode('mt') --> node: { [1] = { type = 'local', [1] = 'mt', }, [2] = { type = 'global', cate = 'type', name = 'myClass', }, }
Process analysis and tracking of local variables
---@type number|nil local x if x then print(x) --> `x` is number here end