Skip to content

Conversation

@nguerrera
Copy link
Contributor

@nguerrera nguerrera commented Aug 25, 2022

Take 2 of #916. Did more cleanup (all documented below) and fixed bug where there are non-string values in the settings json file.

When a solution is open, there is no workspace, so we use the solution folder as the workspace folder and read the settings file ourselves.

Also fix an issue where there was not a good user-facing message when cadl-server was configured to a path that did not exist.

Finally, some general cleanup:

  • Downgrade 16.x VS API packages to 16.0 for maximum compatibility
  • Upgrade other packages to latest
  • Run VS format command to format #if blocks not formatted by dotnet format
  • Run VS remove-and-sort-usings
  • Add inner exceptions to our exception types
  • Convert VariableResolver to static class
  • Avoid checking development mode in two places
  • Make helper types internal
  • Seal classes where possible
  • Use Dictionary.Add instead of indexer to get exception on duplicates
  • Use TryGetValue instead of catch KeyNotFoundException
  • Use exception filter instead of if+rethrow
  • Use string instead of string[] for process arguments
    • It was confusing me that we sometimes put more than one argument in a single array element.
  • Use == or != null throughout instead of is and is not
    • I could go either way on this, but chose what we had most for consistency.
  • Use multiple args to Path.Combine instead of one with forward slashes to get OS-idiomatic paths.

Fix #660

When a solution is open, there is no workspace, so we use the solution
folder as the workspace folder and read the settings file ourselves.

Also, some general cleanup:
* Downgrade 16.x VS API packages to 16.0 for maximum compatibility
* Upgrade other packages to latest
* Run VS format command to format #if blocks not formatted by `dotnet format`
* Run VS remove-and-sort-usings
* Add inner exceptions to our exception types
* Convert VariableResolver to static class
* Avoid checking development mode in two places
* Make helper types internal
* Seal classes where possible
* Use Dictionary.Add instead of indexer to get exception on duplicates
* Use TryGetValue instead of catch KeyNotFoundException
* Use exception filter instead of if+rethrow
* Use string instead of string[] for process arguments
  * It was confusing me that we sometimes put more than one argument in a single array element.
* Use `==` or `!= null` throughout instead of `is` and `is not`
  * I could go either way on this, but chose what we had most for consistency.
@azure-pipelines
Copy link

You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/920/

@nguerrera nguerrera merged commit ca0513f into microsoft:main Aug 25, 2022
@nguerrera nguerrera deleted the solution-settings branch August 25, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual Studio extension doesn't find the cadl-server path in VSWorkspaceSettings.json when a solution is open

2 participants