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

F# Shim - Round 2 #35591

Merged
merged 25 commits into from Jun 11, 2019
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6abb12f
Added fsharp shims over document diagnostic analyzers
TIHan May 7, 2019
2b30e72
Added shims for completion and sig help. Also added tests.
TIHan May 8, 2019
59d7621
Moved around internal files. Added shim over InlineRenameService.
TIHan May 8, 2019
181fe00
Starting shim over document highlights service. Added a better way to…
TIHan May 8, 2019
bfcfbf0
Added shim for document highlights service
TIHan May 8, 2019
5d61f32
Added IFSharpDocumentNavigationService
TIHan May 26, 2019
a5b6672
Added IFSharpGoToDefinitionService
TIHan May 26, 2019
39f8214
Added IFSharpNavigationBarItemService
TIHan May 26, 2019
7e26958
Added IFSharpNavigateToSearchService
TIHan May 26, 2019
3668b15
Merging with master
TIHan May 26, 2019
37e0a5b
Added extra glyph case
TIHan May 26, 2019
c72a353
Added FSharpGlyphTags
TIHan May 26, 2019
7489b82
Added FSharpCommentSelectionService
TIHan May 26, 2019
98ff359
Some cleanup. Added FSharpBlockStructureService
TIHan May 26, 2019
f8d89b2
Added some simple statics
TIHan May 26, 2019
c3a33ea
Finishing the last of shims
TIHan May 26, 2019
ab56e24
Getting analyzers to work
TIHan May 28, 2019
10bd52e
Remove folder
TIHan May 28, 2019
b2718c8
Merge remote-tracking branch 'upstream/master' into fsharp-shim-v2
TIHan May 28, 2019
b6e1398
Changes due to feedback
TIHan Jun 6, 2019
00356ad
Merge remote-tracking branch 'upstream/master' into fsharp-shim-v2
TIHan Jun 7, 2019
b0e1cbf
Fixing build
TIHan Jun 7, 2019
76e0634
Still trying to fix build
TIHan Jun 7, 2019
2cf6c11
Fixed guid
TIHan Jun 8, 2019
f0e004e
Fixing build again
TIHan Jun 10, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Added shims for completion and sig help. Also added tests.

  • Loading branch information...
