-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OnAutoInsert Cohosting Tests (#10829)
* OnAutoInsert Cohosting Tests * Fixing C# case (and correcting others) All text should already be in the document/buffer when OnAutoInsert is being executed. Tigger character is not being added to the buffer, it should already be in the buffer. * PR feedback Switching to applying edit instead of verifying edit contents and range. Switching from Theories to separate Facts where input was complex. Other misc cleanup. * Fixing options source and adding options tests * Tests for all options * Switching to use TestCode class * Create options object for cohost OnAutoInsert to combined individual options passed to the remove service. * More PR feedback * Switching to nested RazorFormattingOptions
- Loading branch information
Showing
6 changed files
with
341 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RemoteAutoInsertOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Runtime.Serialization; | ||
using Microsoft.CodeAnalysis.Razor.Formatting; | ||
using Microsoft.CodeAnalysis.Razor.Settings; | ||
using Microsoft.VisualStudio.LanguageServer.Protocol; | ||
|
||
namespace Microsoft.CodeAnalysis.Razor.Remote; | ||
|
||
[DataContract] | ||
internal readonly record struct RemoteAutoInsertOptions | ||
{ | ||
[DataMember(Order = 0)] | ||
public bool EnableAutoClosingTags { get; init; } = true; | ||
|
||
[DataMember(Order = 1)] | ||
public bool FormatOnType { get; init; } = true; | ||
|
||
[DataMember(Order = 2)] | ||
public RazorFormattingOptions FormattingOptions { get; init; } = new RazorFormattingOptions() | ||
{ | ||
InsertSpaces = true, | ||
TabSize = 4 | ||
}; | ||
|
||
public RemoteAutoInsertOptions() | ||
{ | ||
} | ||
|
||
public static RemoteAutoInsertOptions From(ClientSettings clientSettings, FormattingOptions formattingOptions) | ||
=> new() | ||
{ | ||
EnableAutoClosingTags = clientSettings.AdvancedSettings.AutoClosingTags, | ||
FormatOnType = clientSettings.AdvancedSettings.FormatOnType, | ||
FormattingOptions = RazorFormattingOptions.From(formattingOptions, codeBlockBraceOnNextLine: false) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.