Skip to content

Linux: symlinks are not resolved [breakpoints] #2

Description

@igorlfs

Hello,

Problem
I'm using emmylua_dap to debug neovim plugins (with nvim-dap). Some of these plugins are symlinked. When I create a breakpoint in one of their files, it is completely ignored by emmylua. After unlinking the folder and copying the actual files over, breakpoints work normally.

Expected Behavior
Symlinks are properly resolved

Reproduction
Playing around with neovim plugins is actually not needed at all. A bare

ln -s $PWD/repro.lua symlink.lua
lua symlink.lua 

Should be able to repro

Activity

  1. CppCXY commented on Apr 7, 2026

    @CppCXY
    Member

    Please open the logs(in $XDG_DATA_HOME/emmylua_dap/logs) to inspect the path used when adding a breakpoint, and print (debug.getinfo(1).source) inside files that are symbolic links.

  2. igorlfs commented on Apr 7, 2026

    @igorlfs
    Author

    to inspect the path used when adding a breakpoint

    The SetBreakpoints request points to the actual file, not the link.

    print (debug.getinfo(1).source) inside files that are symbolic links

    It just shows @symlink.lua (for the example I gave above)

  3. CppCXY commented on Apr 7, 2026

    @CppCXY
    Member

    The issue was caused by inconsistent paths, but it can be fixed on the dap side.
    add this code to your plugin.

    emmy = {}
    
    function emmy.fixPath(oldPath)
        return oldPath -- replace to symbolic link file
    end
    
  4. igorlfs commented on Apr 7, 2026

    @igorlfs
    Author

    add this code to your plugin.

    emmy = {}

    function emmy.fixPath(oldPath)
    return oldPath -- replace to symbolic link file
    end

    Might be me being dumb, but this does not seem to work.

    Do you have access to a Linux machine? e.g., can you repro on your end?

  5. CppCXY commented on Apr 8, 2026

    @CppCXY
    Member

    add this code to your plugin.
    emmy = {}
    function emmy.fixPath(oldPath)
    return oldPath -- replace to symbolic link file
    end

    Might be me being dumb, but this does not seem to work.

    Do you have access to a Linux machine? e.g., can you repro on your end?

    I only have a Linux system on the internal network where I can't install anything. I can't verify this on Windows, but from the symptoms you described I already know how to handle it.

    emmy is a global table accessed by emmylua_debugger to extend related logic, so first ensure emmy is defined on the global table, and you can add a print to the fixPath function to prove it is being called.

    relation C++ code: https://github.com/EmmyLua/EmmyLuaDebugger/blob/9581ca555c6b96475da7c6d4c35a070f02310416/emmy_debugger/src/debugger/emmy_debugger.cpp#L622

  6. igorlfs commented on Apr 8, 2026

    @igorlfs
    Author

    Okay, the workaround works! Thanks for the suggestion.

  7. igorlfs commented on Aug 22, 2026

    @igorlfs
    Author

    For neovim users, this works:

        _G.emmy = {}
    
        function _G.emmy.fixPath(oldPath)
            return vim.uv.fs_realpath(oldPath) -- replace to symbolic link file
        end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions