wmaurer/vscode-change-case

Convert to Pascal fails for multine text

akamud opened this issue · 7 comments

I'm trying to run the "Change case 'pascal'" command in this input (all selected at once):

ID_PROP_USER
NUMEF
NUMPROP
NUMBUS
STATUS
USER
TYPEPROCESS
DS_LOG
DT_BIRTH

But I get a warning: Running the contributed command:'extension.changeCase.pascal' failed.
Some other commands work, like dot, constant, and some also fail, like camel.

EDIT: I think I see what I did wrong, if I select all the words with the alt key, it works. Should this work if I select the text as a whole (like ctrl+a) too?

@akamud The original idea was for the extension to work on individual words, as selected by the user, like you've described in your edit.

I guess I could implement something so that it works with a multi-line selection, but I'd be concerned it would have do things that the user doesn't expect.
What should happen if the text as a whole is a block of code, which contains dashes and underscores?
And then there's also the issue of handling 'sentence case' in this scenario ...

Regardless, the user should get a nice message rather than that warning. I could do that quite quickly, and if you've got further suggestion on how it should work with with a selection that spans lines, I'd be happy to hear it.

I think you are right about the complexities on multi-line selection, I don't see any way to handle these scenarios without frustrating the user.
If I read the README before trying the extension I probably wouldn't try it anyway, so maybe just a nice message will prevent people from thinking this is an issue.

Thanks for the help and for your work on the extension.

Thanks for the feedback. I've implemented an info message, updated the readme in commit 669892e, and published version 0.3.0.

apkd commented

Why would you intentionally limit the usability of your extension? If the case conversion fails in some way that's unexpected to the user they can just ctrl+z out of it. I'm migrating from Sublime Text which comes with basic case conversion functionality out-of-the-box.

Why not provided a limited set of features for a block/multiple lines of text?

For instance, if the user selected multiple lines just give them the option for all upper case/all lower case. That shouldn't need a lot of change from the coding logic, and would provide a feature people are looking for.

Ok, I'm looking into it, expect a new release soon.

Thanks all for the feedback. I hope the latest changes satisfy your wishes. If not, you're welcome to open a new issue.