-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add a function to extract specific line from TextLines? #5
Comments
I'd prefer getLine :: Word -> Rope -> Text
getRange :: Position -> Position -> Rope -> Text and same for |
Great, I'm not in a hurry to implement it. getLine 0 "hello" == Just "hello"
getLine 1 "hello" == Nothing |
Thanks, will look into it in the next few days. |
Is there still an interest to work on |
I think it would be very useful. |
Thanks, I released https://hackage.haskell.org/package/text-rope-0.3 |
I'm currently looking at implementing some functionality in haskell language server which uses this library.
I would like to implement something like
getTextAtRange :: LSP.Range -> Rope -> Maybe Text
and
getLine :: Word -> TextLines -> Maybe Text
With the current api I can do it like this
Rope.lines r
and then index to the resulting list (I assume this is inefficient - linear time in number of lines?)Rope.splitAtLine
twice (example of this in hls: https://github.com/haskell/haskell-language-server/blob/50923e5c790e9c55c2b9b1bfcc8e78f7169f8ea3/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs#L907-L908) - this seems like more efficient way to achieve that, but not very convenient.What do you think about adding few high-level helpers like this to the library?
The text was updated successfully, but these errors were encountered: