Is it possible to get current textbox line?

Im currently working on a plugin that involves a built in script editor. I want to highlight current line user is editing just like roblox studio does it. Is it possible to find the current line with any easy way, I know its possible by using TextBox.CursorPosition, but is there any optimized and easier way to do so?

Result I want to achieve:
image
Current state:

i was thinking of “string.split()”