-
Notifications
You must be signed in to change notification settings - Fork 223
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
Fix index out-of-range exception when deleting script files #748
Conversation
@@ -197,7 +197,7 @@ public string[] ReferencedFiles | |||
/// </summary> | |||
/// <param name="text">Input string to be split up into lines.</param> | |||
/// <returns>The lines in the string.</returns> | |||
public static IList<string> GetLines(string text) | |||
public static List<string> GetLines(string text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realise this is a breaking change, but I without RemoveRange
this gets trickier, and more importantly, less performant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof that's an odd one. Kind of seems like that shouldn't have been public.
I think it's a pretty safe bet that no one is using it... I would have never thought to look for a static get lines method on that class. That said, you could make an alternate private GetLinesInternal
that is typed as List<string>
then keep this method the same and have it implicitly cast to IList<string>
Either way, might consider decorating with Obsolete
. That should probably either be moved to a utility class or just made private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the impression that there are quite a few APIs exposed as public that really should be internal PSES, which is something I would ideally like to address with v2. It's a bit tricky because the way the project is broken up means some things need to be shared between libraries, but on the other hand those things are opportunities to design a real module API. But yeah, a lot of our public APIs I think need to be retired or changed.
/// <param name="isInsertion">If true, the position to validate is for an applied change.</param> | ||
public void ValidatePosition(int line, int column, bool isInsertion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this is also a breaking change -- so maybe we ought to keep it in? I'd prefer not personally, but the preference isn't that strong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe have something like this?
public void ValidatePosition(int line, int column)
{
// Actual logic
}
[Obsolete("Use ValidatePosition(int, int) instead")]
public void ValidatePosition(int line, int column, bool isInsertion)
{
ValidatePosition(line, column);
}
I think it's worth avoiding the breaking change here, even if the risk is low.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this better. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Fixes #739.