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

Add code to handle incremental text updates #72

Closed
Timmmm opened this issue Dec 11, 2019 · 11 comments
Closed

Add code to handle incremental text updates #72

Timmmm opened this issue Dec 11, 2019 · 11 comments
Labels
enhancement New feature or request

Comments

@Timmmm
Copy link

Timmmm commented Dec 11, 2019

Nice project! I can't use it yet because I really only need go to type definition, but I'm keeping an eye on this.

Anyway, it would be very good if you could add code to the crate that (optionally) lets users have the incremental text updates handled for them. It's quite a pain to get right yourself because everything is done by line and row indices and they are measured in UTF-16 code points even though the actual text is sent as UTF-8! Yes, it is ridiculous.

@ebkalderon ebkalderon added the enhancement New feature or request label Dec 12, 2019
@ebkalderon
Copy link
Owner

ebkalderon commented Dec 12, 2019

Thanks for the kind words and feedback! Have you thought of using codespan and codespan-lsp, by any chance? The latter crate in particular should handle most of the conversions you describe, and it's what I personally use in my own LSP projects, including incremental text updates. With that said, I'm open to potentially "baking in" this sort of functionality into the project as an optional addition.

As for textDocument/typeDefinition, I suppose that API addition will have to come in the next few releases. 😄

@ebkalderon
Copy link
Owner

Both textDocument/definition and textDocument/typeDefinition are on the list in #10. Hopefully I can knock them out over the next several days. If you would like to submit a pull request yourself, of course, that would also be most welcome.

@Timmmm
Copy link
Author

Timmmm commented Dec 12, 2019

Thanks for the links to codespan - didn't know about that. Since I wrote this I also discovered that rust-analyzer has its LSP stuff as a generic crate. Here's an example. However they don't provide a nice trait like you do, so I'd definitely rather use this if it were complete.

@ebkalderon
Copy link
Owner

@Timmmm I've just merged in pull request #76, which implements goto declaration, goto definition, and goto type definition support. I hope to have a new release out on Crates.io fairly soon! Feel free to depend directly on the master branch in the meantime, if your project allows it and you're eager to begin iterating. ☺️

@Timmmm
Copy link
Author

Timmmm commented Dec 15, 2019

Ah cool, thanks! I'll give it a go.

@ebkalderon
Copy link
Owner

@Timmmm Please alert me to any glaring issues come up before the next release! I'll do my best to get in some quick fixes before publishing to Crates.io, if deemed necessary.

@ebkalderon
Copy link
Owner

@Timmmm Version 0.6.0 has just been published to Crates.io with support for goto declaration, goto definition, and goto type definition.

@ebkalderon
Copy link
Owner

We are currently depending on an old version of lsp-types (0.68 vs. 0.70, at the time of writing) because codespan-lsp hasn't been updated to support the latest version of lsp-types (see brendanzab/codespan#163). Once this is updated, I think we can update our lsp-types dependency to the latest version and close this issue as invalid.

@ebkalderon
Copy link
Owner

Closed by #105, which gives us access to the latest lsp-types and therefore compatibility with the latest codespan-lsp.

@Timmmm
Copy link
Author

Timmmm commented Jun 18, 2020

Finally got around to retrying this - haven't got incremental code changes to work yet (waiting to see what comes of brendanzab/codespan#249), but Go To Definition works perfectly, thanks!

@ebkalderon
Copy link
Owner

@Timmmm That's fantastic news! Glad it works for you. 🤗 I'm still waiting to see what the future of codespan will actually be, given that @brendanzab has been refactoring the repo quite a bit. I'm sure some solution for your needs will still exist though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants