Re: ]p not working as expected?

When I use ]p it is correctly pasting, but not re-indenting to match the indentation of line above (or [p does not match the indentation of the line below).


Re: ]p not working as expected?

Hmmm wait.

I just read over the docs and in the 'Limitation / things not emulated' section, you have:
]p auto-reindenting paste is not implemented

However, in the regular commands section, you have:
]p: paste after current position and reindent

I guess a little confusing smile


Re: ]p not working as expected?

Apologies for the 'bug' in the documentation, the note in 'limitations' should have been removed, or at least clarified, a long time ago.

]p uses VS's reformat mechanism, which depends on the specific language service. Can you check whether it does actually reformat the pasted section internally, apart from not properly aligning it for the surrounding context? It's just to make sure the mechanism is indeed working (even if incompletely).

Please let me know what version of VS and what language you are working it, it will provide additional info in diagnosing the problem.

I've also updated the docs, so that they will be ok starting with the next release.


Re: ]p not working as expected?

Is there a way to confirm whether VS is actually doing the re-indentation? Right now it appears to indent the pasted content with the same indentation that the 'source' copy had. Meaning, when I yank/delete from a specific line, wherever I paste that line, the indentation is the same as it was from when I yanked it to begin with.

I'm doing this currently using VS 2005 and in C#.

Although I just tested the same kind of thing using a c++ project in vs 2005 and the re-indentation appears to apply correctly.. So maybe something with C#?


Re: ]p not working as expected?

The way to confirm the re-indentation would be to yank a block which is completely wrongly indented and see whether ]p reindents it (not with regards to the context, but within its own lines).

In any case, I'll give a look to this over the next few days and post back here. It's very possible that it works differently with C++ and C# or other languages, VS's reindenting functionality is completely implemented by the language service.


Re: ]p not working as expected?

Perry, I have been trying to reproduce this under VS2005, with C# editing, and re-indenting seems to work fine. At least it works as I expect it to. Could you be more precise and show me an exact sample of paste code and paste context so that I understand the issue? I'll be happy to try to analyze it.




Re: ]p not working as expected?

Hi Jon,

I did some further playing around and it turned out just to be a fault on my part.

I didn't realise indenting in C# wouldn't work if there were, for example, a missing semi-colon or bad brace matching after the paste.

You can disregard this post.

Thanks for following up though.