Skip to content

Suggestion: code map files #233

Open

Description

@NanoBob

This isn't as much an issue as it is a suggestion.

Would it be possible to generate some form of code maps? By this I mean a file which would contain which lines of Lua code correspond to which lines of C# code, and which Lua file corresponds to which C# file.

My reasoning behind a feature like this would be so we could show errors with proper file names and line nubers in the C# files, even when thrown at runtime from Lua.

So basically something like:

{
    "Dist/Models/Player.lua": {
        "name": "Source/Models/Player.cs",
        "lines": [
            0,  // line 0 in Lua refers to line 0 in C# 
            1,  // line 1 in Lua refers to line 1 in C#
            2,  // line 2 in Lua refers to line 2 in C#
            3,  // line 3 in Lua refers to line 3 in C#
            4,  // line 4 in Lua refers to line 4 in C#
            4,  // line 5 in Lua refers to line 4 in C#
            5   // line 6 in Lua refers to line 5 in C#
        ]
    }
}

Activity

  1. yanghuan commented on Aug 12, 2019

    @yanghuan
    Owner

    Thanks your suggestion.
    CSharp.lua has always put the readability of the output first.This is easy to debug and misarrange, and the corresponding code on one line by one will not be a burden.

    JavaScript requires map files because it is often compressed and confused and loses readability, which is not currently present on CSharp.lua.

    So this suggestion won't be supported at the moment.

  2. NanoBob commented on Aug 14, 2019

    @NanoBob
    ContributorAuthor

    Alright, I understand.
    I hope at some point in the future you will change your mind.

    The reasoning behind the suggestion is more about debugging / reading errors than the readability of code. Currently if I get a runtime error I have to go to the .lua file, look at the line. And then go back to the C# file to fix it. It would just be a bit more streamlined to have the C# file and line number in the runtime errors.

  3. yanghuan commented on Aug 15, 2019

    @yanghuan
    Owner

    Thanks for your understanding.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions