未验证 提交 92af2350 编写于 作者: F Fredric Silberberg

Merge remote-tracking branch 'dotnet/dev15.6.x' into update-keybinding-text

* dotnet/dev15.6.x:
  Fix symbol completion after 'in' (#24335)
  use PascalCase for const name
  Limit compiler server pipe name length (#24265)
  Test ConvertedType on LHS of deconstruction-assignment (#24158)
  remove unused usings
  use .editorconfig files
  address more comments
  address code review comments
  move newly added text into resource file
  add text and hyperlink to C# code style page
...@@ -92,6 +92,7 @@ public void Deconstruct(out int a, out string b) ...@@ -92,6 +92,7 @@ public void Deconstruct(out int a, out string b)
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
Assert.Equal(@"(x, y)", lhs.ToString()); Assert.Equal(@"(x, y)", lhs.ToString());
Assert.Equal("(System.Int64 x, System.String y)", model.GetTypeInfo(lhs).Type.ToTestDisplayString()); Assert.Equal("(System.Int64 x, System.String y)", model.GetTypeInfo(lhs).Type.ToTestDisplayString());
Assert.Equal("(System.Int64 x, System.String y)", model.GetTypeInfo(lhs).ConvertedType.ToTestDisplayString());
var right = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); var right = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Assert.Equal(@"new C()", right.ToString()); Assert.Equal(@"new C()", right.ToString());
...@@ -2392,10 +2393,10 @@ class C ...@@ -2392,10 +2393,10 @@ class C
{ {
static void Main() static void Main()
{ {
int x; long x;
string y, z; string y, z;
(x, (y, z)) = (1, (""a"", ""b"")); (x, (y, z)) = ((int)1, (""a"", ""b""));
System.Console.WriteLine(x + "" "" + y + "" "" + z); System.Console.WriteLine(x + "" "" + y + "" "" + z);
} }
} }
...@@ -2409,7 +2410,8 @@ static void Main() ...@@ -2409,7 +2410,8 @@ static void Main()
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
Assert.Equal(@"(x, (y, z))", lhs.ToString()); Assert.Equal(@"(x, (y, z))", lhs.ToString());
Assert.Equal("(System.Int32 x, (System.String y, System.String z))", model.GetTypeInfo(lhs).Type.ToTestDisplayString()); Assert.Equal("(System.Int64 x, (System.String y, System.String z))", model.GetTypeInfo(lhs).Type.ToTestDisplayString());
Assert.Equal("(System.Int64 x, (System.String y, System.String z))", model.GetTypeInfo(lhs).ConvertedType.ToTestDisplayString());
}; };
var comp = CompileAndVerify(source, expectedOutput: "1 a b", additionalRefs: new[] { ValueTupleRef, SystemRuntimeFacadeRef }, sourceSymbolValidator: validator); var comp = CompileAndVerify(source, expectedOutput: "1 a b", additionalRefs: new[] { ValueTupleRef, SystemRuntimeFacadeRef }, sourceSymbolValidator: validator);
...@@ -2906,11 +2908,13 @@ static void Main() ...@@ -2906,11 +2908,13 @@ static void Main()
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
Assert.Equal("(var x1, var (x2, x3))", lhs.ToString()); Assert.Equal("(var x1, var (x2, x3))", lhs.ToString());
Assert.Equal("(System.Int32 x1, (System.Int32 x2, System.String x3))", model.GetTypeInfo(lhs).Type.ToTestDisplayString()); Assert.Equal("(System.Int32 x1, (System.Int32 x2, System.String x3))", model.GetTypeInfo(lhs).Type.ToTestDisplayString());
Assert.Equal("(System.Int32 x1, (System.Int32 x2, System.String x3))", model.GetTypeInfo(lhs).ConvertedType.ToTestDisplayString());
Assert.Null(model.GetSymbolInfo(lhs).Symbol); Assert.Null(model.GetSymbolInfo(lhs).Symbol);
var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1);
Assert.Equal("var (x2, x3)", lhsNested.ToString()); Assert.Equal("var (x2, x3)", lhsNested.ToString());
Assert.Equal("(System.Int32 x2, System.String x3)", model.GetTypeInfo(lhsNested).Type.ToTestDisplayString()); Assert.Equal("(System.Int32 x2, System.String x3)", model.GetTypeInfo(lhsNested).Type.ToTestDisplayString());
Assert.Equal("(System.Int32 x2, System.String x3)", model.GetTypeInfo(lhsNested).ConvertedType.ToTestDisplayString());
Assert.Null(model.GetSymbolInfo(lhsNested).Symbol); Assert.Null(model.GetSymbolInfo(lhsNested).Symbol);
var x1 = GetDeconstructionVariable(tree, "x1"); var x1 = GetDeconstructionVariable(tree, "x1");
...@@ -2954,6 +2958,7 @@ static void Main() ...@@ -2954,6 +2958,7 @@ static void Main()
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
Assert.Equal("(var x1, byte _, var (x2, x3))", lhs.ToString()); Assert.Equal("(var x1, byte _, var (x2, x3))", lhs.ToString());
Assert.Equal("(System.Int32 x1, System.Byte, (System.Int32 x2, System.String x3))", model.GetTypeInfo(lhs).Type.ToTestDisplayString()); Assert.Equal("(System.Int32 x1, System.Byte, (System.Int32 x2, System.String x3))", model.GetTypeInfo(lhs).Type.ToTestDisplayString());
Assert.Equal("(System.Int32 x1, System.Byte, (System.Int32 x2, System.String x3))", model.GetTypeInfo(lhs).ConvertedType.ToTestDisplayString());
Assert.Null(model.GetSymbolInfo(lhs).Symbol); Assert.Null(model.GetSymbolInfo(lhs).Symbol);
var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(2); var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(2);
......
...@@ -371,6 +371,15 @@ public void GetBasePipeNameSlashes() ...@@ -371,6 +371,15 @@ public void GetBasePipeNameSlashes()
Assert.Equal(name, BuildServerConnection.GetBasePipeName(path + Path.DirectorySeparatorChar)); Assert.Equal(name, BuildServerConnection.GetBasePipeName(path + Path.DirectorySeparatorChar));
Assert.Equal(name, BuildServerConnection.GetBasePipeName(path + Path.DirectorySeparatorChar + Path.DirectorySeparatorChar)); Assert.Equal(name, BuildServerConnection.GetBasePipeName(path + Path.DirectorySeparatorChar + Path.DirectorySeparatorChar));
} }
[Fact]
public void GetBasePipeNameLength()
{
var path = string.Format(@"q:{0}the{0}path", Path.DirectorySeparatorChar);
var name = BuildServerConnection.GetBasePipeName(path);
// We only have ~50 total bytes to work with on mac, so the base path must be small
Assert.InRange(name.Length, 10, 30);
}
} }
} }
} }
...@@ -544,7 +544,7 @@ internal static string GetPipeNameForPathOpt(string compilerExeDirectory) ...@@ -544,7 +544,7 @@ internal static string GetPipeNameForPathOpt(string compilerExeDirectory)
return null; return null;
} }
return $"{userName}.{isAdmin}.{basePipeName}"; return $"{userName}.{(isAdmin ? 'T' : 'F')}.{basePipeName}";
} }
internal static string GetBasePipeName(string compilerExeDirectory) internal static string GetBasePipeName(string compilerExeDirectory)
...@@ -559,6 +559,7 @@ internal static string GetBasePipeName(string compilerExeDirectory) ...@@ -559,6 +559,7 @@ internal static string GetBasePipeName(string compilerExeDirectory)
{ {
var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(compilerExeDirectory)); var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(compilerExeDirectory));
basePipeName = Convert.ToBase64String(bytes) basePipeName = Convert.ToBase64String(bytes)
.Substring(0, 25) // We only have ~50 total characters on Mac, so strip this down
.Replace("/", "_") .Replace("/", "_")
.Replace("=", string.Empty); .Replace("=", string.Empty);
} }
......
...@@ -1924,6 +1924,56 @@ void M() ...@@ -1924,6 +1924,56 @@ void M()
await VerifyItemExistsAsync(markup, "String"); await VerifyItemExistsAsync(markup, "String");
} }
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(24326, "https://github.com/dotnet/roslyn/issues/24326")]
public async Task AfterInInLambda()
{
var markup = @"
using System;
class C
{
void M()
{
Func<int, int> f = (in $$
}
}
";
await VerifyItemExistsAsync(markup, "String");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(24326, "https://github.com/dotnet/roslyn/issues/24326")]
public async Task AfterInInMethodDeclaration()
{
var markup = @"
using System;
class C
{
void M(in $$)
{
}
}
";
await VerifyItemExistsAsync(markup, "String");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(24326, "https://github.com/dotnet/roslyn/issues/24326")]
public async Task VariableAfterInInInvocation()
{
var markup = @"
using System;
class C
{
void M(in String parameter)
{
M(in $$
}
}
";
await VerifyItemExistsAsync(markup, "parameter");
}
[WorkItem(539217, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539217")] [WorkItem(539217, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539217")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)] [Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task NestedType1() public async Task NestedType1()
......
...@@ -480,6 +480,15 @@ internal class ServicesVSResources { ...@@ -480,6 +480,15 @@ internal class ServicesVSResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files..
/// </summary>
internal static string Code_style_header_use_editor_config {
get {
return ResourceManager.GetString("Code_style_header_use_editor_config", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to prefer auto properties. /// Looks up a localized string similar to prefer auto properties.
/// </summary> /// </summary>
......
...@@ -1013,4 +1013,7 @@ I agree to all of the foregoing:</value> ...@@ -1013,4 +1013,7 @@ I agree to all of the foregoing:</value>
<value>Disabling the extension '{0}' unbound your keyboard bindings.</value> <value>Disabling the extension '{0}' unbound your keyboard bindings.</value>
<comment>0 is an extension name</comment> <comment>0 is an extension name</comment>
</data> </data>
</root> <data name="Code_style_header_use_editor_config" xml:space="preserve">
\ No newline at end of file <value>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</value>
</data>
</root>
...@@ -1493,6 +1493,11 @@ Souhlasím se všemi výše uvedenými podmínkami:</target> ...@@ -1493,6 +1493,11 @@ Souhlasím se všemi výše uvedenými podmínkami:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ Ich stimme allen vorstehenden Bedingungen zu:</target> ...@@ -1493,6 +1493,11 @@ Ich stimme allen vorstehenden Bedingungen zu:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ Estoy de acuerdo con todo lo anterior:</target> ...@@ -1493,6 +1493,11 @@ Estoy de acuerdo con todo lo anterior:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ Je suis d'accord avec tout ce qui précède :</target> ...@@ -1493,6 +1493,11 @@ Je suis d'accord avec tout ce qui précède :</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ L'utente accetta le condizioni sopra riportate:</target> ...@@ -1493,6 +1493,11 @@ L'utente accetta le condizioni sopra riportate:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source> ...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source> ...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ Wyrażam zgodę na wszystkie następujące postanowienia:</target> ...@@ -1493,6 +1493,11 @@ Wyrażam zgodę na wszystkie następujące postanowienia:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ Eu concordo com todo o conteúdo supracitado:</target> ...@@ -1493,6 +1493,11 @@ Eu concordo com todo o conteúdo supracitado:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source> ...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ Aşağıdakilerin tümünü onaylıyorum:</target> ...@@ -1493,6 +1493,11 @@ Aşağıdakilerin tümünü onaylıyorum:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source> ...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source> ...@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target> <target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note> <note>0 is an extension name</note>
</trans-unit> </trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
xmlns:converters="clr-namespace:Microsoft.VisualStudio.LanguageServices.Implementation.Options.Converters" xmlns:converters="clr-namespace:Microsoft.VisualStudio.LanguageServices.Implementation.Options.Converters"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:options="clr-namespace:Microsoft.VisualStudio.LanguageServices.Implementation.Options" xmlns:options="clr-namespace:Microsoft.VisualStudio.LanguageServices.Implementation.Options"
xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging" xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
<Setter.Value> <Setter.Value>
<Style TargetType="DataGridCell"> <Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="IsTabStop" <Setter Property="IsTabStop"
Value="{Binding Value="{Binding
Path=Column, Path=Column,
Converter={StaticResource ColumnToTabStopConverter}, Converter={StaticResource ColumnToTabStopConverter},
RelativeSource={RelativeSource Self}}"/> RelativeSource={RelativeSource Self}}"/>
</Style> </Style>
...@@ -35,12 +35,20 @@ ...@@ -35,12 +35,20 @@
<converters:MarginConverter x:Key="MarginConverter" /> <converters:MarginConverter x:Key="MarginConverter" />
</Grid.Resources> </Grid.Resources>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="5" /> <RowDefinition Height="5" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock TextWrapping="Wrap">
<Run Text="{x:Static local:GridOptionPreviewControl.CodeStylePageHeader}"/>
<Run Text=" "/>
<Hyperlink RequestNavigate="LearnMoreHyperlink_RequestNavigate" NavigateUri="{x:Static local:GridOptionPreviewControl.CodeStylePageHeaderLearnMoreUri}">
<TextBlock Text="{x:Static local:GridOptionPreviewControl.CodeStylePageHeaderLearnMoreText}"/>
</Hyperlink>
</TextBlock>
<DataGrid <DataGrid
Grid.Row="0" Grid.Row="1"
x:Uid="CodeStyleContent" x:Uid="CodeStyleContent"
x:Name="CodeStyleMembers" x:Name="CodeStyleMembers"
Margin="0,5,0,0" Margin="0,5,0,0"
...@@ -88,7 +96,7 @@ ...@@ -88,7 +96,7 @@
</DataGrid.GroupStyle> </DataGrid.GroupStyle>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTemplateColumn <DataGridTemplateColumn
x:Name="description" x:Name="description"
Header="{x:Static local:GridOptionPreviewControl.DescriptionHeader}" Header="{x:Static local:GridOptionPreviewControl.DescriptionHeader}"
Width="4.5*" Width="4.5*"
IsReadOnly="True"> IsReadOnly="True">
...@@ -106,8 +114,8 @@ ...@@ -106,8 +114,8 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTemplateColumn <DataGridTemplateColumn
x:Name="preference" x:Name="preference"
Header="{x:Static local:GridOptionPreviewControl.PreferenceHeader}" Header="{x:Static local:GridOptionPreviewControl.PreferenceHeader}"
Width="3*"> Width="3*">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
...@@ -115,7 +123,7 @@ ...@@ -115,7 +123,7 @@
<ComboBox <ComboBox
ItemsSource="{Binding Preferences}" ItemsSource="{Binding Preferences}"
DisplayMemberPath="Name" DisplayMemberPath="Name"
SelectedItem="{Binding SelectedPreference, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedPreference, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center" VerticalContentAlignment="Center"
HorizontalContentAlignment="Left"> HorizontalContentAlignment="Left">
<ComboBox.ItemContainerStyle> <ComboBox.ItemContainerStyle>
...@@ -127,8 +135,8 @@ ...@@ -127,8 +135,8 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTemplateColumn <DataGridTemplateColumn
x:Name="severity" x:Name="severity"
Header="{x:Static local:GridOptionPreviewControl.SeverityHeader}" Header="{x:Static local:GridOptionPreviewControl.SeverityHeader}"
Width="2.5*"> Width="2.5*">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
...@@ -147,12 +155,12 @@ ...@@ -147,12 +155,12 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<imaging:CrispImage <imaging:CrispImage
Height="16" Height="16"
Width="16" Width="16"
Moniker="{Binding Moniker}" Moniker="{Binding Moniker}"
Grid.Column="0"/> Grid.Column="0"/>
<TextBlock <TextBlock
Margin="5, 0, 0, 0" Margin="5, 0, 0, 0"
Text="{Binding Notification}" Text="{Binding Notification}"
Grid.Column="1"/> Grid.Column="1"/>
</Grid> </Grid>
...@@ -169,8 +177,8 @@ ...@@ -169,8 +177,8 @@
</DataGridTemplateColumn> </DataGridTemplateColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch"></GridSplitter> <GridSplitter Grid.Row="2" HorizontalAlignment="Stretch"></GridSplitter>
<Border Grid.Row="2" BorderBrush="Gray" BorderThickness="1"> <Border Grid.Row="3" BorderBrush="Gray" BorderThickness="1">
<ContentControl Name="EditorControl" Content="{Binding TextViewHost, Mode=OneWay}" Focusable="False"></ContentControl> <ContentControl Name="EditorControl" Content="{Binding TextViewHost, Mode=OneWay}" Focusable="False"></ContentControl>
</Border> </Border>
</Grid> </Grid>
......
...@@ -4,23 +4,29 @@ ...@@ -4,23 +4,29 @@
using System.Linq; using System.Linq;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Navigation;
using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options
{ {
internal partial class GridOptionPreviewControl : AbstractOptionPageControl internal partial class GridOptionPreviewControl : AbstractOptionPageControl
{ {
private const string UseEditorConfigUrl = "https://go.microsoft.com/fwlink/?linkid=866541";
internal AbstractOptionPreviewViewModel ViewModel; internal AbstractOptionPreviewViewModel ViewModel;
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly Func<OptionSet, IServiceProvider, AbstractOptionPreviewViewModel> _createViewModel; private readonly Func<OptionSet, IServiceProvider, AbstractOptionPreviewViewModel> _createViewModel;
public static readonly Uri CodeStylePageHeaderLearnMoreUri = new Uri(UseEditorConfigUrl);
public static string CodeStylePageHeader => ServicesVSResources.Code_style_header_use_editor_config;
public static string CodeStylePageHeaderLearnMoreText => ServicesVSResources.Learn_more;
public static string DescriptionHeader => ServicesVSResources.Description; public static string DescriptionHeader => ServicesVSResources.Description;
public static string PreferenceHeader => ServicesVSResources.Preference; public static string PreferenceHeader => ServicesVSResources.Preference;
public static string SeverityHeader => ServicesVSResources.Severity; public static string SeverityHeader => ServicesVSResources.Severity;
internal GridOptionPreviewControl(IServiceProvider serviceProvider, internal GridOptionPreviewControl(IServiceProvider serviceProvider,
Func<OptionSet, IServiceProvider, Func<OptionSet, IServiceProvider,
AbstractOptionPreviewViewModel> createViewModel) AbstractOptionPreviewViewModel> createViewModel)
: base(serviceProvider) : base(serviceProvider)
{ {
InitializeComponent(); InitializeComponent();
...@@ -29,6 +35,17 @@ internal partial class GridOptionPreviewControl : AbstractOptionPageControl ...@@ -29,6 +35,17 @@ internal partial class GridOptionPreviewControl : AbstractOptionPageControl
_createViewModel = createViewModel; _createViewModel = createViewModel;
} }
private void LearnMoreHyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
if (e.Uri == null)
{
return;
}
BrowserHelper.StartBrowser(e.Uri);
e.Handled = true;
}
private void Options_SelectionChanged(object sender, SelectionChangedEventArgs e) private void Options_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
var dataGrid = (DataGrid)sender; var dataGrid = (DataGrid)sender;
......
...@@ -1100,6 +1100,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi ...@@ -1100,6 +1100,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi
if (token.IsKind(SyntaxKind.RefKeyword) || if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.OutKeyword) || token.IsKind(SyntaxKind.OutKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.ParamsKeyword) || token.IsKind(SyntaxKind.ParamsKeyword) ||
token.IsKind(SyntaxKind.ThisKeyword)) token.IsKind(SyntaxKind.ThisKeyword))
{ {
...@@ -1182,6 +1183,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi ...@@ -1182,6 +1183,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi
token = token.GetPreviousTokenIfTouchingWord(position); token = token.GetPreviousTokenIfTouchingWord(position);
if (token.IsKind(SyntaxKind.RefKeyword) || if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.OutKeyword)) token.IsKind(SyntaxKind.OutKeyword))
{ {
position = token.SpanStart; position = token.SpanStart;
...@@ -2175,8 +2177,10 @@ public static bool IsLabelContext(this SyntaxTree syntaxTree, int position, Canc ...@@ -2175,8 +2177,10 @@ public static bool IsLabelContext(this SyntaxTree syntaxTree, int position, Canc
} }
// Goo(ref | // Goo(ref |
// Goo(bar | // Goo(in |
// Goo(out |
if (token.IsKind(SyntaxKind.RefKeyword) || if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.OutKeyword)) token.IsKind(SyntaxKind.OutKeyword))
{ {
if (token.Parent.IsKind(SyntaxKind.Argument)) if (token.Parent.IsKind(SyntaxKind.Argument))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册