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

Typescript case statements not sorting #109

Open
rpaterson opened this issue Jan 17, 2025 · 3 comments
Open

Typescript case statements not sorting #109

rpaterson opened this issue Jan 17, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@rpaterson
Copy link

Thank you for this extension - it's awesome!

I'm having a problem with some Typescript case statements not sorting. I think the problem might be related to the curly-braces:

switch ('foo') {
  case 'beta': {
    return 'something';
  }
  case 'alpha': {
    return 'something';
  }
}

When I highlight just those case statements and invoke "Sort Blocks Ascending" the selection expands to the switch statement but then the file is unchanged.

If I remove those curly-braces sorting works:

  switch ('foo') {
    case 'beta':
      return 'something';
    case 'alpha':
      return 'something';
  }

How can I enable sorting the original code? I tried tweaking the "Expand Selection" setting and was able to prevent the selection from expanding, but still no sort. I also fooled with the "Multi Block Header Regex" but couldn't figure it out.

@1nVitr0 1nVitr0 added the bug Something isn't working label Jan 17, 2025
@1nVitr0 1nVitr0 self-assigned this Jan 17, 2025
@1nVitr0
Copy link
Owner

1nVitr0 commented Jan 17, 2025

Sounds like an issue with the detection of incomplete blocks. Should be a fairly quick fix unless something is replay broken there. Thanks for the issue!

@1nVitr0
Copy link
Owner

1nVitr0 commented Jan 17, 2025

As a workaround, you might be able to set the expandSelection settings to false, though the sorting might still not work then.

@rpaterson
Copy link
Author

I did try setting expandSelection to false which prevents the selection changing, but it still doesn't sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants