未验证 提交 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)
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
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).ConvertedType.ToTestDisplayString());
var right = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Assert.Equal(@"new C()", right.ToString());
......@@ -2392,10 +2393,10 @@ class C
{
static void Main()
{
int x;
long x;
string y, z;
(x, (y, z)) = (1, (""a"", ""b""));
(x, (y, z)) = ((int)1, (""a"", ""b""));
System.Console.WriteLine(x + "" "" + y + "" "" + z);
}
}
......@@ -2409,7 +2410,8 @@ static void Main()
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
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);
......@@ -2906,11 +2908,13 @@ static void Main()
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
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).ConvertedType.ToTestDisplayString());
Assert.Null(model.GetSymbolInfo(lhs).Symbol);
var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1);
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).ConvertedType.ToTestDisplayString());
Assert.Null(model.GetSymbolInfo(lhsNested).Symbol);
var x1 = GetDeconstructionVariable(tree, "x1");
......@@ -2954,6 +2958,7 @@ static void Main()
var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
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).ConvertedType.ToTestDisplayString());
Assert.Null(model.GetSymbolInfo(lhs).Symbol);
var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(2);
......
......@@ -371,6 +371,15 @@ public void GetBasePipeNameSlashes()
Assert.Equal(name, BuildServerConnection.GetBasePipeName(path + 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)
return null;
}
return $"{userName}.{isAdmin}.{basePipeName}";
return $"{userName}.{(isAdmin ? 'T' : 'F')}.{basePipeName}";
}
internal static string GetBasePipeName(string compilerExeDirectory)
......@@ -559,6 +559,7 @@ internal static string GetBasePipeName(string compilerExeDirectory)
{
var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(compilerExeDirectory));
basePipeName = Convert.ToBase64String(bytes)
.Substring(0, 25) // We only have ~50 total characters on Mac, so strip this down
.Replace("/", "_")
.Replace("=", string.Empty);
}
......
......@@ -1924,6 +1924,56 @@ void M()
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")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task NestedType1()
......
......@@ -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>
/// Looks up a localized string similar to prefer auto properties.
/// </summary>
......
......@@ -1013,4 +1013,7 @@ I agree to all of the foregoing:</value>
<value>Disabling the extension '{0}' unbound your keyboard bindings.</value>
<comment>0 is an extension name</comment>
</data>
</root>
\ No newline at end of file
<data name="Code_style_header_use_editor_config" xml:space="preserve">
<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>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ Ich stimme allen vorstehenden Bedingungen zu:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ Estoy de acuerdo con todo lo anterior:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -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>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ L'utente accetta le condizioni sopra riportate:</target>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -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>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -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>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -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>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -1493,6 +1493,11 @@ I agree to all of the foregoing:</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</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>
</file>
</xliff>
\ No newline at end of file
......@@ -5,7 +5,7 @@
xmlns:converters="clr-namespace:Microsoft.VisualStudio.LanguageServices.Implementation.Options.Converters"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:options="clr-namespace:Microsoft.VisualStudio.LanguageServices.Implementation.Options"
xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
......@@ -21,9 +21,9 @@
<Setter.Value>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="IsTabStop"
Value="{Binding
Path=Column,
<Setter Property="IsTabStop"
Value="{Binding
Path=Column,
Converter={StaticResource ColumnToTabStopConverter},
RelativeSource={RelativeSource Self}}"/>
</Style>
......@@ -35,12 +35,20 @@
<converters:MarginConverter x:Key="MarginConverter" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="5" />
<RowDefinition Height="*" />
</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
Grid.Row="0"
Grid.Row="1"
x:Uid="CodeStyleContent"
x:Name="CodeStyleMembers"
Margin="0,5,0,0"
......@@ -88,7 +96,7 @@
</DataGrid.GroupStyle>
<DataGrid.Columns>
<DataGridTemplateColumn
x:Name="description"
x:Name="description"
Header="{x:Static local:GridOptionPreviewControl.DescriptionHeader}"
Width="4.5*"
IsReadOnly="True">
......@@ -106,8 +114,8 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
x:Name="preference"
<DataGridTemplateColumn
x:Name="preference"
Header="{x:Static local:GridOptionPreviewControl.PreferenceHeader}"
Width="3*">
<DataGridTemplateColumn.CellTemplate>
......@@ -115,7 +123,7 @@
<ComboBox
ItemsSource="{Binding Preferences}"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedPreference, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedPreference, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Left">
<ComboBox.ItemContainerStyle>
......@@ -127,8 +135,8 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
x:Name="severity"
<DataGridTemplateColumn
x:Name="severity"
Header="{x:Static local:GridOptionPreviewControl.SeverityHeader}"
Width="2.5*">
<DataGridTemplateColumn.CellTemplate>
......@@ -147,12 +155,12 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<imaging:CrispImage
Height="16"
Width="16"
Height="16"
Width="16"
Moniker="{Binding Moniker}"
Grid.Column="0"/>
<TextBlock
Margin="5, 0, 0, 0"
<TextBlock
Margin="5, 0, 0, 0"
Text="{Binding Notification}"
Grid.Column="1"/>
</Grid>
......@@ -169,8 +177,8 @@
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch"></GridSplitter>
<Border Grid.Row="2" BorderBrush="Gray" BorderThickness="1">
<GridSplitter Grid.Row="2" HorizontalAlignment="Stretch"></GridSplitter>
<Border Grid.Row="3" BorderBrush="Gray" BorderThickness="1">
<ContentControl Name="EditorControl" Content="{Binding TextViewHost, Mode=OneWay}" Focusable="False"></ContentControl>
</Border>
</Grid>
......
......@@ -4,23 +4,29 @@
using System.Linq;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Navigation;
using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options
{
internal partial class GridOptionPreviewControl : AbstractOptionPageControl
{
private const string UseEditorConfigUrl = "https://go.microsoft.com/fwlink/?linkid=866541";
internal AbstractOptionPreviewViewModel ViewModel;
private readonly IServiceProvider _serviceProvider;
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 PreferenceHeader => ServicesVSResources.Preference;
public static string SeverityHeader => ServicesVSResources.Severity;
internal GridOptionPreviewControl(IServiceProvider serviceProvider,
Func<OptionSet, IServiceProvider,
AbstractOptionPreviewViewModel> createViewModel)
internal GridOptionPreviewControl(IServiceProvider serviceProvider,
Func<OptionSet, IServiceProvider,
AbstractOptionPreviewViewModel> createViewModel)
: base(serviceProvider)
{
InitializeComponent();
......@@ -29,6 +35,17 @@ internal partial class GridOptionPreviewControl : AbstractOptionPageControl
_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)
{
var dataGrid = (DataGrid)sender;
......
......@@ -1100,6 +1100,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi
if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.OutKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.ParamsKeyword) ||
token.IsKind(SyntaxKind.ThisKeyword))
{
......@@ -1182,6 +1183,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi
token = token.GetPreviousTokenIfTouchingWord(position);
if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.OutKeyword))
{
position = token.SpanStart;
......@@ -2175,8 +2177,10 @@ public static bool IsLabelContext(this SyntaxTree syntaxTree, int position, Canc
}
// Goo(ref |
// Goo(bar |
// Goo(in |
// Goo(out |
if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.OutKeyword))
{
if (token.Parent.IsKind(SyntaxKind.Argument))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册