Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ luajit/
spec/test_results.log
spec/test_generation.log
src/luacov.stats.out
runtime/lua/debugger.lua

# Release
manifest-updated.xml
Expand All @@ -37,3 +38,7 @@ src/Data/TimelessJewelData/*.bin
# Simplegraphic Debugging
runtime/imgui.ini
runtime/SimpleGraphic/SimpleGraphic.log
runtime/SimpleGraphic/Screenshots

.emmyrc.json
.luarc.json
64 changes: 63 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ It is recommended to use it over the built-in Lua plugins.
Please note that EmmyLua is not available for other editors based on Visual Studio Code,
such as [VSCodium](https://vscodium.com) or [Eclipse Theia](https://theia-ide.org) but can be built from source if needed.

Another alternative on VSCode is to use [sumneko's Lua language server](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) along with [actboy168's debugger](https://marketplace.visualstudio.com/items?itemName=actboy168.lua-debug). These can potentially offer more features than EmmyLua, such as conditional breakpoints.

### Visual Studio Code

1. Create a new <kbd>Debug Configuration</kbd> of type <kbd>EmmyLua New Debug</kbd>
Expand Down Expand Up @@ -168,11 +170,39 @@ such as [VSCodium](https://vscodium.com) or [Eclipse Theia](https://theia-ide.or
1. In VSCode click <kbd>Start Debugging</kbd> (the green icon) or press <kbd>F5</kbd>
1. The debugger should connect

You might also want to use actboy168 debugger. This is possible by using for example the following launch.json configuration:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "🍄attach",
"type": "lua",
"request": "attach",
"stopOnEntry": false,
"address": "127.0.0.1:12306",
"luaVersion": "luajit",
},

]
}
```

Then, similarly to the EmmyLua example:

1. Find the sub-folder that looks like `actboy168.lua-debug-x.y.z-win32-x64` in `%USERPROFILE%/.vscode/extensions`. Navigate to it and find the `debugger.lua` script under the script folder. Copy this to `runtime/lua`.
2. Copy-paste the following code snippet into `launch:OnInit()`:
```lua
local debugger = require("debugger"):start("127.0.0.1:12306")
-- debugger:event("wait") -- Uncomment this line if you want PoB to wait until the debugger is attached.
```


#### Excluding directories from EmmyLua

Depending on the amount of system ram you have available and the amount that gets assigned to the jvm running the emmylua language server you might run into issues when trying to debug Path of building.
Files in `/Data` `/Export` and `/TreeData` can be massive and cause the EmmyLua language server to use a significant amount of memory. Sometimes causing the language server to crash. To avoid this and speed up initialization consider adding an `.emmyrc.json` file to the `.vscode` folder in the root of the Path of building folder with the following content:
Files in `/Data` `/Export` and `/TreeData` can be massive and cause the EmmyLua language server to use a significant amount of memory. Sometimes causing the language server to crash. To avoid this and speed up initialization consider adding an `.emmyrc.json` to the root of the Path of building folder with the following content:

```json
{
Expand All @@ -182,6 +212,9 @@ Files in `/Data` `/Export` and `/TreeData` can be massive and cause the EmmyLua
},
"workspace": {
"ignoreGlobs": [
"**/*_spec.lua",
"spec/**/*.lua",
"runtime/lua/sha1/lua53_ops.lua",
"**/src/Data/**/*.lua",
"**/src/TreeData/**/*.lua",
"**/src/Modules/ModParser.lua"
Expand All @@ -190,6 +223,35 @@ Files in `/Data` `/Export` and `/TreeData` can be massive and cause the EmmyLua
}
```

This file can be customised according to what you want. It is a good idea to ignore test files as these tend to add things to the global namespace, which will look confusing, and they are designed to be run by Busted. `lua53_ops.lua` produces errors and doesn't actually get imported when using LuaJIT. It can be useful to keep the data and mod parser files, but generally this will increase the time the LSP takes to index the project on startup.

### Excluding directories from Sumneko's language server

If you prefer to not use EmmyLua, the following configuration works well for Sumneko's VS Code extension:

```json
{
"Lua.workspace.ignoreDir": [
".vscode",
// these files add things to global that aren't there in normal
// operation
"spec/*",
"src/Export/*",
"src/HeadlessWrapper.lua",

// this has lua 5.3 code which produces errors, but doesn't actually run
"src/runtime/lua/sha1/*",
],
"Lua.diagnostics.disable": ["inject-field"],
// disables diagnostics even when you open one of the above
"Lua.diagnostics.ignoredFiles": "Disable",
"Lua.runtime.version": "LuaJIT",
"Lua.workspace.preloadFileSize": 1000
}
```

The extension will automatically skip large files from being preloaded (controlled by `Lua.workspace.preloadFileSize`), so they don't have to be excluded. The configuration file can be found by pressing Ctrl-Shift-P and selecting `Preferences: Open Workspace Settings (JSON)`.

### PyCharm Community / IntelliJ Idea Community

1. Create a new "Debug Configuration" of type "Emmy Debugger(NEW)".
Expand Down
Loading
Loading