TIHan committed May 8, 2019
commit 2b30e7268458a36bfd5fa451b6e4a237d9e8b39f
@@ -404,6 +404,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Exte
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup.ServiceHub", "src\Setup\DevDivVsix\ServiceHubConfig\Roslyn.VisualStudio.Setup.ServiceHub.csproj", "{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests", "src\Tools\ExternalAccess\FSharpTest\Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj", "{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 4
@@ -1069,6 +1071,10 @@ Global
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.Build.0 = Release|Any CPU
{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1258,6 +1264,7 @@ Global
{FA51A3CB-5174-4D99-B76E-DC31C5361DF3} = {8977A560-45C2-4EC2-A849-97335B382C74}
{DE53934B-7FC1-48A0-85AB-C519FBBD02CF} = {8977A560-45C2-4EC2-A849-97335B382C74}
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5} = {8977A560-45C2-4EC2-A849-97335B382C74}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {604E6B91-7BC0-4126-AE07-D4D2FEFC3D29}
@@ -55,6 +55,7 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.EditorFeatures.Wpf" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Remote.ServiceHub" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.IntegrationTest.Utilities" />
<InternalsVisibleTo Include="Roslyn.Services.Test.Utilities" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.UnitTests" />
@@ -53,7 +53,6 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Remote.ServiceHub" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Editor.UI.Wpf" WorkItem="https://github.com/dotnet/roslyn/issues/35091" />
<InternalsVisibleTo Include="Roslyn.Hosting.Diagnostics" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" />
<!-- BEGIN MONODEVELOP
These MonoDevelop dependencies don't ship with Visual Studio, so can't break our
binary insertions and are exempted from the ExternalAccess adapter assembly policies.
@@ -84,6 +83,7 @@
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.IntegrationTests" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Test.Utilities2" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests" />
<!-- Eventually a bunch of these unit tests should move into Roslyn.Services.Implementation.UnitTests
and this should be removed. -->
<InternalsVisibleTo Include="RoslynETAHost" WorkItem="https://github.com/dotnet/roslyn/issues/35072" />
@@ -37,6 +37,7 @@
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.ExternalDependencyServices" WorkItem="https://github.com/dotnet/roslyn/issues/35085" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.EditorFeatures.Wpf" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.TypeScript.EditorFeatures" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Implementation" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.TypeScript" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
@@ -77,6 +77,7 @@
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Test.Utilities2" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.TypeScript.EditorFeatures" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.TypeScript" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
<InternalsVisibleTo Include="Roslyn.Services.Editor.TypeScript.UnitTests" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
@@ -65,6 +65,7 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Workspaces.UnitTests" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Compilers\Shared\CoreClrAnalyzerAssemblyLoader.cs" />
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal;

namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion
{
internal static class FSharpCommonCompletionItem
{
public static CompletionItem Create(
string displayText,
string displayTextSuffix,
CompletionItemRules rules,
FSharpGlyph? glyph = null,
ImmutableArray<SymbolDisplayPart> description = default,
string sortText = null,
string filterText = null,
bool showsWarningIcon = false,
ImmutableDictionary<string, string> properties = null,
ImmutableArray<string> tags = default,
string inlineDescription = null)
{
var roslynGlyph = glyph.HasValue ? FSharpGlyphHelpers.ConvertTo(glyph.Value) : (Glyph?)null;
return CommonCompletionItem.Create(
displayText, displayTextSuffix, rules, roslynGlyph, description, sortText, filterText, showsWarningIcon, properties, tags, inlineDescription);
}
}
}
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Completion;

namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion
{
internal static class FSharpCommonCompletionProvider
{
public static CompletionProvider Create(IFSharpCommonCompletionProvider fsharpCommonCompletionProvider)
{
return new FSharpInternalCommonCompletionProvider(fsharpCommonCompletionProvider);
}
}
}
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion
{
internal static class FSharpCommonCompletionUtilities
{
public static bool IsStartingNewWord(SourceText text, int characterPosition, Func<char, bool> isWordStartCharacter, Func<char, bool> isWordCharacter)
{
return CommonCompletionUtilities.IsStartingNewWord(text, characterPosition, isWordStartCharacter, isWordCharacter);
}
}
}
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal;

namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion
{
internal class FSharpFileSystemCompletionHelper
{
private readonly FileSystemCompletionHelper _fileSystemCompletionHelper;

public FSharpFileSystemCompletionHelper(
FSharpGlyph folderGlyph,
FSharpGlyph fileGlyph,
ImmutableArray<string> searchPaths,
string baseDirectoryOpt,
ImmutableArray<string> allowableExtensions,
CompletionItemRules itemRules)
{
_fileSystemCompletionHelper =
new FileSystemCompletionHelper(
FSharpGlyphHelpers.ConvertTo(folderGlyph),
FSharpGlyphHelpers.ConvertTo(fileGlyph),
searchPaths,
baseDirectoryOpt,
allowableExtensions,
itemRules);
}

public Task<ImmutableArray<CompletionItem>> GetItemsAsync(string directoryPath, CancellationToken cancellationToken)
{
return _fileSystemCompletionHelper.GetItemsAsync(directoryPath, cancellationToken);
}
}
}
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Completion
{
internal sealed class FSharpInternalCommonCompletionProvider : CommonCompletionProvider
{
private readonly IFSharpCommonCompletionProvider _provider;

public FSharpInternalCommonCompletionProvider(IFSharpCommonCompletionProvider provider)
{
_provider = provider;
}

public override Task ProvideCompletionsAsync(CompletionContext context)
{
return _provider.ProvideCompletionsAsync(context);
}

protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken)
{
return _provider.GetTextChangeAsync(base.GetTextChangeAsync, selectedItem, ch, cancellationToken);
}

internal override bool IsInsertionTrigger(SourceText text, int insertedCharacterPosition, OptionSet options)
{
return _provider.IsInsertionTrigger(text, insertedCharacterPosition, options);
}
}
}
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion
{
internal interface IFSharpCommonCompletionProvider
{
Task ProvideCompletionsAsync(CompletionContext context);

bool IsInsertionTrigger(SourceText text, int insertedCharacterPosition, OptionSet options);

Task<TextChange?> GetTextChangeAsync(
Func<CompletionItem, char?, CancellationToken, Task<TextChange?>> baseGetTextChangeAsync,
CompletionItem selectedItem,
char? ch,
CancellationToken cancellationToken);
}
}
@@ -6,5 +6,6 @@ internal static class FSharpContentTypeNames
{
public const string RoslynContentType = Microsoft.CodeAnalysis.Editor.ContentTypeNames.RoslynContentType;
public const string FSharpContentType = "F#";
public const string FSharpSignatureHelpContentType = "F# Signature Help";
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.