microsoft / microsoft/qdk

Q# Formatter

Open
#1,025 0 comments 0 reactions 1 assignee Claimed by @ScottCarda-MS View on GitHub
enhancement
Dominant language
Rust
Stars
1k
Forks
212
Avg merge
3d 8h
Merged PRs (30d)
65

Description

Let's use this issue to collect feedback and gather ideas about implementing a formatter for Q# to help standardize a consistent coding style across Q# code.
```[tasklist]
### Formatter Rules to Implement
- [x] Correct Indentation #1289
- [x] Correct Brace Style #1289
- [x] Correct spacing around operators #1172
- [x] Correct spacing around type-annotation colon #1172
- [x] Correct spacing around parentheses, brackets, and commas (sequences) #1289
- [ ] Remove unnecessary newlines
- [ ] ~Remove trailing commas in sequences with more than one element~ will be handled by the Linter
- [ ] ~Remove duplicate semicolons~ will be handled by the Linter
```
```[tasklist]
### Tasks
- [x] Decide on data structures for formatter
- [x] Format document on save #1172
- [x] Format code snippets #1275
- [ ] Format on typing
- [x] Format in Playground #1307
- [x] Format Samples/Libraries #1303
- [x] Add format of Samples/Libraries to build pipeline #1329
- [ ] Use indentation style specified by VsCode (or other endpoint)
- [ ] ~Support formatting around unary `-` and `+`~ not doable with this version of the formatter
- [x] Investigate removal of unauthoritative newlines #1303
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.