Skip to content

Conversation

donaldnevermore
Copy link
Contributor

  • There is an associated issue in the Backlog milestone (required)
  • Code is up-to-date with the main branch
  • You've successfully run hereby runtests locally
  • There are new or updated unit tests validating the change

Added a new option indentSwitchCase in FormatCodeSettings.
Closes #18682

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Apr 11, 2023
@donaldnevermore
Copy link
Contributor Author

@microsoft-github-policy-service agree

@andrewbranch
Copy link
Member

@donaldnevermore thank you! For tests, look at tests/cases/fourslash/formatting* and it should be fairly clear what to do.

@andrewbranch
Copy link
Member

andrewbranch commented Apr 12, 2023

Awesome! The only thing left to do here is update the copy of FormatCodeSettings in src/server/protocol.ts.

After that, would you be up for opening the corresponding VS Code pull request similar to microsoft/vscode#80828? You already did! microsoft/vscode#179670

@donaldnevermore
Copy link
Contributor Author

Done. But why are there 2 duplicate FormatCodeSettings?

@andrewbranch
Copy link
Member

Looks like you need to update an API baseline again.

But why are there 2 duplicate FormatCodeSettings?

protocol.ts is meant to be a standalone definition file for TS Server consumers (VS and VS Code build scripts copy it into their build, I think), so it has some tsserver-specific types and lacks a lot of compiler/LS types, but there is also a little bit of overlap that requires duplication. Probably these days we could find a smarter way to generate it, but nobody has touched it in ages.

@donaldnevermore
Copy link
Contributor Author

donaldnevermore commented Apr 13, 2023

OK. I noticed that one has readonly modifiers and the other doesn't. If each copy is for different purposes and has its own specific properties, it might not be a good idea to consolidate them. But it's hard to remind people that they have to update them all.

@andrewbranch andrewbranch merged commit adcc39d into microsoft:main Apr 13, 2023
@donaldnevermore donaldnevermore deleted the fix-indent branch April 13, 2023 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

formatter: allow custom switch-case indentation
3 participants