Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates included build tool to match the current 6.0.200 sdk #2329

Merged
merged 8 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MicrosoftTestPackageVersion>17.0.0</MicrosoftTestPackageVersion>
<MSBuildPackageVersion>17.0.0</MSBuildPackageVersion>
<NuGetPackageVersion>6.0.0</NuGetPackageVersion>
<RoslynPackageVersion>4.0.1-1.22053.6</RoslynPackageVersion>
<RoslynPackageVersion>4.1.0-3.22069.8</RoslynPackageVersion>
<XunitPackageVersion>2.4.1</XunitPackageVersion>
</PropertyGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/OmniSharp.Http.Driver/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down
10 changes: 5 additions & 5 deletions src/OmniSharp.LanguageServerProtocol/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
using CompletionItem = OmniSharp.Models.v1.Completion.CompletionItem;
using CompletionTriggerKind = OmniSharp.Models.v1.Completion.CompletionTriggerKind;
using CSharpCompletionService = Microsoft.CodeAnalysis.Completion.CompletionService;
using System.Threading;
using Roslyn.Utilities;

namespace OmniSharp.Roslyn.CSharp.Services.Completion
{
Expand Down Expand Up @@ -65,22 +67,25 @@ public async Task<CompletionResponse> Handle(CompletionRequest request)
var position = sourceText.GetTextPosition(request);

var completionService = CSharpCompletionService.GetService(document);
Debug.Assert(request.TriggerCharacter != null || request.CompletionTrigger != CompletionTriggerKind.TriggerCharacter);
RoslynDebug.Assert(completionService != null);
RoslynDebug.Assert(request.TriggerCharacter != null || request.CompletionTrigger != CompletionTriggerKind.TriggerCharacter);

CompletionTrigger trigger = request.CompletionTrigger switch
{
CompletionTriggerKind.TriggerCharacter when request.TriggerCharacter is char c => CompletionTrigger.CreateInsertionTrigger(c),
_ => CompletionTrigger.Invoke,
};

var options = new OmniSharpCompletionOptions(ShowItemsFromUnimportedNamespaces: _omniSharpOptions.RoslynExtensionsOptions.EnableImportCompletion);

if (request.CompletionTrigger == CompletionTriggerKind.TriggerCharacter &&
!completionService.ShouldTriggerCompletion(sourceText, position, trigger))
!await OmniSharpCompletionService.ShouldTriggerCompletionAsync(completionService, document, position, trigger, roles: null, options, CancellationToken.None))
{
_logger.LogTrace("Should not insert completions here.");
return new CompletionResponse { Items = ImmutableArray<CompletionItem>.Empty };
}

var (completions, expandedItemsAvailable) = await OmniSharpCompletionService.GetCompletionsAsync(completionService, document, position, trigger);
var (completions, expandedItemsAvailable) = await OmniSharpCompletionService.GetCompletionsAsync(completionService, document, position, trigger, roles: null, options, CancellationToken.None);
_logger.LogTrace("Found {0} completions for {1}:{2},{3}",
completions?.Items.IsDefaultOrEmpty != false ? 0 : completions.Items.Length,
request.FileName,
Expand Down Expand Up @@ -114,7 +119,7 @@ CompletionListBuilder.PartialMethodCompletionProvider or
// that completion provider is still creating the cache. We'll mark this completion list as not completed, and the
// editor will ask again when the user types more. By then, hopefully the cache will have populated and we can mark
// the completion as done.
bool expectingImportedItems = expandedItemsAvailable && _workspace.Options.GetOption(OmniSharpCompletionService.ShowItemsFromUnimportedNamespaces, LanguageNames.CSharp) == true;
bool expectingImportedItems = expandedItemsAvailable && _omniSharpOptions.RoslynExtensionsOptions.EnableImportCompletion;
var syntax = await document.GetSyntaxTreeAsync();

var replacingSpanStartPosition = sourceText.Lines.GetLinePosition(typedSpan.Start);
Expand Down Expand Up @@ -150,7 +155,7 @@ public async Task<CompletionResolveResponse> Handle(CompletionResolveRequest req
return new CompletionResolveResponse { Item = request.Item };
}

var (_, document, position, completions) = cachedList;
var (_, document, _, completions) = cachedList;
var index = request.Item.Data.Index;

if (request.Item is null
Expand All @@ -169,14 +174,17 @@ public async Task<CompletionResolveResponse> Handle(CompletionResolveRequest req
}

var completionService = CSharpCompletionService.GetService(document);
RoslynDebug.Assert(completionService != null);

var description = await completionService.GetDescriptionAsync(document, lastCompletionItem);
RoslynDebug.Assert(description != null);

var textBuilder = new StringBuilder();
MarkdownHelpers.TaggedTextToMarkdown(description.TaggedParts, textBuilder, _formattingOptions, MarkdownFormat.FirstLineAsCSharp, out _);

request.Item.Documentation = textBuilder.ToString();

string providerName = lastCompletionItem.GetProviderName();
var providerName = lastCompletionItem.GetProviderName();
switch (providerName)
{
case CompletionListBuilder.ExtensionMethodImportCompletionProvider:
Expand Down Expand Up @@ -243,6 +251,7 @@ public async Task<CompletionAfterInsertResponse> Handle(CompletionAfterInsertReq
}

var completionService = CSharpCompletionService.GetService(document);
RoslynDebug.Assert(completionService != null);

// Get a document with change from the completion inserted, so that we can resolve the completion and get the
// final full change.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ public async Task<BlockStructureResponse> Handle(BlockStructureRequest request)

var text = await document.GetTextAsync();

var structure = await OmniSharpBlockStructureService.GetBlockStructureAsync(document, CancellationToken.None);
var options = new OmniSharpBlockStructureOptions(
ShowBlockStructureGuidesForCommentsAndPreprocessorRegions: true,
ShowOutliningForCommentsAndPreprocessorRegions: true);

var structure = await OmniSharpBlockStructureService.GetBlockStructureAsync(document, options, CancellationToken.None);

var outliningSpans = new List<CodeFoldingBlock>();
foreach (var span in structure.Spans)
Expand Down
28 changes: 28 additions & 0 deletions src/OmniSharp.Roslyn/Utilities/Debug.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace Roslyn.Utilities
{
internal static class RoslynDebug
{
/// <inheritdoc cref="Debug.Assert(bool)"/>
[Conditional("DEBUG")]
public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b);

/// <inheritdoc cref="Debug.Assert(bool, string)"/>
[Conditional("DEBUG")]
public static void Assert([DoesNotReturnIf(false)] bool b, string message)
=> Debug.Assert(b, message);

[Conditional("DEBUG")]
public static void AssertNotNull<T>([NotNull] T value)
{
Assert(value is object, "Unexpected null reference");
}
}
}
Loading