-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
WrappedLine information in API #23045
Comments
We have no plans to expose wrapping information to the extension host. In fact, only the core of the editor knows about wrapping (the rationale is that it is quite difficult to work with two coordinate systems and it is something only a small number of actions/scenarios would ever care about). There is also the case of folding, etc, which makes things additionally complex. I suggest we come up with a prioritized list of motions you're missing, and we can continue to handle them via |
Hmm ok, unfortunately this is very vim type behavior and I have no idea how I can achieve it without this information. Many users configure their movement keys to move by wrapped line(where we now have to delegate) instead of normal. As you move down, we keep track of what is called the desired column. This means if you want to go from Here| Where | is the cursor, you just go down twice and the column is attempted to be maintained. Here If we delegate and user cursorMove you can see how it would only send down moves Here Without knowing what column I actually want to get to because we delegated, this is impossible. |
Adding a desired column type argument to the API call seems silly, and oddly specific |
Funny you mention that, the core cursor has the same concept and AFAIK the cursorMove maintains that information. e.g. use the following in keybindings.json
press ctrl+up and observe that it respects this concept of desired column. |
Whoa, thanks @alexandrudima I think I can work with that, sorry I didn't realize it was retaining that! It is just a bit complicated to be managing it on both sides, but I can ignore updating it as long as we are delegating to vscode. |
is it possible that your keybinding does something different than:
I can't seem to get this call to do the same thing... |
@alexandrudima not sure if you saw my last comment but the keybinding works, but the same call through the API does not :/ |
@xconverge That "hidden" state is reset if The following extension works fine for me:
The cursor moves up by one view line and maintains the hidden state when I trigger the command from the |
Our |
This is where it gets a little confusing without the API from the ticket here though... I can make some gifs if that helps. I think that this ticket needs to at least be open until I see a way out... @rebornix remap j to gj and k to gk and try to use the extension for a day. This is a somewhat common setting for people to use so that you are never messing around with wrapped lines and the interaction is seamless. |
@rebornix @alexandrudima I still would like wrapped line info, I cannot get it to work right in any cases and having more info from the API would solve it... If it is really not going to happen, maybe @rebornix can take a stab at some of these issues and come up with a better way of handling the interaction from both sides related to this |
@alexandrudima You said this:
We would love to leverage this in built functionality for moving around, and I hacked up an implementation that works mostly well, except for one issue. In vim, you can't place the cursor on the very last position of the line. So when you move up a line from, say
you end up with
However, if we just try and leverage Vscode's APIs, we end up here
Normally, this isn't an issue as we just shift the cursor one left if it's at the end of the line. However, as you said,
and shifting the cursor left necessarily necessitates writing to textEditor.selection. As such, we need another solution to do this robustly. |
@alexandrudima Yeah I saw that. I really appreciate the in depth post on the difficulties of the API. From the perspective of the API user, it's often easy to forget all of the design choices/decisions that go into the API design, to minimize technical debt, to align with the current infrastructure, etc. As for the proposed solution, I'm not sure about that. If people are using block cursor while not in vim mode, that would prevent them from inserting onto the end of the line. Perhaps a flag is possible? This might be too much of a niche case to add a flag though... |
I am trying to determine wrappedLine information about what position.column is the start of the line and what position.column is the end of the line so that I can move relative to wrapped lines.
I tried this:
But I really don't have the ability to move the cursor around so much just to find this information.
This is needed in the VSCodeVim extension. There are quite a few motions that are relative to wrapped lines. Currently we rely on the cursorMove command which has a method to deal with wrapped lines, however if we want to do something else like a diagonal move, up a line and over etc, it is not possible.
The text was updated successfully, but these errors were encountered: