arendvw / ScriptParasite

A component that allows editting of C# definitions in external editors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indentation: Different row number in GH and VSCode

ZacZhangzhuo opened this issue · comments

Recently i found i tiny problem of this plugin: the row number in VSCode and the corresponding C# code component in GH is different, which means you may find it hard to navigate the code error in VSCode based on the error message from the C# component.

i made a small code component (see code below) to fix the row number but i think it is inaccurate and temporary. I am looking for a better solution....

List<string> myStringList = new List<string>(); for( int n = 0; n < zMessage.Count; n++) { string intString = zMessage[n].Substring(zMessage[n].Length - 3, 2); if(IsNumberic(intString)) { int theInt = int.Parse(intString); if (theInt > 0) { theInt = zAdddNumber + theInt; string myString = zMessage[n].Substring(0, zMessage[n].Length - 3) + theInt.ToString() + ")"; myStringList.Add(myString); } else {

@ZacZhangzhuo I had the same problem so I can have a look for solution. Can you tell me exactly how many lines is the difference in numbers? I think @arendvw added a few new lines that offest the whole code so we can remove the comments from the utility functions to compensate for that and it will work. Or just remove the Runscript comment and keep the Print() ones is also ok.

image

in my filee, it is 9. Yes, we can remove it, but it is inconvenient because everytime we fresh it, the row number will back to different.

Not if we edit the code of the ScriptParasite to remove them automatically on export and then on import it ignores any part before RunScript except the directives so its fine ;)

@ZacZhangzhuo @dilomo this should be fixed in the latest master, does this work for you as well?

I've solved this by getting rid of namespaces alltogether, and forcing all projects to have a spacewidth of 2 in an .editorconfig, so that the generated .cs resembles what the C# editor uses a lot closed.

I would suggest maybe as an option in the future that we make a context menu on the component and we can choose 2, 4 space or tab because each person's editing style and editor and monitor resolutions are different. Personally I'm ok with two for now