Skip to content
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

Switch to using the rope-utf16-splay library for ropes #70

Merged
merged 2 commits into from
May 5, 2019

Conversation

ollef
Copy link
Contributor

@ollef ollef commented Feb 10, 2018

  • This makes the licensing story simpler because rope-utf16-splay is
    BSD3 licensed. (Commercial user GPL cleanup #16)
  • LSP uses UTF-16 code unit based indexing, while the Yi rope library
    indexes by characters. This means that haskell-lsp would previously not
    correctly count characters that are encoded as two code units in
    UTF-16. The rope-utf16-splay library uses code unit indexing, which
    fixes this issue.
  • From my benchmarks, this new library, which uses splay trees
    internally, can be about twice as fast as finger tree based ones (like
    the Yi one) for use cases that are similar to what haskell-lsp might be
    doing (many consecutive modifications).

@MaskRay
Copy link

MaskRay commented Feb 11, 2018

test/VspSpec.hs Outdated
]
new = applyChange (Yi.fromString orig)
$ J.TextDocumentContentChangeEvent (mkRange 1 0 1 3) (Just 3) "𐐀𐐀"
lines (Yi.toString new) `shouldBe`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yi.toString new

Does this compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I must have messed up a rebase. Fixed!

@wz1000
Copy link
Collaborator

wz1000 commented Feb 11, 2018

Could you enable CircleCI for your fork?

@wz1000
Copy link
Collaborator

wz1000 commented Feb 11, 2018

Also how does this compare with yi-rope on memory usage?

@ollef ollef force-pushed the rope branch 3 times, most recently from 745732e to f9559d5 Compare February 11, 2018 18:29
@ollef
Copy link
Contributor Author

ollef commented Feb 11, 2018

@wz1000: CI enabled.

I have yet to run any memory benchmarks but it uses the strategy of merging adjacent chunks if they're below a certain size just like Yi.Rope, so it should be very similar in terms of memory usage.

@ollef
Copy link
Contributor Author

ollef commented Feb 11, 2018

@MaskRay: Can you explain the relevance of that link to this PR? I agree with it, but as far as I can tell that change hasn't been made yet and it seems uncertain when or if it will be.

@alanz
Copy link
Collaborator

alanz commented Apr 24, 2018

What is the state of play on this?

I see it needs an update, and making sure it has GHC 8.4.2 support would be great too.

In which case a merge is probably in order.

Does anyone have reservations? @wz1000 @MaskRay ?

@ollef
Copy link
Contributor Author

ollef commented Apr 25, 2018

I kind of forgot about it. I'll get the library updated and conflicts fixed when I have time.

I'd also be interested in hearing about reservations, e.g. if any of the reverse dependencies are strongly committed to using yi-rope.

@alanz
Copy link
Collaborator

alanz commented May 1, 2018

I want to first sort out haskell/haskell-ide-engine#538 before landing this, do not want to confuse possible sources of problems.

@ollef
Copy link
Contributor Author

ollef commented May 24, 2018

That's fair and there's no rush from my end. Feel free to ping me when the time's right! :)

@mawww mawww mentioned this pull request Feb 15, 2019
@mpickering
Copy link
Contributor

Seems like haskell/haskell-ide-engine#538 has been closed now. Would be good to get this merged I think.

* This makes the licensing story simpler because rope-utf16-splay is
BSD3 licensed. (haskell#16)
* LSP uses UTF-16 code unit based indexing, while the Yi rope library
indexes by characters. This means that haskell-lsp would previously not
correctly count characters that are encoded as two code units in
UTF-16. The rope-utf16-splay library uses code unit indexing, which
fixes this issue.
* From my benchmarks, this new library, which uses splay trees
internally, can be about twice as fast as finger tree based ones (like
the Yi one) for use cases that are similar to what haskell-lsp might be
doing (many consecutive modifications).
This tests indexing around characters encoded as two code units in
UTF-16.
@ollef
Copy link
Contributor Author

ollef commented Mar 24, 2019

I've rebased this on master now.

@alanz
Copy link
Collaborator

alanz commented Apr 6, 2019

Given microsoft/language-server-protocol#376 and https://github.com/Avi-D-coder/lsp-range-unit-survey we should perhaps hold off until we know if anything is going to change.

@ndmitchell
Copy link
Contributor

Could I suggest this gets merged sooner rather than later? Anyone hoping to build on haskell-lsp in a BSD-only context is blocked without it (which is me 😄 - see https://github.com/digital-asset/haskell-lsp and 1509628 which is based on this patch). It seems from the links above that this is the right approach today. If it stops being the right approach that seems the right time to go off in a different direction.

@alanz
Copy link
Collaborator

alanz commented May 5, 2019

Ok, I guess we can do it, and it is early in the month, so the bleeding edger's can pick up any problems that arise.

@alanz alanz merged commit 5fd2f49 into haskell:master May 5, 2019
lukel97 added a commit that referenced this pull request Feb 27, 2021
lukel97 added a commit that referenced this pull request Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants