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

On transforming the text case everything is mugged up in single line. #229469

Open
AyushBadola22 opened this issue Sep 24, 2024 · 3 comments · May be fixed by #234494
Open

On transforming the text case everything is mugged up in single line. #229469

AyushBadola22 opened this issue Sep 24, 2024 · 3 comments · May be fixed by #234494
Assignees
Labels
help wanted Issues identified as good community contribution opportunities

Comments

@AyushBadola22
Copy link

Type: Bug

I have this code in camel case.
image

When I do ctrl + shift + P and type transform , I get suggestions to convert it to snake case.

image

On transforming it works perfectly.
image

BUT BUT BUT

On transforming back to the pascal case , everything is mugged up in the same line , also keywords should be ignored but it changes it also.

image

Please look into it . Thanks

VS Code version: Code 1.93.1 (38c31bc, 2024-09-11T17:20:05.685Z)
OS version: Windows_NT x64 10.0.22631
Modes:

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i5-12500H (16 x 3110)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.69GB (4.54GB free)
Process Argv --crash-reporter-id 5767e645-bcaf-493d-905a-ce91fe543ffb
Screen Reader no
VM 0%
Extensions (41)
Extension Author (truncated) Version
better-comments aar 3.0.2
vscode-tailwindcss bra 0.12.10
simple-react-snippets bur 1.2.8
vscode-notes dio 1.2.1
competitive-programming-helper Div 2024.7.1722430096
bracket-pair-toggler dzh 0.0.3
prettier-vscode esb 11.0.0
auto-close-tag for 0.5.15
code-runner for 0.12.2
vscode-javac geo 0.2.46
mongodb-vscode mon 1.8.1
python ms- 2024.14.0
vscode-pylance ms- 2024.9.2
jupyter ms- 2024.8.1
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.19
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
cpptools ms- 1.21.6
cpptools-extension-pack ms- 1.3.0
live-server ms- 0.4.15
prisma Pri 5.19.1
java red 1.34.0
vscode-microprofile red 0.12.0
vscode-quarkus red 1.18.1
LiveServer rit 5.7.9
es7-react-js-snippets rod 1.9.3
sonarlint-vscode Son 4.10.0
ayu tea 1.0.5
pdf tom 1.2.2
intellicode-api-usage-examples Vis 0.2.8
vscodeintellicode Vis 1.3.1
vscode-gradle vsc 3.16.4
vscode-java-debug vsc 0.58.0
vscode-java-dependency vsc 0.24.0
vscode-java-pack vsc 0.29.0
vscode-java-test vsc 0.42.0
vscode-maven vsc 0.44.0
vscode-icons vsc 12.9.0
Java-extension-pack wal 1.0.0
markdown-pdf yza 1.5.0

(4 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
724cj586:31013169
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl1:31139838
refactort:31108082
pythonrstrctxt:31112756
flightc:31134773
wkspc-onlycs-t:31132770
nativeloc1:31134641
wkspc-ranged-c:31125598
cf971741:31144450
fje88620:31121564
iacca2:31144504

@bpasero bpasero assigned hediet and unassigned connor4312 Sep 24, 2024
@hediet hediet added the help wanted Issues identified as good community contribution opportunities label Sep 25, 2024
@tisilent
Copy link
Contributor

withTestCodeEditor(
[
'camel from words',
'from_snake_case',
'from-kebab-case',
'alreadyCamel',
'ReTain_any_CAPitalization',
'my_var.test_function()',
'öçş_öç_şğü_ğü'
], {}, (editor) => {
const model = editor.getModel()!;
const camelcaseAction = new CamelCaseAction();
editor.setSelection(new Selection(1, 1, 1, 18));
executeAction(camelcaseAction, editor);
assert.strictEqual(model.getLineContent(1), 'camelFromWords');
editor.setSelection(new Selection(2, 1, 2, 15));
executeAction(camelcaseAction, editor);
assert.strictEqual(model.getLineContent(2), 'fromSnakeCase');
editor.setSelection(new Selection(3, 1, 3, 15));
executeAction(camelcaseAction, editor);
assert.strictEqual(model.getLineContent(3), 'fromKebabCase');
editor.setSelection(new Selection(4, 1, 4, 12));
executeAction(camelcaseAction, editor);
assert.strictEqual(model.getLineContent(4), 'alreadyCamel');
editor.setSelection(new Selection(5, 1, 5, 26));
executeAction(camelcaseAction, editor);
assert.strictEqual(model.getLineContent(5), 'ReTainAnyCAPitalization');
editor.setSelection(new Selection(6, 1, 6, 23));
executeAction(camelcaseAction, editor);
assert.strictEqual(model.getLineContent(6), 'myVar.testFunction()');
editor.setSelection(new Selection(7, 1, 7, 14));
executeAction(camelcaseAction, editor);
assert.strictEqual(model.getLineContent(7), 'öçşÖçŞğüĞü');
}
);

Through test cases, it was found that the previous design seemed to be targeted at specific areas.

@nichosta
Copy link

Looks like there is an inconsistency between pascal case and camel case, which leave all selected text on one line; and title case, kebab case, and snake case, which preserve multiple lines. I assume they should all preserve multiple lines.
None of the transformations preserve keywords, but I think this is intentional?

@hediet May I work on this issue as a first contribution? It isn't labelled as one, but it seems relatively simple.

@pawar-ashish
Copy link

I don't think its intended to work the way @AyushBadola22 is trying to use.
Pascal Case and Camel Case by definition do not have spaces in them. So it is expected that the spaces from the entire line are removed.
However, I agree that the new line should be respected by the transformation as multiline selection is allowed.
I have submitted a PR for the same. @hediet Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants