-
Notifications
You must be signed in to change notification settings - Fork 72
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
feat: adding option for interpreting to exact cursor position or next command during interpret to point #875
Conversation
Another possibility I have considered is that the For example (where |
I like this ! However I wonder if finding the correct position should be done on the server side rather. What do you think @gares ? |
Also I think it should be an option maybe other users can give their sentiment about this ? |
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 love it too, thanks!
The lang server knows the end of sentences, it should compute what next means.
Is it actually tactic specific? I guess it probably works for any command (eg |
You are correct it isn't tactic specific. I think my wording is definitely wrong, but I think any solution that would fix #870 would probably need to be general/work for any command and not tactic specific. |
Sounds good, I can start working on that. One point of clarification, do we want a separate "interpretToNextPoint" sort of command (that would be utilized by continuous mode), or to modify the existing "interpretToPoint" functionality to interpret to the next command? I think the primary difference would be how using "interpretToPoint" works when in manual mode. |
Yes I think we should create a |
b02cc22
to
6191e97
Compare
Pushed some changes to make it so that the computation occurs on the server side and an option for configuring it. I was a little confused on all the times that I additionally encountered a corner case that I don't think has been addressed in the previous discussion in regard to a case with bullets like:
Specifically for bullets, do we want
I currently have it set up to do option 1. |
fbe72f7
to
cd77be9
Compare
Option 1 is how I use interpret to point most of the time so it would be my favoured option as well. |
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 think this approach will make the code more readable and avoid possible regressions due to too many API changes and unnecessary boolean flags.
8268c70
to
f8b2c9f
Compare
Much cleaner approach indeed! Thank you for your help |
Yup ! Thanks a lot ! This is good for me ! @gares I'll let you take care of it as you requested the changes ! |
I think we can improve further and kill that regexp. Instead of computing the position of the next sentence on the RawDocument, we can do so on the (parsed) Document. I think the easiest would be keep just one WDYT @rtetley , am I missing something? I don't have the time to try this solution out, but looks simpler. |
The problem is that all the other functions in the interpretToPoint function rely on the position, such as |
Right, I missed that piece. But it still looks cleaner that the current code, no? |
Agreed, its definitely an improvement ! |
Look better to me. @rtetley would it be possible to make the boolean argument optional in the protocol so to be backwards compatible? |
type t = { | ||
textDocument : VersionedTextDocumentIdentifier.t; | ||
position : Position.t; | ||
to_next_point : bool | ||
} [@@deriving yojson] |
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.
Look better to me. @rtetley would it be possible to make the boolean argument optional in the protocol so to be backwards compatible?
I believe it is enough to make to_next_point
an option. i.e.:
type t = { | |
textDocument : VersionedTextDocumentIdentifier.t; | |
position : Position.t; | |
to_next_point : bool | |
} [@@deriving yojson] | |
type t = { | |
textDocument : VersionedTextDocumentIdentifier.t; | |
position : Position.t; | |
to_next_point : bool option; | |
} [@@deriving yojson] |
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.
But I guess there is a larger question here, and I feel kinda silly because I am the one that suggested making this part of the protocol instead of the server options. Are we going to use both versions simultaneously ? If it makes sense to sometimes use the to_next_point: true
version and false version in the same editing session we should keep it that way. Otherwise we can revert to making it a server option. What do you think @gares ?
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 see no use case of using both behaviors at the same time :-/
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.
Well I think then we should revert to making it an option in the server that gets sent through the configuration request ! Sorry @Durbatuluk1701 😅
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.
All good, I think the iterations has made this an overall better solution for sure
… server option for exact cursor position or next command
…arsed document structures instead of regex
b7fc69b
to
dae58ba
Compare
@gares I can't merge this since you asked for the changes ! |
This PR adds a "interpret to next point" that will take the current cursor position and if it is part of a tactic then it will interpret through the completion of that tactic.
This should fix #870
Some test cases have also been added to test the function to find the end of the next tactic.
I am not sure if we want this to be the default behavior for continuous mode or should be an option that can be enabled.