Skip to content

Commit

Permalink
Merge pull request #900 from DustinCampbell/update-roslyn
Browse files Browse the repository at this point in the history
Update Roslyn dependency to 2.3.0-beta2
  • Loading branch information
DustinCampbell authored Jun 29, 2017
2 parents d397668 + 26f501f commit e54c412
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/OmniSharp.Abstractions/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ internal static class Configuration
{
public static bool ZeroBasedIndices = false;

public const string RoslynVersion = "2.1.0.0";
public const string RoslynVersion = "2.3.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";

public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.DotNet/OmniSharp.DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.DotNet.ProjectModel" Version="1.0.0-rc3-1-003177" />
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.500-preview2-1-003177" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.3.0-beta2" />
</ItemGroup>

<!-- Legacy 'dotnet test' support -->
Expand Down
6 changes: 3 additions & 3 deletions src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.3.0-beta2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
Expand Down
25 changes: 18 additions & 7 deletions src/OmniSharp.Roslyn/BufferManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,25 @@ public async Task UpdateBufferAsync(Request request)
return;
}

var documentIds = _workspace.CurrentSolution.GetDocumentIdsWithFilePath(request.FileName);
var solution = _workspace.CurrentSolution;

var documentIds = solution.GetDocumentIdsWithFilePath(request.FileName);
if (!documentIds.IsEmpty)
{
if (changes == null)
{
var sourceText = SourceText.From(buffer);

foreach (var documentId in documentIds)
{
_workspace.OnDocumentChanged(documentId, sourceText);
solution = solution.WithDocumentText(documentId, sourceText);
}
}
else
{
foreach (var documentId in documentIds)
{
var document = _workspace.CurrentSolution.GetDocument(documentId);
var document = solution.GetDocument(documentId);
var sourceText = await document.GetTextAsync();

foreach (var change in request.Changes)
Expand All @@ -66,9 +69,12 @@ public async Task UpdateBufferAsync(Request request)
new TextChange(new TextSpan(startOffset, endOffset - startOffset), change.NewText)
});
}
_workspace.OnDocumentChanged(documentId, sourceText);

solution = solution.WithDocumentText(documentId, sourceText);
}
}

_workspace.TryApplyChanges(solution);
}
else if (buffer != null)
{
Expand All @@ -83,22 +89,27 @@ public async Task UpdateBufferAsync(ChangeBufferRequest request)
return;
}

var documentIds = _workspace.CurrentSolution.GetDocumentIdsWithFilePath(request.FileName);
var solution = _workspace.CurrentSolution;

var documentIds = solution.GetDocumentIdsWithFilePath(request.FileName);
if (!documentIds.IsEmpty)
{
foreach (var documentId in documentIds)
{
var document = _workspace.CurrentSolution.GetDocument(documentId);
var document = solution.GetDocument(documentId);
var sourceText = await document.GetTextAsync();

var startOffset = sourceText.Lines.GetPosition(new LinePosition(request.StartLine, request.StartColumn));
var endOffset = sourceText.Lines.GetPosition(new LinePosition(request.EndLine, request.EndColumn));

sourceText = sourceText.WithChanges(new[] {
new TextChange(new TextSpan(startOffset, endOffset - startOffset), request.NewText)
});

_workspace.OnDocumentChanged(documentId, sourceText);
solution = solution.WithDocumentText(documentId, sourceText);
}

_workspace.TryApplyChanges(solution);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="1.1.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.Script/OmniSharp.Script.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<ItemGroup>
<PackageReference Include="Dotnet.Script.NuGetMetadataResolver" Version="2.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.DotNet.ProjectModel" Version="1.0.0-rc3-1-003177" />
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.2.0" />
Expand Down
4 changes: 2 additions & 2 deletions tests/TestUtility/TestUtility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.3.0-beta2" />
<PackageReference Include="Microsoft.DotNet.ProjectModel" Version="1.0.0-rc3-1-003177" />
<PackageReference Include="Microsoft.DotNet.ProjectModel.Workspaces" Version="1.0.0-preview2-1-003177" />
<PackageReference Include="xunit" Version="2.2.0" />
Expand Down

0 comments on commit e54c412

Please sign in to comment.