Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: code map files #233

Open
NanoBob opened this issue Aug 10, 2019 · 3 comments
Open

Suggestion: code map files #233

NanoBob opened this issue Aug 10, 2019 · 3 comments

Comments

@NanoBob
Copy link
Contributor

NanoBob commented Aug 10, 2019

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#
        ]
    }
}
@yanghuan
Copy link
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.

@NanoBob
Copy link
Contributor Author

NanoBob commented Aug 14, 2019

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.

@yanghuan
Copy link
Owner

Thanks for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants