arendvw / ScriptParasite

A component that allows editting of C# definitions in external editors
22 stars 5 forks source link

Indentation: Different row number in GH and VSCode #5

Closed ZacZhangzhuo closed 3 years ago

ZacZhangzhuo commented 3 years ago

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 {

dilomo commented 3 years ago

@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

ZacZhangzhuo commented 3 years ago

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.

dilomo commented 3 years ago

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 ;)

arendvw commented 3 years ago

@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.

dilomo commented 3 years ago

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

arendvw commented 3 years ago

That would be awesome indeed. For now I've decided to revert to two spaces, until we can reliably solve the indentation problem.

On Wed, 18 Aug 2021 at 12:22, Anton Kerezov @.***> wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arendvw/ScriptParasite/issues/5#issuecomment-900998646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL7T5L6UL6O7S6HYVC5IDDT5OCXBANCNFSM5CJ3RGUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

-- StudioAvw +31 (0) 623584904 Stationsweg 11 2515BG Den Haag