Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@bettinaheim
Copy link
Contributor

@bettinaheim bettinaheim commented Oct 21, 2021

This PR does three things:

  • It includes the published version of the formatter in the Microsoft.Quantum.Sdk, and adds a build target for updating the syntax in the project (no formatting).
  • It adds support for formatting files in the language server. This currently as written includes both formatting and updating syntax.
  • It adds a code action for the things that can be fixed by the syntax updater. If that action is selected, the deprecated syntax in the whole file is updates. No formatting is performed.

There is a test for the language server functionality, which tests two scenarios:

  1. The first part checks formatting works when using the formatter packaged in the Sdk, and relies on a fixed version of the Sdk that has the formatter included.
  2. The second part tests formatting works when using the (published) source code version of the formatter, and should catch any breaking changes to the formatter.

Additionally, we will set up a sanity test in the qdk repo to ensure that the formatter is correctly packaged in all future versions of the Sdk and the defined build target works as well.
Telemetry will follow in a separate PR.

@bettinaheim bettinaheim changed the title Adding formatting support and a code action for update to the language server Adding formatting support and a code action for updating syntax to the language server Oct 21, 2021
@ScottCarda-MS ScottCarda-MS added the area: formatter Q# source code formatter label Oct 21, 2021
@bettinaheim bettinaheim changed the base branch from beheim/sdkIntegration to main October 22, 2021 06:08
@bettinaheim bettinaheim changed the title Adding formatting support and a code action for updating syntax to the language server Adding Sdk integration, and formatting support + code action for syntax updates to the language server Oct 22, 2021
@bettinaheim bettinaheim added this to the November 2021 milestone Oct 23, 2021
@bettinaheim bettinaheim requested a review from bamarsha October 23, 2021 04:44
Copy link
Contributor

@ScottCarda-MS ScottCarda-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The work in the formatter looks great, as well as the changes around the ProjectProperties type. Thanks!

An updated version of the formatter documentation is merged into main. Please pull that in and update that with anything relevant to the changes in this PR. Off the top of my head, it could be very informative to add a new section about the three new ways this PR exposes the formatter for use to people through the SDK. I also believe you had mentioned something before about updating the 'Limitations' section.

@ScottCarda-MS ScottCarda-MS self-requested a review November 3, 2021 17:15
@ricardo-espinoza
Copy link
Contributor

Thanks @bettinaheim for the detailed walk through this pull request. It took me a while to go over it, and catch up with the meeting last week, but looks good to me.

@bettinaheim
Copy link
Contributor Author

@ScottCarda-MS I updated the readme of the formatter. Please take a look.

Copy link
Contributor

@ScottCarda-MS ScottCarda-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bettinaheim. The README changes look good to me.

@bettinaheim bettinaheim merged commit 790813e into main Nov 5, 2021
@bettinaheim bettinaheim deleted the beheim/formatting branch November 5, 2021 01:20
cesarzc added a commit that referenced this pull request Nov 5, 2021
* added MSBuild_Logs to gitignore (#1171)

* Command Line Support for Project File Input (#1192)

* Change --inputs to --input (#1210)

* Deprecate new array expression (#956)

* Removing temporary project (#1225)

* Formatter Updates Deprecated Boolean Operator Syntax (#1214)

* Update the documentation found in the Q# Formatter Project (#1203)

* Formatter Updates Deprecated Specialization Declaration Parameters (#1226)

* Adding Sdk integration, and formatting support + code action for syntax updates to the language server (#1207)

Co-authored-by: Filip W <[email protected]>
Co-authored-by: Scott Carda <[email protected]>
Co-authored-by: Sarah Marshall <[email protected]>
Co-authored-by: bettinaheim <[email protected]>
Co-authored-by: Jintao YU <[email protected]>
cesarzc added a commit that referenced this pull request Nov 16, 2021
* added MSBuild_Logs to gitignore (#1171)

* Command Line Support for Project File Input (#1192)

* Change --inputs to --input (#1210)

* Deprecate new array expression (#956)

* Removing temporary project (#1225)

* Formatter Updates Deprecated Boolean Operator Syntax (#1214)

* Update the documentation found in the Q# Formatter Project (#1203)

* Formatter Updates Deprecated Specialization Declaration Parameters (#1226)

* Adding Sdk integration, and formatting support + code action for syntax updates to the language server (#1207)

* QAT v. 0.1 (#1230)

* Sdk changes to support Qir targets (#1238)

* Quantum Development Kit Telemetry Library (#1199)

Co-authored-by: Sarah Marshall <[email protected]>
Co-authored-by: Scott Carda <[email protected]>

* Allowing to use the LLVM intrinsic readcyclecounter from Q# (#1248)

* Do case-insensitive comparisons for targets names (#1241)

During the build stage of a Q# job submission via the CLI or the stand-alone executable, there is a case sensitive enforcement of target names.

Since this limitation does not exist in the service or in other clients, we're aligning by making the corresponding comparison case insensitive.

* Refactor language server code for extracting symbols from Q# fragments (#1220)

* Start adding SymbolOccurrence module

* Replace SymbolInformation implementation

* Add C# interop for SymbolOccurrence

* Rename SymbolInformation.cs to match class name

* Mark SymbolInformation as obsolete

* Add SymbolOccurrence.fsi

* Add doc comments

* Fix nullable errors with .NET Core 3.1

* Use as instead of is

* Take in fragment instead of file in SymbolOccurrence

* Update todo comments

* Return NS in open directive as UsedVariable

* Use TryGet for SymbolOccurrence C# API

* Statement Kinds Support (#1212)

* Addressing last comments - QAT v0.1 (#1240)

* Type renaming

* Removing redudant setModulePassManager

* Fixing recursion

* Refactoring filenames

* Renaming directory

* Updating names and files

* Formatting

* Fixing include

* Updates for QIR validation (#1250)

* Type renaming

* Removing redudant setModulePassManager

* Fixing recursion

* Refactoring filenames

* Renaming directory

* Updating names and files

* Formatting

* Changing default to interop friendly

* Updating base profile

* Styling

* Updating logger

* Fixing style

* Removing comment

* Moving testing to run before linting

* Updating CMake

* Attempting to solve tests issue

* Updating according to PR comments

* Complete NamespaceItem in qsfmt (#1239)

Co-authored-by: Filip W <[email protected]>
Co-authored-by: Scott Carda <[email protected]>
Co-authored-by: Sarah Marshall <[email protected]>
Co-authored-by: bettinaheim <[email protected]>
Co-authored-by: Jintao YU <[email protected]>
Co-authored-by: Troels F. Rønnow <[email protected]>
Co-authored-by: XField <[email protected]>
Co-authored-by: Ricardo Espinoza <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: formatter Q# source code formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants