From 0d44ad1adbc96c99cd64ab1eededea5d6afd0edf Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 11 Jun 2019 10:44:00 -0700 Subject: [PATCH] F# Shim - Round 2 (#35591) * Added fsharp shims over document diagnostic analyzers * Added shims for completion and sig help. Also added tests. * Moved around internal files. Added shim over InlineRenameService. * Starting shim over document highlights service. Added a better way to handle diagnostics * Added shim for document highlights service * Added IFSharpDocumentNavigationService * Added IFSharpGoToDefinitionService * Added IFSharpNavigationBarItemService * Added IFSharpNavigateToSearchService * Added extra glyph case * Added FSharpGlyphTags * Added FSharpCommentSelectionService * Some cleanup. Added FSharpBlockStructureService * Added some simple statics * Finishing the last of shims * Getting analyzers to work * Remove folder * Changes due to feedback * Fixing build * Still trying to fix build * Fixed guid * Fixing build again --- Roslyn.sln | 7 + ...oft.CodeAnalysis.EditorFeatures.Wpf.csproj | 2 +- ...crosoft.CodeAnalysis.EditorFeatures.csproj | 3 +- ...ft.CodeAnalysis.EditorFeatures.Text.csproj | 3 +- .../Microsoft.CodeAnalysis.Features.csproj | 2 +- .../Portable/Roslyn.Test.Utilities.csproj | 1 + .../Completion/FSharpCommonCompletionItem.cs | 29 + .../FSharpCommonCompletionProvider.cs | 15 + .../FSharpCommonCompletionUtilities.cs | 16 + .../FSharpFileSystemCompletionHelper.cs | 38 + .../IFSharpCommonCompletionProvider.cs | 24 + .../Diagnostics/FSharpDiagnosticCustomTags.cs | 2 - .../Diagnostics/FSharpIDEDiagnosticIds.cs | 12 + .../IFSharpDocumentDiagnosticAnalyzer.cs | 15 + .../IFSharpProjectDiagnosticAnalyzer.cs | 13 + .../IFSharpSimplifyNameDiagnosticAnalyzer.cs | 13 + ...arpUnusedDeclarationsDiagnosticAnalyzer.cs | 13 + .../IFSharpUnusedOpensDiagnosticAnalyzer.cs | 13 + .../IFSharpDocumentHighlightsService.cs | 51 ++ .../FSharp/Editor/FSharpContentTypeNames.cs | 1 + .../FSharp/Editor/FSharpNavigationBarItem.cs | 40 ++ .../IFSharpEditorInlineRenameService.cs | 178 +++++ .../Editor/IFSharpGoToDefinitionService.cs | 24 + .../Editor/IFSharpNavigationBarItemService.cs | 13 + .../FSharpDependencyObjectExtensions.cs | 22 + .../ExternalAccessFSharpResources.Designer.cs | 288 ++++++++ .../FSharp/ExternalAccessFSharpResources.resx | 195 +++++ .../FSharp/FSharpEditorFeaturesResources.cs | 11 + .../ExternalAccess/FSharp/FSharpGlyph.cs | 3 +- .../FSharp/FSharpGlyphHelpers.cs | 316 -------- .../FSharp/FSharpGlyphHelpersObsolete.cs | 321 --------- .../ExternalAccess/FSharp/FSharpGlyphTags.cs | 15 + .../FSharpClassificationService.cs | 0 .../FSharpCommentSelectionService.cs | 32 + .../FSharpInternalCommonCompletionProvider.cs | 36 + .../FSharpDiagnosticAnalyzerService.cs | 0 .../FSharpDocumentDiagnosticAnalyzer.cs | 96 +++ .../FSharpProjectDiagnosticAnalyzer.cs | 57 ++ .../FSharpSimplifyNameDiagnosticAnalyzer.cs | 74 ++ .../FSharpUnusedDeclarationsAnalyzer.cs | 76 ++ .../FSharpUnusedOpensDiagnosticAnalyzer.cs | 74 ++ .../FSharpDocumentHighlightsService.cs | 74 ++ .../Editor/FSharpBraceMatcher.cs | 0 .../FSharpContentTypeLanguageService.cs | 4 +- .../Editor/FSharpEditorFormattingService.cs | 0 .../Editor/FSharpEditorInlineRenameService.cs | 173 +++++ .../Editor/FSharpGoToDefinitionService.cs | 41 ++ .../Editor/FSharpNavigationBarItemService.cs | 91 +++ .../FSharpSynchronousIndentationService.cs | 0 .../FindUsages/FSharpFindUsagesContext.cs | 0 .../FindUsages/FSharpFindUsagesService.cs | 0 .../FSharpBreakpointResolutionService.cs | 0 .../FSharpLanguageDebugInfoService.cs | 0 .../Internal/FSharpContentTypeDefinitions.cs | 21 + .../FSharp/Internal/FSharpGlyphHelpers.cs | 640 +++++++++++++++++ .../FSharpNavigateToMatchKindHelpers.cs | 67 ++ .../FSharpNavigateToSearchService.cs | 43 ++ .../InternalFSharpNavigateToSearchResult.cs | 41 ++ .../Navigation/InternalFSharpNavigableItem.cs | 34 + .../FSharpSignatureHelpProvider.cs | 68 ++ ...FSharpSignatureHelpTriggerReasonHelpers.cs | 38 + .../Structure/FSharpBlockStructureService.cs | 34 + .../FSharpSignatureHelpClassifierProvider.cs | 33 + ....CodeAnalysis.ExternalAccess.FSharp.csproj | 17 +- .../NavigateTo/FSharpNavigateToItemKind.cs | 25 + .../NavigateTo/FSharpNavigateToMatchKind.cs | 19 + .../FSharpNavigateToSearchResult.cs | 33 + .../IFSharpNavigateToSearchService.cs | 24 + .../FSharpDocumentNavigationService.cs | 68 ++ .../FSharp/Navigation/FSharpNavigableItem.cs | 26 + .../Navigation/FSharpNavigationOptions.cs | 12 + .../IFSharpDocumentNavigationService.cs | 41 ++ .../SignatureHelp/FSharpSignatureHelpItem.cs | 80 +++ .../SignatureHelp/FSharpSignatureHelpItems.cs | 103 +++ .../FSharpSignatureHelpParameter.cs | 88 +++ .../FSharpSignatureHelpTriggerInfo.cs | 19 + .../FSharpSignatureHelpTriggerReason.cs | 22 + .../IFSharpSignatureHelpProvider.cs | 27 + .../FSharp/Structure/FSharpBlockSpan.cs | 68 ++ .../FSharp/Structure/FSharpBlockStructure.cs | 16 + .../FSharp/Structure/FSharpBlockTypes.cs | 29 + .../Structure/IFSharpBlockStructureService.cs | 12 + .../xlf/ExternalAccessFSharpResources.cs.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.de.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.es.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.fr.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.it.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.ja.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.ko.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.pl.xlf | 132 ++++ .../ExternalAccessFSharpResources.pt-BR.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.ru.xlf | 132 ++++ .../xlf/ExternalAccessFSharpResources.tr.xlf | 132 ++++ .../ExternalAccessFSharpResources.zh-Hans.xlf | 132 ++++ .../ExternalAccessFSharpResources.zh-Hant.xlf | 132 ++++ .../FSharpTest/FSharpGlyphTests.cs | 677 ++++++++++++++++++ .../FSharpHighlightSpanKindTests.cs | 63 ++ .../FSharpInlineRenameReplacementKindTests.cs | 68 ++ .../FSharpNavigateToMatchKindTests.cs | 87 +++ .../FSharpSignatureHelpTriggerReasonTests.cs | 58 ++ ...sis.ExternalAccess.FSharp.UnitTests.csproj | 55 ++ ...osoft.VisualStudio.LanguageServices.csproj | 1 + ...dio.LanguageServices.Implementation.csproj | 1 + .../Setup/source.extension.vsixmanifest | 1 + .../Microsoft.CodeAnalysis.Workspaces.csproj | 2 +- 105 files changed, 6354 insertions(+), 650 deletions(-) create mode 100644 src/Tools/ExternalAccess/FSharp/Completion/FSharpCommonCompletionItem.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Completion/FSharpCommonCompletionProvider.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Completion/FSharpCommonCompletionUtilities.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Completion/FSharpFileSystemCompletionHelper.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Completion/IFSharpCommonCompletionProvider.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Diagnostics/FSharpIDEDiagnosticIds.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Diagnostics/IFSharpDocumentDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Diagnostics/IFSharpProjectDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Diagnostics/IFSharpSimplifyNameDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Diagnostics/IFSharpUnusedDeclarationsDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Diagnostics/IFSharpUnusedOpensDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/DocumentHighlighting/IFSharpDocumentHighlightsService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Editor/FSharpNavigationBarItem.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Editor/IFSharpEditorInlineRenameService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Editor/IFSharpGoToDefinitionService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Editor/IFSharpNavigationBarItemService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Editor/Shared/Extensions/FSharpDependencyObjectExtensions.cs create mode 100644 src/Tools/ExternalAccess/FSharp/ExternalAccessFSharpResources.Designer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/ExternalAccessFSharpResources.resx create mode 100644 src/Tools/ExternalAccess/FSharp/FSharpEditorFeaturesResources.cs delete mode 100644 src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpers.cs delete mode 100644 src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpersObsolete.cs create mode 100644 src/Tools/ExternalAccess/FSharp/FSharpGlyphTags.cs rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Classification/FSharpClassificationService.cs (100%) create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/CommentSelection/FSharpCommentSelectionService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Completion/FSharpInternalCommonCompletionProvider.cs rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Diagnostics/FSharpDiagnosticAnalyzerService.cs (100%) create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpDocumentDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpProjectDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpSimplifyNameDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedDeclarationsAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedOpensDiagnosticAnalyzer.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/DocumentHighlighting/FSharpDocumentHighlightsService.cs rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/FSharpBraceMatcher.cs (100%) rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/FSharpContentTypeLanguageService.cs (80%) rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/FSharpEditorFormattingService.cs (100%) create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpGoToDefinitionService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpNavigationBarItemService.cs rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/FSharpSynchronousIndentationService.cs (100%) rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/FindUsages/FSharpFindUsagesContext.cs (100%) rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/FindUsages/FSharpFindUsagesService.cs (100%) rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/Implementation/Debugging/FSharpBreakpointResolutionService.cs (100%) rename src/Tools/ExternalAccess/FSharp/{ => Internal}/Editor/Implementation/Debugging/FSharpLanguageDebugInfoService.cs (100%) create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/FSharpContentTypeDefinitions.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/FSharpGlyphHelpers.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToMatchKindHelpers.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToSearchService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/InternalFSharpNavigateToSearchResult.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Navigation/InternalFSharpNavigableItem.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpTriggerReasonHelpers.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/Structure/FSharpBlockStructureService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/Text/Classification/FSharpSignatureHelpClassifierProvider.cs create mode 100644 src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToItemKind.cs create mode 100644 src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToMatchKind.cs create mode 100644 src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToSearchResult.cs create mode 100644 src/Tools/ExternalAccess/FSharp/NavigateTo/IFSharpNavigateToSearchService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigableItem.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigationOptions.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItem.cs create mode 100644 src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItems.cs create mode 100644 src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpParameter.cs create mode 100644 src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerInfo.cs create mode 100644 src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerReason.cs create mode 100644 src/Tools/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockSpan.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockStructure.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockTypes.cs create mode 100644 src/Tools/ExternalAccess/FSharp/Structure/IFSharpBlockStructureService.cs create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.cs.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.de.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.es.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.fr.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.it.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ja.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ko.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pl.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pt-BR.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ru.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.tr.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hans.xlf create mode 100644 src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hant.xlf create mode 100644 src/Tools/ExternalAccess/FSharpTest/FSharpGlyphTests.cs create mode 100644 src/Tools/ExternalAccess/FSharpTest/FSharpHighlightSpanKindTests.cs create mode 100644 src/Tools/ExternalAccess/FSharpTest/FSharpInlineRenameReplacementKindTests.cs create mode 100644 src/Tools/ExternalAccess/FSharpTest/FSharpNavigateToMatchKindTests.cs create mode 100644 src/Tools/ExternalAccess/FSharpTest/FSharpSignatureHelpTriggerReasonTests.cs create mode 100644 src/Tools/ExternalAccess/FSharpTest/Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj diff --git a/Roslyn.sln b/Roslyn.sln index 8f41829d9aff5..d8933bfa2a311 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests", "src\Tools\ExternalAccess\FSharpTest\Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj", "{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Apex", "src\Tools\ExternalAccess\Apex\Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj", "{FC32EF16-31B1-47B3-B625-A80933CB3F29}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.CodeLens", "src\Tools\ExternalAccess\CodeLens\Microsoft.CodeAnalysis.ExternalAccess.CodeLens.csproj", "{D5B1328C-A9EF-4E55-93D7-B8455855709A}" @@ -1081,6 +1083,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 {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -1294,6 +1300,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} {FC32EF16-31B1-47B3-B625-A80933CB3F29} = {8977A560-45C2-4EC2-A849-97335B382C74} {D5B1328C-A9EF-4E55-93D7-B8455855709A} = {8977A560-45C2-4EC2-A849-97335B382C74} {BDB3414C-35F8-4E2D-8603-DE9CF259540F} = {8977A560-45C2-4EC2-A849-97335B382C74} diff --git a/src/EditorFeatures/Core.Wpf/Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj b/src/EditorFeatures/Core.Wpf/Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj index 5fbffff1ef1db..e4a9aee23458d 100644 --- a/src/EditorFeatures/Core.Wpf/Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj +++ b/src/EditorFeatures/Core.Wpf/Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj @@ -54,8 +54,8 @@ - + diff --git a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj index 3a9e186e8eccf..7bc6375471faa 100644 --- a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj +++ b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj @@ -52,7 +52,6 @@ - @@ -99,7 +99,6 @@ - diff --git a/src/EditorFeatures/Text/Microsoft.CodeAnalysis.EditorFeatures.Text.csproj b/src/EditorFeatures/Text/Microsoft.CodeAnalysis.EditorFeatures.Text.csproj index e25c05bd3f397..2a2fa907ce83b 100644 --- a/src/EditorFeatures/Text/Microsoft.CodeAnalysis.EditorFeatures.Text.csproj +++ b/src/EditorFeatures/Text/Microsoft.CodeAnalysis.EditorFeatures.Text.csproj @@ -36,6 +36,7 @@ + @@ -50,8 +51,6 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add an assembly reference to '{0}' + + + Add 'new' keyword + + + Add a project reference to '{0}' + + + Cannot determine the symbol under the caret + + + Cannot navigate to the requested location + + + Exceptions: + + + F# Disposable Types + + + F# Functions / Methods + + + F# Mutable Variables / Reference Cells + + + F# Printf Format + + + F# Properties + + + Generic parameters: + + + Implement interface + + + Implement interface without type annotation + + + Locating the symbol under the caret... + + + Name can be simplified. + + + Navigate to symbol failed: {0} + + + Navigating to symbol... + + + Prefix '{0}' with underscore + + + Remove unused open declarations + + + Rename '{0}' to '__' + + + Rename '{0}' to '_' + + + Simplify name + + + The value is unused + + + Open declaration can be removed. + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/FSharpEditorFeaturesResources.cs b/src/Tools/ExternalAccess/FSharp/FSharpEditorFeaturesResources.cs new file mode 100644 index 0000000000000..48f3364411f0d --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/FSharpEditorFeaturesResources.cs @@ -0,0 +1,11 @@ +// 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.Editor; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp +{ + internal static class FSharpEditorFeaturesResources + { + public static string You_cannot_rename_this_element => EditorFeaturesResources.You_cannot_rename_this_element; + } +} diff --git a/src/Tools/ExternalAccess/FSharp/FSharpGlyph.cs b/src/Tools/ExternalAccess/FSharp/FSharpGlyph.cs index 135429c4b8d9d..072aa115012b0 100644 --- a/src/Tools/ExternalAccess/FSharp/FSharpGlyph.cs +++ b/src/Tools/ExternalAccess/FSharp/FSharpGlyph.cs @@ -109,6 +109,7 @@ internal enum FSharpGlyph CompletionWarning, AddReference, - NuGet + NuGet, + TargetTypeMatch } } diff --git a/src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpers.cs b/src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpers.cs deleted file mode 100644 index 2f1f1a17d7201..0000000000000 --- a/src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpers.cs +++ /dev/null @@ -1,316 +0,0 @@ -namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal -{ - internal static class GlyphHelpers - { - public static FSharpGlyph Convert(Microsoft.CodeAnalysis.Glyph glyph) - { - switch (glyph) - { - case Microsoft.CodeAnalysis.Glyph.None: - { - return FSharpGlyph.None; - } - case Microsoft.CodeAnalysis.Glyph.Assembly: - { - return FSharpGlyph.Assembly; - } - case Microsoft.CodeAnalysis.Glyph.BasicFile: - { - return FSharpGlyph.BasicFile; - } - case Microsoft.CodeAnalysis.Glyph.BasicProject: - { - return FSharpGlyph.BasicProject; - } - case Microsoft.CodeAnalysis.Glyph.ClassPublic: - { - return FSharpGlyph.ClassPublic; - } - case Microsoft.CodeAnalysis.Glyph.ClassProtected: - { - return FSharpGlyph.ClassProtected; - } - case Microsoft.CodeAnalysis.Glyph.ClassPrivate: - { - return FSharpGlyph.ClassPrivate; - } - case Microsoft.CodeAnalysis.Glyph.ClassInternal: - { - return FSharpGlyph.ClassInternal; - } - case Microsoft.CodeAnalysis.Glyph.CSharpFile: - { - return FSharpGlyph.CSharpFile; - } - case Microsoft.CodeAnalysis.Glyph.CSharpProject: - { - return FSharpGlyph.CSharpProject; - } - case Microsoft.CodeAnalysis.Glyph.ConstantPublic: - { - return FSharpGlyph.ConstantPublic; - } - case Microsoft.CodeAnalysis.Glyph.ConstantProtected: - { - return FSharpGlyph.ConstantProtected; - } - case Microsoft.CodeAnalysis.Glyph.ConstantPrivate: - { - return FSharpGlyph.ConstantPrivate; - } - case Microsoft.CodeAnalysis.Glyph.ConstantInternal: - { - return FSharpGlyph.ConstantInternal; - } - case Microsoft.CodeAnalysis.Glyph.DelegatePublic: - { - return FSharpGlyph.DelegatePublic; - } - case Microsoft.CodeAnalysis.Glyph.DelegateProtected: - { - return FSharpGlyph.DelegateProtected; - } - case Microsoft.CodeAnalysis.Glyph.DelegatePrivate: - { - return FSharpGlyph.DelegatePrivate; - } - case Microsoft.CodeAnalysis.Glyph.DelegateInternal: - { - return FSharpGlyph.DelegateInternal; - } - case Microsoft.CodeAnalysis.Glyph.EnumPublic: - { - return FSharpGlyph.EnumPublic; - } - case Microsoft.CodeAnalysis.Glyph.EnumProtected: - { - return FSharpGlyph.EnumProtected; - } - case Microsoft.CodeAnalysis.Glyph.EnumPrivate: - { - return FSharpGlyph.EnumPrivate; - } - case Microsoft.CodeAnalysis.Glyph.EnumInternal: - { - return FSharpGlyph.EnumInternal; - } - case Microsoft.CodeAnalysis.Glyph.EnumMemberPublic: - { - return FSharpGlyph.EnumMemberPublic; - } - case Microsoft.CodeAnalysis.Glyph.EnumMemberProtected: - { - return FSharpGlyph.EnumMemberProtected; - } - case Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate: - { - return FSharpGlyph.EnumMemberPrivate; - } - case Microsoft.CodeAnalysis.Glyph.EnumMemberInternal: - { - return FSharpGlyph.EnumMemberInternal; - } - case Microsoft.CodeAnalysis.Glyph.Error: - { - return FSharpGlyph.Error; - } - case Microsoft.CodeAnalysis.Glyph.StatusInformation: - { - return FSharpGlyph.StatusInformation; - } - case Microsoft.CodeAnalysis.Glyph.EventPublic: - { - return FSharpGlyph.EventPublic; - } - case Microsoft.CodeAnalysis.Glyph.EventProtected: - { - return FSharpGlyph.EventProtected; - } - case Microsoft.CodeAnalysis.Glyph.EventPrivate: - { - return FSharpGlyph.EventPrivate; - } - case Microsoft.CodeAnalysis.Glyph.EventInternal: - { - return FSharpGlyph.EventInternal; - } - case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic: - { - return FSharpGlyph.ExtensionMethodPublic; - } - case Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected: - { - return FSharpGlyph.ExtensionMethodProtected; - } - case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate: - { - return FSharpGlyph.ExtensionMethodPrivate; - } - case Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal: - { - return FSharpGlyph.ExtensionMethodInternal; - } - case Microsoft.CodeAnalysis.Glyph.FieldPublic: - { - return FSharpGlyph.FieldPublic; - } - case Microsoft.CodeAnalysis.Glyph.FieldProtected: - { - return FSharpGlyph.FieldProtected; - } - case Microsoft.CodeAnalysis.Glyph.FieldPrivate: - { - return FSharpGlyph.FieldPrivate; - } - case Microsoft.CodeAnalysis.Glyph.FieldInternal: - { - return FSharpGlyph.FieldInternal; - } - case Microsoft.CodeAnalysis.Glyph.InterfacePublic: - { - return FSharpGlyph.InterfacePublic; - } - case Microsoft.CodeAnalysis.Glyph.InterfaceProtected: - { - return FSharpGlyph.InterfaceProtected; - } - case Microsoft.CodeAnalysis.Glyph.InterfacePrivate: - { - return FSharpGlyph.InterfacePrivate; - } - case Microsoft.CodeAnalysis.Glyph.InterfaceInternal: - { - return FSharpGlyph.InterfaceInternal; - } - case Microsoft.CodeAnalysis.Glyph.Intrinsic: - { - return FSharpGlyph.Intrinsic; - } - case Microsoft.CodeAnalysis.Glyph.Keyword: - { - return FSharpGlyph.Keyword; - } - case Microsoft.CodeAnalysis.Glyph.Label: - { - return FSharpGlyph.Label; - } - case Microsoft.CodeAnalysis.Glyph.Local: - { - return FSharpGlyph.Local; - } - case Microsoft.CodeAnalysis.Glyph.Namespace: - { - return FSharpGlyph.Namespace; - } - case Microsoft.CodeAnalysis.Glyph.MethodPublic: - { - return FSharpGlyph.MethodPublic; - } - case Microsoft.CodeAnalysis.Glyph.MethodProtected: - { - return FSharpGlyph.MethodProtected; - } - case Microsoft.CodeAnalysis.Glyph.MethodPrivate: - { - return FSharpGlyph.MethodPrivate; - } - case Microsoft.CodeAnalysis.Glyph.MethodInternal: - { - return FSharpGlyph.MethodInternal; - } - case Microsoft.CodeAnalysis.Glyph.ModulePublic: - { - return FSharpGlyph.ModulePublic; - } - case Microsoft.CodeAnalysis.Glyph.ModuleProtected: - { - return FSharpGlyph.ModuleProtected; - } - case Microsoft.CodeAnalysis.Glyph.ModulePrivate: - { - return FSharpGlyph.ModulePrivate; - } - case Microsoft.CodeAnalysis.Glyph.ModuleInternal: - { - return FSharpGlyph.ModuleInternal; - } - case Microsoft.CodeAnalysis.Glyph.OpenFolder: - { - return FSharpGlyph.OpenFolder; - } - case Microsoft.CodeAnalysis.Glyph.Operator: - { - return FSharpGlyph.Operator; - } - case Microsoft.CodeAnalysis.Glyph.Parameter: - { - return FSharpGlyph.Parameter; - } - case Microsoft.CodeAnalysis.Glyph.PropertyPublic: - { - return FSharpGlyph.PropertyPublic; - } - case Microsoft.CodeAnalysis.Glyph.PropertyProtected: - { - return FSharpGlyph.PropertyProtected; - } - case Microsoft.CodeAnalysis.Glyph.PropertyPrivate: - { - return FSharpGlyph.PropertyPrivate; - } - case Microsoft.CodeAnalysis.Glyph.PropertyInternal: - { - return FSharpGlyph.PropertyInternal; - } - case Microsoft.CodeAnalysis.Glyph.RangeVariable: - { - return FSharpGlyph.RangeVariable; - } - case Microsoft.CodeAnalysis.Glyph.Reference: - { - return FSharpGlyph.Reference; - } - case Microsoft.CodeAnalysis.Glyph.StructurePublic: - { - return FSharpGlyph.StructurePublic; - } - case Microsoft.CodeAnalysis.Glyph.StructureProtected: - { - return FSharpGlyph.StructureProtected; - } - case Microsoft.CodeAnalysis.Glyph.StructurePrivate: - { - return FSharpGlyph.StructurePrivate; - } - case Microsoft.CodeAnalysis.Glyph.StructureInternal: - { - return FSharpGlyph.StructureInternal; - } - case Microsoft.CodeAnalysis.Glyph.TypeParameter: - { - return FSharpGlyph.TypeParameter; - } - case Microsoft.CodeAnalysis.Glyph.Snippet: - { - return FSharpGlyph.Snippet; - } - case Microsoft.CodeAnalysis.Glyph.CompletionWarning: - { - return FSharpGlyph.CompletionWarning; - } - case Microsoft.CodeAnalysis.Glyph.AddReference: - { - return FSharpGlyph.AddReference; - } - case Microsoft.CodeAnalysis.Glyph.NuGet: - { - return FSharpGlyph.NuGet; - } - default: - { - return FSharpGlyph.None; - } - } - } - } -} diff --git a/src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpersObsolete.cs b/src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpersObsolete.cs deleted file mode 100644 index 79d013b7bb133..0000000000000 --- a/src/Tools/ExternalAccess/FSharp/FSharpGlyphHelpersObsolete.cs +++ /dev/null @@ -1,321 +0,0 @@ -// 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; - -namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp -{ - internal static class FSharpGlyphHelpersObsolete - { - [Obsolete("Only used to allow IVTs to work temporarily, will be removed when IVTs are fully removed.")] - public static Microsoft.CodeAnalysis.Glyph Convert(FSharpGlyph glyph) - { - switch (glyph) - { - case FSharpGlyph.None: - { - return Microsoft.CodeAnalysis.Glyph.None; - } - case FSharpGlyph.Assembly: - { - return Microsoft.CodeAnalysis.Glyph.Assembly; - } - case FSharpGlyph.BasicFile: - { - return Microsoft.CodeAnalysis.Glyph.BasicFile; - } - case FSharpGlyph.BasicProject: - { - return Microsoft.CodeAnalysis.Glyph.BasicProject; - } - case FSharpGlyph.ClassPublic: - { - return Microsoft.CodeAnalysis.Glyph.ClassPublic; - } - case FSharpGlyph.ClassProtected: - { - return Microsoft.CodeAnalysis.Glyph.ClassProtected; - } - case FSharpGlyph.ClassPrivate: - { - return Microsoft.CodeAnalysis.Glyph.ClassPrivate; - } - case FSharpGlyph.ClassInternal: - { - return Microsoft.CodeAnalysis.Glyph.ClassInternal; - } - case FSharpGlyph.CSharpFile: - { - return Microsoft.CodeAnalysis.Glyph.CSharpFile; - } - case FSharpGlyph.CSharpProject: - { - return Microsoft.CodeAnalysis.Glyph.CSharpProject; - } - case FSharpGlyph.ConstantPublic: - { - return Microsoft.CodeAnalysis.Glyph.ConstantPublic; - } - case FSharpGlyph.ConstantProtected: - { - return Microsoft.CodeAnalysis.Glyph.ConstantProtected; - } - case FSharpGlyph.ConstantPrivate: - { - return Microsoft.CodeAnalysis.Glyph.ConstantPrivate; - } - case FSharpGlyph.ConstantInternal: - { - return Microsoft.CodeAnalysis.Glyph.ConstantInternal; - } - case FSharpGlyph.DelegatePublic: - { - return Microsoft.CodeAnalysis.Glyph.DelegatePublic; - } - case FSharpGlyph.DelegateProtected: - { - return Microsoft.CodeAnalysis.Glyph.DelegateProtected; - } - case FSharpGlyph.DelegatePrivate: - { - return Microsoft.CodeAnalysis.Glyph.DelegatePrivate; - } - case FSharpGlyph.DelegateInternal: - { - return Microsoft.CodeAnalysis.Glyph.DelegateInternal; - } - case FSharpGlyph.EnumPublic: - { - return Microsoft.CodeAnalysis.Glyph.EnumPublic; - } - case FSharpGlyph.EnumProtected: - { - return Microsoft.CodeAnalysis.Glyph.EnumProtected; - } - case FSharpGlyph.EnumPrivate: - { - return Microsoft.CodeAnalysis.Glyph.EnumPrivate; - } - case FSharpGlyph.EnumInternal: - { - return Microsoft.CodeAnalysis.Glyph.EnumInternal; - } - case FSharpGlyph.EnumMemberPublic: - { - return Microsoft.CodeAnalysis.Glyph.EnumMemberPublic; - } - case FSharpGlyph.EnumMemberProtected: - { - return Microsoft.CodeAnalysis.Glyph.EnumMemberProtected; - } - case FSharpGlyph.EnumMemberPrivate: - { - return Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate; - } - case FSharpGlyph.EnumMemberInternal: - { - return Microsoft.CodeAnalysis.Glyph.EnumMemberInternal; - } - case FSharpGlyph.Error: - { - return Microsoft.CodeAnalysis.Glyph.Error; - } - case FSharpGlyph.StatusInformation: - { - return Microsoft.CodeAnalysis.Glyph.StatusInformation; - } - case FSharpGlyph.EventPublic: - { - return Microsoft.CodeAnalysis.Glyph.EventPublic; - } - case FSharpGlyph.EventProtected: - { - return Microsoft.CodeAnalysis.Glyph.EventProtected; - } - case FSharpGlyph.EventPrivate: - { - return Microsoft.CodeAnalysis.Glyph.EventPrivate; - } - case FSharpGlyph.EventInternal: - { - return Microsoft.CodeAnalysis.Glyph.EventInternal; - } - case FSharpGlyph.ExtensionMethodPublic: - { - return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic; - } - case FSharpGlyph.ExtensionMethodProtected: - { - return Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected; - } - case FSharpGlyph.ExtensionMethodPrivate: - { - return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate; - } - case FSharpGlyph.ExtensionMethodInternal: - { - return Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal; - } - case FSharpGlyph.FieldPublic: - { - return Microsoft.CodeAnalysis.Glyph.FieldPublic; - } - case FSharpGlyph.FieldProtected: - { - return Microsoft.CodeAnalysis.Glyph.FieldProtected; - } - case FSharpGlyph.FieldPrivate: - { - return Microsoft.CodeAnalysis.Glyph.FieldPrivate; - } - case FSharpGlyph.FieldInternal: - { - return Microsoft.CodeAnalysis.Glyph.FieldInternal; - } - case FSharpGlyph.InterfacePublic: - { - return Microsoft.CodeAnalysis.Glyph.InterfacePublic; - } - case FSharpGlyph.InterfaceProtected: - { - return Microsoft.CodeAnalysis.Glyph.InterfaceProtected; - } - case FSharpGlyph.InterfacePrivate: - { - return Microsoft.CodeAnalysis.Glyph.InterfacePrivate; - } - case FSharpGlyph.InterfaceInternal: - { - return Microsoft.CodeAnalysis.Glyph.InterfaceInternal; - } - case FSharpGlyph.Intrinsic: - { - return Microsoft.CodeAnalysis.Glyph.Intrinsic; - } - case FSharpGlyph.Keyword: - { - return Microsoft.CodeAnalysis.Glyph.Keyword; - } - case FSharpGlyph.Label: - { - return Microsoft.CodeAnalysis.Glyph.Label; - } - case FSharpGlyph.Local: - { - return Microsoft.CodeAnalysis.Glyph.Local; - } - case FSharpGlyph.Namespace: - { - return Microsoft.CodeAnalysis.Glyph.Namespace; - } - case FSharpGlyph.MethodPublic: - { - return Microsoft.CodeAnalysis.Glyph.MethodPublic; - } - case FSharpGlyph.MethodProtected: - { - return Microsoft.CodeAnalysis.Glyph.MethodProtected; - } - case FSharpGlyph.MethodPrivate: - { - return Microsoft.CodeAnalysis.Glyph.MethodPrivate; - } - case FSharpGlyph.MethodInternal: - { - return Microsoft.CodeAnalysis.Glyph.MethodInternal; - } - case FSharpGlyph.ModulePublic: - { - return Microsoft.CodeAnalysis.Glyph.ModulePublic; - } - case FSharpGlyph.ModuleProtected: - { - return Microsoft.CodeAnalysis.Glyph.ModuleProtected; - } - case FSharpGlyph.ModulePrivate: - { - return Microsoft.CodeAnalysis.Glyph.ModulePrivate; - } - case FSharpGlyph.ModuleInternal: - { - return Microsoft.CodeAnalysis.Glyph.ModuleInternal; - } - case FSharpGlyph.OpenFolder: - { - return Microsoft.CodeAnalysis.Glyph.OpenFolder; - } - case FSharpGlyph.Operator: - { - return Microsoft.CodeAnalysis.Glyph.Operator; - } - case FSharpGlyph.Parameter: - { - return Microsoft.CodeAnalysis.Glyph.Parameter; - } - case FSharpGlyph.PropertyPublic: - { - return Microsoft.CodeAnalysis.Glyph.PropertyPublic; - } - case FSharpGlyph.PropertyProtected: - { - return Microsoft.CodeAnalysis.Glyph.PropertyProtected; - } - case FSharpGlyph.PropertyPrivate: - { - return Microsoft.CodeAnalysis.Glyph.PropertyPrivate; - } - case FSharpGlyph.PropertyInternal: - { - return Microsoft.CodeAnalysis.Glyph.PropertyInternal; - } - case FSharpGlyph.RangeVariable: - { - return Microsoft.CodeAnalysis.Glyph.RangeVariable; - } - case FSharpGlyph.Reference: - { - return Microsoft.CodeAnalysis.Glyph.Reference; - } - case FSharpGlyph.StructurePublic: - { - return Microsoft.CodeAnalysis.Glyph.StructurePublic; - } - case FSharpGlyph.StructureProtected: - { - return Microsoft.CodeAnalysis.Glyph.StructureProtected; - } - case FSharpGlyph.StructurePrivate: - { - return Microsoft.CodeAnalysis.Glyph.StructurePrivate; - } - case FSharpGlyph.StructureInternal: - { - return Microsoft.CodeAnalysis.Glyph.StructureInternal; - } - case FSharpGlyph.TypeParameter: - { - return Microsoft.CodeAnalysis.Glyph.TypeParameter; - } - case FSharpGlyph.Snippet: - { - return Microsoft.CodeAnalysis.Glyph.Snippet; - } - case FSharpGlyph.CompletionWarning: - { - return Microsoft.CodeAnalysis.Glyph.CompletionWarning; - } - case FSharpGlyph.AddReference: - { - return Microsoft.CodeAnalysis.Glyph.AddReference; - } - case FSharpGlyph.NuGet: - { - return Microsoft.CodeAnalysis.Glyph.NuGet; - } - default: - { - return Microsoft.CodeAnalysis.Glyph.None; - } - } - } - } -} diff --git a/src/Tools/ExternalAccess/FSharp/FSharpGlyphTags.cs b/src/Tools/ExternalAccess/FSharp/FSharpGlyphTags.cs new file mode 100644 index 0000000000000..abb58a5354d61 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/FSharpGlyphTags.cs @@ -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 System.Collections.Immutable; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp +{ + internal static class FSharpGlyphTags + { + public static ImmutableArray GetTags(FSharpGlyph glyph) + { + return GlyphTags.GetTags(FSharpGlyphHelpers.ConvertTo(glyph)); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Classification/FSharpClassificationService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Classification/FSharpClassificationService.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Classification/FSharpClassificationService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Classification/FSharpClassificationService.cs diff --git a/src/Tools/ExternalAccess/FSharp/Internal/CommentSelection/FSharpCommentSelectionService.cs b/src/Tools/ExternalAccess/FSharp/Internal/CommentSelection/FSharpCommentSelectionService.cs new file mode 100644 index 0000000000000..a68e6b54afff2 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/CommentSelection/FSharpCommentSelectionService.cs @@ -0,0 +1,32 @@ +// 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.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CommentSelection; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.CommentSelection +{ + [Shared] + [ExportLanguageService(typeof(ICommentSelectionService), LanguageNames.FSharp)] + internal class FSharpCommentSelectionService : ICommentSelectionService + { + public Task FormatAsync(Document document, ImmutableArray changes, CancellationToken cancellationToken) + { + return Task.FromResult(document); + } + + public Task GetInfoAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) + { + return Task.FromResult(new CommentSelectionInfo( + supportsSingleLineComment: true, + supportsBlockComment: true, + singleLineCommentString: "//", + blockCommentStartString: "(*", + blockCommentEndString: "*)")); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Completion/FSharpInternalCommonCompletionProvider.cs b/src/Tools/ExternalAccess/FSharp/Internal/Completion/FSharpInternalCommonCompletionProvider.cs new file mode 100644 index 0000000000000..768a6cef675bc --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Completion/FSharpInternalCommonCompletionProvider.cs @@ -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 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); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Diagnostics/FSharpDiagnosticAnalyzerService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpDiagnosticAnalyzerService.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Diagnostics/FSharpDiagnosticAnalyzerService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpDiagnosticAnalyzerService.cs diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpDocumentDiagnosticAnalyzer.cs b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpDocumentDiagnosticAnalyzer.cs new file mode 100644 index 0000000000000..770de8c2eb583 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpDocumentDiagnosticAnalyzer.cs @@ -0,0 +1,96 @@ +// 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.Collections.Immutable; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Diagnostics +{ + [Shared] + [ExportLanguageService(typeof(FSharpDocumentDiagnosticAnalyzerService), LanguageNames.FSharp)] + internal class FSharpDocumentDiagnosticAnalyzerService : ILanguageService + { + private readonly IFSharpDocumentDiagnosticAnalyzer _analyzer; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpDocumentDiagnosticAnalyzerService(IFSharpDocumentDiagnosticAnalyzer analyzer) + { + _analyzer = analyzer; + } + + public Task> AnalyzeSemanticsAsync(Document document, CancellationToken cancellationToken) + { + return _analyzer.AnalyzeSemanticsAsync(document, cancellationToken); + } + + public Task> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken) + { + return _analyzer.AnalyzeSyntaxAsync(document, cancellationToken); + } + } + + [DiagnosticAnalyzer(LanguageNames.FSharp)] + internal class FSharpDocumentDiagnosticAnalyzer : DocumentDiagnosticAnalyzer, IBuiltInAnalyzer + { + private readonly ImmutableArray _supportedDiagnostics; + + public FSharpDocumentDiagnosticAnalyzer() + { + _supportedDiagnostics = CreateSupportedDiagnostics(); + } + + static public ImmutableArray CreateSupportedDiagnostics() + { + // We are constructing our own descriptors at run-time. Compiler service is already doing error formatting and localization. + var dummyDescriptors = ImmutableArray.CreateBuilder(); + for (var i = 0; i <= 10000; i++) + { + dummyDescriptors.Add(new DiagnosticDescriptor(String.Format("FS{0:D4}", i), String.Empty, String.Empty, String.Empty, DiagnosticSeverity.Error, true, null, null)); + } + return dummyDescriptors.ToImmutable(); + } + + public override int Priority => 10; // Default = 50 + + public override ImmutableArray SupportedDiagnostics => _supportedDiagnostics; + + public override Task> AnalyzeSemanticsAsync(Document document, CancellationToken cancellationToken) + { + var analyzer = document.Project.LanguageServices.GetService(); + if (analyzer == null) + { + return Task.FromResult(ImmutableArray.Empty); + } + + return analyzer.AnalyzeSemanticsAsync(document, cancellationToken); + } + + public override Task> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken) + { + var analyzer = document.Project.LanguageServices.GetService(); + if (analyzer == null) + { + return Task.FromResult(ImmutableArray.Empty); + } + + return analyzer.AnalyzeSyntaxAsync(document, cancellationToken); + } + + public DiagnosticAnalyzerCategory GetAnalyzerCategory() + { + return DiagnosticAnalyzerCategory.SemanticDocumentAnalysis; + } + + public bool OpenFileOnly(Workspace workspace) + { + return true; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpProjectDiagnosticAnalyzer.cs b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpProjectDiagnosticAnalyzer.cs new file mode 100644 index 0000000000000..0bca28565e3ed --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpProjectDiagnosticAnalyzer.cs @@ -0,0 +1,57 @@ +// 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.Collections.Immutable; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Diagnostics +{ + [Shared] + [ExportLanguageService(typeof(FSharpProjectDiagnosticAnalyzerService), LanguageNames.FSharp)] + internal class FSharpProjectDiagnosticAnalyzerService : ILanguageService + { + private readonly IFSharpProjectDiagnosticAnalyzer _analyzer; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpProjectDiagnosticAnalyzerService(IFSharpProjectDiagnosticAnalyzer analyzer) + { + _analyzer = analyzer; + } + + public Task> AnalyzeProjectAsync(Project project, CancellationToken cancellationToken) + { + return _analyzer.AnalyzeProjectAsync(project, cancellationToken); + } + } + + [DiagnosticAnalyzer(LanguageNames.FSharp)] + internal class FSharpProjectDiagnosticAnalyzer : ProjectDiagnosticAnalyzer + { + private readonly ImmutableArray _supportedDiagnostics; + + public FSharpProjectDiagnosticAnalyzer() + { + _supportedDiagnostics = FSharpDocumentDiagnosticAnalyzer.CreateSupportedDiagnostics(); + } + + public override ImmutableArray SupportedDiagnostics => _supportedDiagnostics; + + public override Task> AnalyzeProjectAsync(Project project, CancellationToken cancellationToken) + { + var analyzer = project.LanguageServices.GetService(); + if (analyzer == null) + { + return Task.FromResult(ImmutableArray.Empty); + } + + return analyzer.AnalyzeProjectAsync(project, cancellationToken); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpSimplifyNameDiagnosticAnalyzer.cs b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpSimplifyNameDiagnosticAnalyzer.cs new file mode 100644 index 0000000000000..a30dd07008346 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpSimplifyNameDiagnosticAnalyzer.cs @@ -0,0 +1,74 @@ +// 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.Collections.Immutable; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Diagnostics +{ + [Shared] + [ExportLanguageService(typeof(FSharpSimplifyNameDiagnosticAnalyzerService), LanguageNames.FSharp)] + internal class FSharpSimplifyNameDiagnosticAnalyzerService : ILanguageService + { + private readonly IFSharpSimplifyNameDiagnosticAnalyzer _analyzer; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpSimplifyNameDiagnosticAnalyzerService(IFSharpSimplifyNameDiagnosticAnalyzer analyzer) + { + _analyzer = analyzer; + } + + public Task> AnalyzeSemanticsAsync(DiagnosticDescriptor descriptor, Document document, CancellationToken cancellationToken) + { + return _analyzer.AnalyzeSemanticsAsync(descriptor, document, cancellationToken); + } + } + + [DiagnosticAnalyzer(LanguageNames.FSharp)] + internal class FSharpSimplifyNameDiagnosticAnalyzer : DocumentDiagnosticAnalyzer, IBuiltInAnalyzer + { + private readonly DiagnosticDescriptor _descriptor = + new DiagnosticDescriptor( + IDEDiagnosticIds.SimplifyNamesDiagnosticId, + ExternalAccessFSharpResources.SimplifyName, + ExternalAccessFSharpResources.NameCanBeSimplified, + DiagnosticCategory.Style, DiagnosticSeverity.Hidden, isEnabledByDefault: true, customTags: FSharpDiagnosticCustomTags.Unnecessary); + + public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(_descriptor); + + public override int Priority => 100; // Default = 50 + + public override Task> AnalyzeSemanticsAsync(Document document, CancellationToken cancellationToken) + { + var analyzer = document.Project.LanguageServices.GetService(); + if (analyzer == null) + { + return Task.FromResult(ImmutableArray.Empty); + } + + return analyzer.AnalyzeSemanticsAsync(_descriptor, document, cancellationToken); + } + + public override Task> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken) + { + return Task.FromResult(ImmutableArray.Empty); + } + + public DiagnosticAnalyzerCategory GetAnalyzerCategory() + { + return DiagnosticAnalyzerCategory.SemanticDocumentAnalysis; + } + + public bool OpenFileOnly(Workspace workspace) + { + return true; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedDeclarationsAnalyzer.cs b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedDeclarationsAnalyzer.cs new file mode 100644 index 0000000000000..a0c6ab0ae9378 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedDeclarationsAnalyzer.cs @@ -0,0 +1,76 @@ +// 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.Collections.Immutable; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Diagnostics +{ + [Shared] + [ExportLanguageService(typeof(FSharpUnusedDeclarationsDiagnosticAnalyzerService), LanguageNames.FSharp)] + internal class FSharpUnusedDeclarationsDiagnosticAnalyzerService : ILanguageService + { + private readonly IFSharpUnusedDeclarationsDiagnosticAnalyzer _analyzer; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpUnusedDeclarationsDiagnosticAnalyzerService(IFSharpUnusedDeclarationsDiagnosticAnalyzer analyzer) + { + _analyzer = analyzer; + } + + public Task> AnalyzeSemanticsAsync(DiagnosticDescriptor descriptor, Document document, CancellationToken cancellationToken) + { + return _analyzer.AnalyzeSemanticsAsync(descriptor, document, cancellationToken); + } + } + + [DiagnosticAnalyzer(LanguageNames.FSharp)] + internal class FSharpUnusedDeclarationsDiagnosticAnalyzer : DocumentDiagnosticAnalyzer, IBuiltInAnalyzer + { + private const string DescriptorId = "FS1182"; + + private readonly DiagnosticDescriptor _descriptor = + new DiagnosticDescriptor( + DescriptorId, + ExternalAccessFSharpResources.TheValueIsUnused, + ExternalAccessFSharpResources.TheValueIsUnused, + DiagnosticCategory.Style, DiagnosticSeverity.Hidden, isEnabledByDefault: true, customTags: FSharpDiagnosticCustomTags.Unnecessary); + + public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(_descriptor); + + public override int Priority => 80; // Default = 50 + + public override Task> AnalyzeSemanticsAsync(Document document, CancellationToken cancellationToken) + { + var analyzer = document.Project.LanguageServices.GetService(); + if (analyzer == null) + { + return Task.FromResult(ImmutableArray.Empty); + } + + return analyzer.AnalyzeSemanticsAsync(_descriptor, document, cancellationToken); + } + + public override Task> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken) + { + return Task.FromResult(ImmutableArray.Empty); + } + + public DiagnosticAnalyzerCategory GetAnalyzerCategory() + { + return DiagnosticAnalyzerCategory.SemanticDocumentAnalysis; + } + + public bool OpenFileOnly(Workspace workspace) + { + return true; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedOpensDiagnosticAnalyzer.cs b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedOpensDiagnosticAnalyzer.cs new file mode 100644 index 0000000000000..fa425cdf10d09 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Diagnostics/FSharpUnusedOpensDiagnosticAnalyzer.cs @@ -0,0 +1,74 @@ +// 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.Collections.Immutable; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Diagnostics +{ + [Shared] + [ExportLanguageService(typeof(FSharpUnusedOpensDiagnosticAnalyzerService), LanguageNames.FSharp)] + internal class FSharpUnusedOpensDiagnosticAnalyzerService : ILanguageService + { + private readonly IFSharpUnusedOpensDiagnosticAnalyzer _analyzer; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpUnusedOpensDiagnosticAnalyzerService(IFSharpUnusedOpensDiagnosticAnalyzer analyzer) + { + _analyzer = analyzer; + } + + public Task> AnalyzeSemanticsAsync(DiagnosticDescriptor descriptor, Document document, CancellationToken cancellationToken) + { + return _analyzer.AnalyzeSemanticsAsync(descriptor, document, cancellationToken); + } + } + + [DiagnosticAnalyzer(LanguageNames.FSharp)] + internal class FSharpUnusedOpensDeclarationsDiagnosticAnalyzer : DocumentDiagnosticAnalyzer + { + private readonly DiagnosticDescriptor _descriptor = + new DiagnosticDescriptor( + IDEDiagnosticIds.RemoveUnnecessaryImportsDiagnosticId, + ExternalAccessFSharpResources.RemoveUnusedOpens, + ExternalAccessFSharpResources.UnusedOpens, + DiagnosticCategory.Style, DiagnosticSeverity.Hidden, isEnabledByDefault: true, customTags: FSharpDiagnosticCustomTags.Unnecessary); + + public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(_descriptor); + + public override int Priority => 90; // Default = 50 + + public override Task> AnalyzeSemanticsAsync(Document document, CancellationToken cancellationToken) + { + var analyzer = document.Project.LanguageServices.GetService(); + if (analyzer == null) + { + return Task.FromResult(ImmutableArray.Empty); + } + + return analyzer.AnalyzeSemanticsAsync(_descriptor, document, cancellationToken); + } + + public override Task> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken) + { + return Task.FromResult(ImmutableArray.Empty); + } + + public DiagnosticAnalyzerCategory GetAnalyzerCategory() + { + return DiagnosticAnalyzerCategory.SemanticDocumentAnalysis; + } + + public bool OpenFileOnly(Workspace workspace) + { + return true; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/DocumentHighlighting/FSharpDocumentHighlightsService.cs b/src/Tools/ExternalAccess/FSharp/Internal/DocumentHighlighting/FSharpDocumentHighlightsService.cs new file mode 100644 index 0000000000000..4e6d0ce8f3aac --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/DocumentHighlighting/FSharpDocumentHighlightsService.cs @@ -0,0 +1,74 @@ +// 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.Linq; +using System.Composition; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.DocumentHighlighting; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.DocumentHighlighting; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.DocumentHighlighting +{ + internal static class FSharpHighlightSpanKindHelpers + { + public static HighlightSpanKind ConvertTo(FSharpHighlightSpanKind kind) + { + switch (kind) + { + case FSharpHighlightSpanKind.None: + { + return HighlightSpanKind.None; + } + + case FSharpHighlightSpanKind.Definition: + { + return HighlightSpanKind.Definition; + } + + case FSharpHighlightSpanKind.Reference: + { + return HighlightSpanKind.Reference; + } + + case FSharpHighlightSpanKind.WrittenReference: + { + return HighlightSpanKind.WrittenReference; + } + + default: + { + throw ExceptionUtilities.UnexpectedValue(kind); + } + } + } + } + + [Shared] + [ExportLanguageService(typeof(IDocumentHighlightsService), LanguageNames.FSharp)] + internal class FSharpDocumentHighlightsService : IDocumentHighlightsService + { + private readonly IFSharpDocumentHighlightsService _service; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpDocumentHighlightsService(IFSharpDocumentHighlightsService service) + { + _service = service; + } + + private static ImmutableArray MapHighlightSpans(ImmutableArray highlightSpans) + { + return highlightSpans.SelectAsArray(x => new HighlightSpan(x.TextSpan, FSharpHighlightSpanKindHelpers.ConvertTo(x.Kind))); + } + + public async Task> GetDocumentHighlightsAsync(Document document, int position, IImmutableSet documentsToSearch, CancellationToken cancellationToken) + { + var highlights = await _service.GetDocumentHighlightsAsync(document, position, documentsToSearch, cancellationToken).ConfigureAwait(false); + return highlights.SelectAsArray(x => new DocumentHighlights(x.Document, MapHighlightSpans(x.HighlightSpans))); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Editor/FSharpBraceMatcher.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpBraceMatcher.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Editor/FSharpBraceMatcher.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpBraceMatcher.cs diff --git a/src/Tools/ExternalAccess/FSharp/Editor/FSharpContentTypeLanguageService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpContentTypeLanguageService.cs similarity index 80% rename from src/Tools/ExternalAccess/FSharp/Editor/FSharpContentTypeLanguageService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpContentTypeLanguageService.cs index a521d5607c28b..688dac9979c61 100644 --- a/src/Tools/ExternalAccess/FSharp/Editor/FSharpContentTypeLanguageService.cs +++ b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpContentTypeLanguageService.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Editor { - [ExportContentTypeLanguageService(FSharp.Editor.FSharpContentTypeNames.FSharpContentType, LanguageNames.FSharp), Shared] + [ExportContentTypeLanguageService(FSharpContentTypeNames.FSharpContentType, LanguageNames.FSharp), Shared] internal class FSharpContentTypeLanguageService : IContentTypeLanguageService { private readonly IContentTypeRegistryService _contentTypeRegistry; @@ -23,7 +23,7 @@ public FSharpContentTypeLanguageService(IContentTypeRegistryService contentTypeR public IContentType GetDefaultContentType() { - return _contentTypeRegistry.GetContentType(FSharp.Editor.FSharpContentTypeNames.FSharpContentType); + return _contentTypeRegistry.GetContentType(FSharpContentTypeNames.FSharpContentType); } } } diff --git a/src/Tools/ExternalAccess/FSharp/Editor/FSharpEditorFormattingService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorFormattingService.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Editor/FSharpEditorFormattingService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorFormattingService.cs diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs new file mode 100644 index 0000000000000..5533fb29bb058 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs @@ -0,0 +1,173 @@ +// 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.Linq; +using System.Collections.Generic; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Editor +{ + internal static class FSharpInlineRenameReplacementKindHelpers + { + public static InlineRenameReplacementKind ConvertTo(FSharpInlineRenameReplacementKind kind) + { + switch (kind) + { + case FSharpInlineRenameReplacementKind.NoConflict: + { + return InlineRenameReplacementKind.NoConflict; + } + + case FSharpInlineRenameReplacementKind.ResolvedReferenceConflict: + { + return InlineRenameReplacementKind.ResolvedReferenceConflict; + } + + case FSharpInlineRenameReplacementKind.ResolvedNonReferenceConflict: + { + return InlineRenameReplacementKind.ResolvedNonReferenceConflict; + } + + case FSharpInlineRenameReplacementKind.UnresolvedConflict: + { + return InlineRenameReplacementKind.UnresolvedConflict; + } + + case FSharpInlineRenameReplacementKind.Complexified: + { + return InlineRenameReplacementKind.Complexified; + } + + default: + { + throw ExceptionUtilities.UnexpectedValue(kind); + } + } + } + } + internal class FSharpInlineRenameReplacementInfo : IInlineRenameReplacementInfo + { + private readonly IFSharpInlineRenameReplacementInfo _info; + + public FSharpInlineRenameReplacementInfo(IFSharpInlineRenameReplacementInfo info) + { + _info = info; + } + + public Solution NewSolution => _info.NewSolution; + + public bool ReplacementTextValid => _info.ReplacementTextValid; + + public IEnumerable DocumentIds => _info.DocumentIds; + + public IEnumerable GetReplacements(DocumentId documentId) + { + return _info.GetReplacements(documentId).Select(x => + new InlineRenameReplacement(FSharpInlineRenameReplacementKindHelpers.ConvertTo(x.Kind), x.OriginalSpan, x.NewSpan)); + } + } + internal class FSharpInlineRenameLocationSet : IInlineRenameLocationSet + { + private readonly IFSharpInlineRenameLocationSet _set; + private readonly IList _locations; + + public FSharpInlineRenameLocationSet(IFSharpInlineRenameLocationSet set) + { + _set = set; + _locations = set.Locations.Select(x => new InlineRenameLocation(x.Document, x.TextSpan)).ToList(); + } + + public IList Locations => _locations; + + public async Task GetReplacementsAsync(string replacementText, OptionSet optionSet, CancellationToken cancellationToken) + { + var info = await _set.GetReplacementsAsync(replacementText, optionSet, cancellationToken).ConfigureAwait(false); + return new FSharpInlineRenameReplacementInfo(info); + } + } + + internal class FSharpInlineRenameInfo : IInlineRenameInfo + { + private readonly IFSharpInlineRenameInfo _info; + + public FSharpInlineRenameInfo(IFSharpInlineRenameInfo info) + { + _info = info; + } + + public bool CanRename => _info.CanRename; + + public string LocalizedErrorMessage => _info.LocalizedErrorMessage; + + public TextSpan TriggerSpan => _info.TriggerSpan; + + public bool HasOverloads => _info.HasOverloads; + + public bool ForceRenameOverloads => _info.ForceRenameOverloads; + + public string DisplayName => _info.DisplayName; + + public string FullDisplayName => _info.FullDisplayName; + + public Glyph Glyph => FSharpGlyphHelpers.ConvertTo(_info.Glyph); + + public async Task FindRenameLocationsAsync(OptionSet optionSet, CancellationToken cancellationToken) + { + var set = await _info.FindRenameLocationsAsync(optionSet, cancellationToken).ConfigureAwait(false); + return new FSharpInlineRenameLocationSet(set); + } + + public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string replacementText, CancellationToken cancellationToken) + { + return _info.GetConflictEditSpan(new FSharpInlineRenameLocation(location.Document, location.TextSpan), replacementText, cancellationToken); + } + + public string GetFinalSymbolName(string replacementText) + { + return _info.GetFinalSymbolName(replacementText); + } + + public TextSpan GetReferenceEditSpan(InlineRenameLocation location, CancellationToken cancellationToken) + { + return _info.GetReferenceEditSpan(new FSharpInlineRenameLocation(location.Document, location.TextSpan), cancellationToken); + } + + public bool TryOnAfterGlobalSymbolRenamed(Workspace workspace, IEnumerable changedDocumentIDs, string replacementText) + { + return _info.TryOnAfterGlobalSymbolRenamed(workspace, changedDocumentIDs, replacementText); + } + + public bool TryOnBeforeGlobalSymbolRenamed(Workspace workspace, IEnumerable changedDocumentIDs, string replacementText) + { + return _info.TryOnBeforeGlobalSymbolRenamed(workspace, changedDocumentIDs, replacementText); + } + } + + [Shared] + [ExportLanguageService(typeof(IEditorInlineRenameService), LanguageNames.FSharp)] + internal class FSharpEditorInlineRenameService : IEditorInlineRenameService + { + private readonly IFSharpEditorInlineRenameService _service; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpEditorInlineRenameService(IFSharpEditorInlineRenameService service) + { + _service = service; + } + + public async Task GetRenameInfoAsync(Document document, int position, CancellationToken cancellationToken) + { + var info = await _service.GetRenameInfoAsync(document, position, cancellationToken).ConfigureAwait(false); + return new FSharpInlineRenameInfo(info); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpGoToDefinitionService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpGoToDefinitionService.cs new file mode 100644 index 0000000000000..9fed05156ad2e --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpGoToDefinitionService.cs @@ -0,0 +1,41 @@ +// 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.Linq; +using System.Composition; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor; +using Microsoft.CodeAnalysis.Navigation; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Navigation; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Editor +{ + [Shared] + [ExportLanguageService(typeof(IGoToDefinitionService), LanguageNames.FSharp)] + internal class FSharpGoToDefinitionService : IGoToDefinitionService + { + private readonly IFSharpGoToDefinitionService _service; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpGoToDefinitionService(IFSharpGoToDefinitionService service) + { + _service = service; + } + + public async Task> FindDefinitionsAsync(Document document, int position, CancellationToken cancellationToken) + { + var items = await _service.FindDefinitionsAsync(document, position, cancellationToken).ConfigureAwait(false); + return items.Select(x => new InternalFSharpNavigableItem(x)); + } + + public bool TryGoToDefinition(Document document, int position, CancellationToken cancellationToken) + { + return _service.TryGoToDefinition(document, position, cancellationToken); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpNavigationBarItemService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpNavigationBarItemService.cs new file mode 100644 index 0000000000000..54a4673aca17a --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpNavigationBarItemService.cs @@ -0,0 +1,91 @@ +// 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.Linq; +using System.Composition; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation; +using Microsoft.CodeAnalysis.Notification; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Editor +{ + [Shared] + [ExportLanguageService(typeof(INavigationBarItemService), LanguageNames.FSharp)] + internal class FSharpNavigationBarItemService : INavigationBarItemService + { + private readonly IFSharpNavigationBarItemService _service; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpNavigationBarItemService(IFSharpNavigationBarItemService service) + { + _service = service; + } + + public async Task> GetItemsAsync(Document document, CancellationToken cancellationToken) + { + var items = await _service.GetItemsAsync(document, cancellationToken).ConfigureAwait(false); + return items.Select(x => ConvertToNavigationBarItem(x)).ToList(); + } + + public void NavigateToItem(Document document, NavigationBarItem item, ITextView view, CancellationToken cancellationToken) + { + // The logic here was ported from FSharp's implementation. The main reason was to avoid shimming INotificationService. + if (item.Spans.Count > 0) + { + var span = item.Spans.First(); + var workspace = document.Project.Solution.Workspace; + var navigationService = workspace.Services.GetService(); + + if (navigationService.CanNavigateToPosition(workspace, document.Id, span.Start)) + { + navigationService.TryNavigateToPosition(workspace, document.Id, span.Start); + } + else + { + var notificationService = workspace.Services.GetService(); + notificationService.SendNotification(EditorFeaturesResources.The_definition_of_the_object_is_hidden, severity: NotificationSeverity.Error); + } + } + } + + public bool ShowItemGrayedIfNear(NavigationBarItem item) + { + return false; + } + + private static NavigationBarItem ConvertToNavigationBarItem(FSharpNavigationBarItem item) + { + return + new InternalNavigationBarItem( + item.Text, + FSharpGlyphHelpers.ConvertTo(item.Glyph), + item.Spans, + item.ChildItems.Select(x => ConvertToNavigationBarItem(x)).ToList(), + item.Indent, + item.Bolded, + item.Grayed); + } + + private class InternalNavigationBarItem : NavigationBarItem + { + public InternalNavigationBarItem( + string text, + Glyph glyph, + IList spans, + IList childItems, + int indent, + bool bolded, + bool grayed) : base(text, glyph, spans, childItems, indent, bolded, grayed) + { + } + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Editor/FSharpSynchronousIndentationService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpSynchronousIndentationService.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Editor/FSharpSynchronousIndentationService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpSynchronousIndentationService.cs diff --git a/src/Tools/ExternalAccess/FSharp/Editor/FindUsages/FSharpFindUsagesContext.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FindUsages/FSharpFindUsagesContext.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Editor/FindUsages/FSharpFindUsagesContext.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/FindUsages/FSharpFindUsagesContext.cs diff --git a/src/Tools/ExternalAccess/FSharp/Editor/FindUsages/FSharpFindUsagesService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/FindUsages/FSharpFindUsagesService.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Editor/FindUsages/FSharpFindUsagesService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/FindUsages/FSharpFindUsagesService.cs diff --git a/src/Tools/ExternalAccess/FSharp/Editor/Implementation/Debugging/FSharpBreakpointResolutionService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/Implementation/Debugging/FSharpBreakpointResolutionService.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Editor/Implementation/Debugging/FSharpBreakpointResolutionService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/Implementation/Debugging/FSharpBreakpointResolutionService.cs diff --git a/src/Tools/ExternalAccess/FSharp/Editor/Implementation/Debugging/FSharpLanguageDebugInfoService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Editor/Implementation/Debugging/FSharpLanguageDebugInfoService.cs similarity index 100% rename from src/Tools/ExternalAccess/FSharp/Editor/Implementation/Debugging/FSharpLanguageDebugInfoService.cs rename to src/Tools/ExternalAccess/FSharp/Internal/Editor/Implementation/Debugging/FSharpLanguageDebugInfoService.cs diff --git a/src/Tools/ExternalAccess/FSharp/Internal/FSharpContentTypeDefinitions.cs b/src/Tools/ExternalAccess/FSharp/Internal/FSharpContentTypeDefinitions.cs new file mode 100644 index 0000000000000..f818d1ad4ffc7 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/FSharpContentTypeDefinitions.cs @@ -0,0 +1,21 @@ +// 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.ComponentModel.Composition; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor; +using Microsoft.VisualStudio.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal +{ + internal static class FSharpContentTypeDefinitions + { + [Export] + [Name(FSharpContentTypeNames.FSharpContentType)] + [BaseDefinition(FSharpContentTypeNames.RoslynContentType)] + public static readonly ContentTypeDefinition FSharpContentTypeDefinition; + + [Export] + [Name(FSharpContentTypeNames.FSharpSignatureHelpContentType)] + [BaseDefinition("sighelp")] + public static readonly ContentTypeDefinition FSharpSignatureHelpContentTypeDefinition; + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/FSharpGlyphHelpers.cs b/src/Tools/ExternalAccess/FSharp/Internal/FSharpGlyphHelpers.cs new file mode 100644 index 0000000000000..f2a160e53eaaa --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/FSharpGlyphHelpers.cs @@ -0,0 +1,640 @@ +// 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 Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal +{ + internal static class FSharpGlyphHelpers + { + public static FSharpGlyph ConvertFrom(Microsoft.CodeAnalysis.Glyph glyph) + { + switch (glyph) + { + case Microsoft.CodeAnalysis.Glyph.None: + { + return FSharpGlyph.None; + } + case Microsoft.CodeAnalysis.Glyph.Assembly: + { + return FSharpGlyph.Assembly; + } + case Microsoft.CodeAnalysis.Glyph.BasicFile: + { + return FSharpGlyph.BasicFile; + } + case Microsoft.CodeAnalysis.Glyph.BasicProject: + { + return FSharpGlyph.BasicProject; + } + case Microsoft.CodeAnalysis.Glyph.ClassPublic: + { + return FSharpGlyph.ClassPublic; + } + case Microsoft.CodeAnalysis.Glyph.ClassProtected: + { + return FSharpGlyph.ClassProtected; + } + case Microsoft.CodeAnalysis.Glyph.ClassPrivate: + { + return FSharpGlyph.ClassPrivate; + } + case Microsoft.CodeAnalysis.Glyph.ClassInternal: + { + return FSharpGlyph.ClassInternal; + } + case Microsoft.CodeAnalysis.Glyph.CSharpFile: + { + return FSharpGlyph.CSharpFile; + } + case Microsoft.CodeAnalysis.Glyph.CSharpProject: + { + return FSharpGlyph.CSharpProject; + } + case Microsoft.CodeAnalysis.Glyph.ConstantPublic: + { + return FSharpGlyph.ConstantPublic; + } + case Microsoft.CodeAnalysis.Glyph.ConstantProtected: + { + return FSharpGlyph.ConstantProtected; + } + case Microsoft.CodeAnalysis.Glyph.ConstantPrivate: + { + return FSharpGlyph.ConstantPrivate; + } + case Microsoft.CodeAnalysis.Glyph.ConstantInternal: + { + return FSharpGlyph.ConstantInternal; + } + case Microsoft.CodeAnalysis.Glyph.DelegatePublic: + { + return FSharpGlyph.DelegatePublic; + } + case Microsoft.CodeAnalysis.Glyph.DelegateProtected: + { + return FSharpGlyph.DelegateProtected; + } + case Microsoft.CodeAnalysis.Glyph.DelegatePrivate: + { + return FSharpGlyph.DelegatePrivate; + } + case Microsoft.CodeAnalysis.Glyph.DelegateInternal: + { + return FSharpGlyph.DelegateInternal; + } + case Microsoft.CodeAnalysis.Glyph.EnumPublic: + { + return FSharpGlyph.EnumPublic; + } + case Microsoft.CodeAnalysis.Glyph.EnumProtected: + { + return FSharpGlyph.EnumProtected; + } + case Microsoft.CodeAnalysis.Glyph.EnumPrivate: + { + return FSharpGlyph.EnumPrivate; + } + case Microsoft.CodeAnalysis.Glyph.EnumInternal: + { + return FSharpGlyph.EnumInternal; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberPublic: + { + return FSharpGlyph.EnumMemberPublic; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberProtected: + { + return FSharpGlyph.EnumMemberProtected; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate: + { + return FSharpGlyph.EnumMemberPrivate; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberInternal: + { + return FSharpGlyph.EnumMemberInternal; + } + case Microsoft.CodeAnalysis.Glyph.Error: + { + return FSharpGlyph.Error; + } + case Microsoft.CodeAnalysis.Glyph.StatusInformation: + { + return FSharpGlyph.StatusInformation; + } + case Microsoft.CodeAnalysis.Glyph.EventPublic: + { + return FSharpGlyph.EventPublic; + } + case Microsoft.CodeAnalysis.Glyph.EventProtected: + { + return FSharpGlyph.EventProtected; + } + case Microsoft.CodeAnalysis.Glyph.EventPrivate: + { + return FSharpGlyph.EventPrivate; + } + case Microsoft.CodeAnalysis.Glyph.EventInternal: + { + return FSharpGlyph.EventInternal; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic: + { + return FSharpGlyph.ExtensionMethodPublic; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected: + { + return FSharpGlyph.ExtensionMethodProtected; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate: + { + return FSharpGlyph.ExtensionMethodPrivate; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal: + { + return FSharpGlyph.ExtensionMethodInternal; + } + case Microsoft.CodeAnalysis.Glyph.FieldPublic: + { + return FSharpGlyph.FieldPublic; + } + case Microsoft.CodeAnalysis.Glyph.FieldProtected: + { + return FSharpGlyph.FieldProtected; + } + case Microsoft.CodeAnalysis.Glyph.FieldPrivate: + { + return FSharpGlyph.FieldPrivate; + } + case Microsoft.CodeAnalysis.Glyph.FieldInternal: + { + return FSharpGlyph.FieldInternal; + } + case Microsoft.CodeAnalysis.Glyph.InterfacePublic: + { + return FSharpGlyph.InterfacePublic; + } + case Microsoft.CodeAnalysis.Glyph.InterfaceProtected: + { + return FSharpGlyph.InterfaceProtected; + } + case Microsoft.CodeAnalysis.Glyph.InterfacePrivate: + { + return FSharpGlyph.InterfacePrivate; + } + case Microsoft.CodeAnalysis.Glyph.InterfaceInternal: + { + return FSharpGlyph.InterfaceInternal; + } + case Microsoft.CodeAnalysis.Glyph.Intrinsic: + { + return FSharpGlyph.Intrinsic; + } + case Microsoft.CodeAnalysis.Glyph.Keyword: + { + return FSharpGlyph.Keyword; + } + case Microsoft.CodeAnalysis.Glyph.Label: + { + return FSharpGlyph.Label; + } + case Microsoft.CodeAnalysis.Glyph.Local: + { + return FSharpGlyph.Local; + } + case Microsoft.CodeAnalysis.Glyph.Namespace: + { + return FSharpGlyph.Namespace; + } + case Microsoft.CodeAnalysis.Glyph.MethodPublic: + { + return FSharpGlyph.MethodPublic; + } + case Microsoft.CodeAnalysis.Glyph.MethodProtected: + { + return FSharpGlyph.MethodProtected; + } + case Microsoft.CodeAnalysis.Glyph.MethodPrivate: + { + return FSharpGlyph.MethodPrivate; + } + case Microsoft.CodeAnalysis.Glyph.MethodInternal: + { + return FSharpGlyph.MethodInternal; + } + case Microsoft.CodeAnalysis.Glyph.ModulePublic: + { + return FSharpGlyph.ModulePublic; + } + case Microsoft.CodeAnalysis.Glyph.ModuleProtected: + { + return FSharpGlyph.ModuleProtected; + } + case Microsoft.CodeAnalysis.Glyph.ModulePrivate: + { + return FSharpGlyph.ModulePrivate; + } + case Microsoft.CodeAnalysis.Glyph.ModuleInternal: + { + return FSharpGlyph.ModuleInternal; + } + case Microsoft.CodeAnalysis.Glyph.OpenFolder: + { + return FSharpGlyph.OpenFolder; + } + case Microsoft.CodeAnalysis.Glyph.Operator: + { + return FSharpGlyph.Operator; + } + case Microsoft.CodeAnalysis.Glyph.Parameter: + { + return FSharpGlyph.Parameter; + } + case Microsoft.CodeAnalysis.Glyph.PropertyPublic: + { + return FSharpGlyph.PropertyPublic; + } + case Microsoft.CodeAnalysis.Glyph.PropertyProtected: + { + return FSharpGlyph.PropertyProtected; + } + case Microsoft.CodeAnalysis.Glyph.PropertyPrivate: + { + return FSharpGlyph.PropertyPrivate; + } + case Microsoft.CodeAnalysis.Glyph.PropertyInternal: + { + return FSharpGlyph.PropertyInternal; + } + case Microsoft.CodeAnalysis.Glyph.RangeVariable: + { + return FSharpGlyph.RangeVariable; + } + case Microsoft.CodeAnalysis.Glyph.Reference: + { + return FSharpGlyph.Reference; + } + case Microsoft.CodeAnalysis.Glyph.StructurePublic: + { + return FSharpGlyph.StructurePublic; + } + case Microsoft.CodeAnalysis.Glyph.StructureProtected: + { + return FSharpGlyph.StructureProtected; + } + case Microsoft.CodeAnalysis.Glyph.StructurePrivate: + { + return FSharpGlyph.StructurePrivate; + } + case Microsoft.CodeAnalysis.Glyph.StructureInternal: + { + return FSharpGlyph.StructureInternal; + } + case Microsoft.CodeAnalysis.Glyph.TypeParameter: + { + return FSharpGlyph.TypeParameter; + } + case Microsoft.CodeAnalysis.Glyph.Snippet: + { + return FSharpGlyph.Snippet; + } + case Microsoft.CodeAnalysis.Glyph.CompletionWarning: + { + return FSharpGlyph.CompletionWarning; + } + case Microsoft.CodeAnalysis.Glyph.AddReference: + { + return FSharpGlyph.AddReference; + } + case Microsoft.CodeAnalysis.Glyph.NuGet: + { + return FSharpGlyph.NuGet; + } + case Microsoft.CodeAnalysis.Glyph.TargetTypeMatch: + { + return FSharpGlyph.TargetTypeMatch; + } + default: + { + throw ExceptionUtilities.UnexpectedValue(glyph); + } + } + } + + public static Microsoft.CodeAnalysis.Glyph ConvertTo(FSharpGlyph glyph) + { + switch (glyph) + { + case FSharpGlyph.None: + { + return Microsoft.CodeAnalysis.Glyph.None; + } + case FSharpGlyph.Assembly: + { + return Microsoft.CodeAnalysis.Glyph.Assembly; + } + case FSharpGlyph.BasicFile: + { + return Microsoft.CodeAnalysis.Glyph.BasicFile; + } + case FSharpGlyph.BasicProject: + { + return Microsoft.CodeAnalysis.Glyph.BasicProject; + } + case FSharpGlyph.ClassPublic: + { + return Microsoft.CodeAnalysis.Glyph.ClassPublic; + } + case FSharpGlyph.ClassProtected: + { + return Microsoft.CodeAnalysis.Glyph.ClassProtected; + } + case FSharpGlyph.ClassPrivate: + { + return Microsoft.CodeAnalysis.Glyph.ClassPrivate; + } + case FSharpGlyph.ClassInternal: + { + return Microsoft.CodeAnalysis.Glyph.ClassInternal; + } + case FSharpGlyph.CSharpFile: + { + return Microsoft.CodeAnalysis.Glyph.CSharpFile; + } + case FSharpGlyph.CSharpProject: + { + return Microsoft.CodeAnalysis.Glyph.CSharpProject; + } + case FSharpGlyph.ConstantPublic: + { + return Microsoft.CodeAnalysis.Glyph.ConstantPublic; + } + case FSharpGlyph.ConstantProtected: + { + return Microsoft.CodeAnalysis.Glyph.ConstantProtected; + } + case FSharpGlyph.ConstantPrivate: + { + return Microsoft.CodeAnalysis.Glyph.ConstantPrivate; + } + case FSharpGlyph.ConstantInternal: + { + return Microsoft.CodeAnalysis.Glyph.ConstantInternal; + } + case FSharpGlyph.DelegatePublic: + { + return Microsoft.CodeAnalysis.Glyph.DelegatePublic; + } + case FSharpGlyph.DelegateProtected: + { + return Microsoft.CodeAnalysis.Glyph.DelegateProtected; + } + case FSharpGlyph.DelegatePrivate: + { + return Microsoft.CodeAnalysis.Glyph.DelegatePrivate; + } + case FSharpGlyph.DelegateInternal: + { + return Microsoft.CodeAnalysis.Glyph.DelegateInternal; + } + case FSharpGlyph.EnumPublic: + { + return Microsoft.CodeAnalysis.Glyph.EnumPublic; + } + case FSharpGlyph.EnumProtected: + { + return Microsoft.CodeAnalysis.Glyph.EnumProtected; + } + case FSharpGlyph.EnumPrivate: + { + return Microsoft.CodeAnalysis.Glyph.EnumPrivate; + } + case FSharpGlyph.EnumInternal: + { + return Microsoft.CodeAnalysis.Glyph.EnumInternal; + } + case FSharpGlyph.EnumMemberPublic: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberPublic; + } + case FSharpGlyph.EnumMemberProtected: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberProtected; + } + case FSharpGlyph.EnumMemberPrivate: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate; + } + case FSharpGlyph.EnumMemberInternal: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberInternal; + } + case FSharpGlyph.Error: + { + return Microsoft.CodeAnalysis.Glyph.Error; + } + case FSharpGlyph.StatusInformation: + { + return Microsoft.CodeAnalysis.Glyph.StatusInformation; + } + case FSharpGlyph.EventPublic: + { + return Microsoft.CodeAnalysis.Glyph.EventPublic; + } + case FSharpGlyph.EventProtected: + { + return Microsoft.CodeAnalysis.Glyph.EventProtected; + } + case FSharpGlyph.EventPrivate: + { + return Microsoft.CodeAnalysis.Glyph.EventPrivate; + } + case FSharpGlyph.EventInternal: + { + return Microsoft.CodeAnalysis.Glyph.EventInternal; + } + case FSharpGlyph.ExtensionMethodPublic: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic; + } + case FSharpGlyph.ExtensionMethodProtected: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected; + } + case FSharpGlyph.ExtensionMethodPrivate: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate; + } + case FSharpGlyph.ExtensionMethodInternal: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal; + } + case FSharpGlyph.FieldPublic: + { + return Microsoft.CodeAnalysis.Glyph.FieldPublic; + } + case FSharpGlyph.FieldProtected: + { + return Microsoft.CodeAnalysis.Glyph.FieldProtected; + } + case FSharpGlyph.FieldPrivate: + { + return Microsoft.CodeAnalysis.Glyph.FieldPrivate; + } + case FSharpGlyph.FieldInternal: + { + return Microsoft.CodeAnalysis.Glyph.FieldInternal; + } + case FSharpGlyph.InterfacePublic: + { + return Microsoft.CodeAnalysis.Glyph.InterfacePublic; + } + case FSharpGlyph.InterfaceProtected: + { + return Microsoft.CodeAnalysis.Glyph.InterfaceProtected; + } + case FSharpGlyph.InterfacePrivate: + { + return Microsoft.CodeAnalysis.Glyph.InterfacePrivate; + } + case FSharpGlyph.InterfaceInternal: + { + return Microsoft.CodeAnalysis.Glyph.InterfaceInternal; + } + case FSharpGlyph.Intrinsic: + { + return Microsoft.CodeAnalysis.Glyph.Intrinsic; + } + case FSharpGlyph.Keyword: + { + return Microsoft.CodeAnalysis.Glyph.Keyword; + } + case FSharpGlyph.Label: + { + return Microsoft.CodeAnalysis.Glyph.Label; + } + case FSharpGlyph.Local: + { + return Microsoft.CodeAnalysis.Glyph.Local; + } + case FSharpGlyph.Namespace: + { + return Microsoft.CodeAnalysis.Glyph.Namespace; + } + case FSharpGlyph.MethodPublic: + { + return Microsoft.CodeAnalysis.Glyph.MethodPublic; + } + case FSharpGlyph.MethodProtected: + { + return Microsoft.CodeAnalysis.Glyph.MethodProtected; + } + case FSharpGlyph.MethodPrivate: + { + return Microsoft.CodeAnalysis.Glyph.MethodPrivate; + } + case FSharpGlyph.MethodInternal: + { + return Microsoft.CodeAnalysis.Glyph.MethodInternal; + } + case FSharpGlyph.ModulePublic: + { + return Microsoft.CodeAnalysis.Glyph.ModulePublic; + } + case FSharpGlyph.ModuleProtected: + { + return Microsoft.CodeAnalysis.Glyph.ModuleProtected; + } + case FSharpGlyph.ModulePrivate: + { + return Microsoft.CodeAnalysis.Glyph.ModulePrivate; + } + case FSharpGlyph.ModuleInternal: + { + return Microsoft.CodeAnalysis.Glyph.ModuleInternal; + } + case FSharpGlyph.OpenFolder: + { + return Microsoft.CodeAnalysis.Glyph.OpenFolder; + } + case FSharpGlyph.Operator: + { + return Microsoft.CodeAnalysis.Glyph.Operator; + } + case FSharpGlyph.Parameter: + { + return Microsoft.CodeAnalysis.Glyph.Parameter; + } + case FSharpGlyph.PropertyPublic: + { + return Microsoft.CodeAnalysis.Glyph.PropertyPublic; + } + case FSharpGlyph.PropertyProtected: + { + return Microsoft.CodeAnalysis.Glyph.PropertyProtected; + } + case FSharpGlyph.PropertyPrivate: + { + return Microsoft.CodeAnalysis.Glyph.PropertyPrivate; + } + case FSharpGlyph.PropertyInternal: + { + return Microsoft.CodeAnalysis.Glyph.PropertyInternal; + } + case FSharpGlyph.RangeVariable: + { + return Microsoft.CodeAnalysis.Glyph.RangeVariable; + } + case FSharpGlyph.Reference: + { + return Microsoft.CodeAnalysis.Glyph.Reference; + } + case FSharpGlyph.StructurePublic: + { + return Microsoft.CodeAnalysis.Glyph.StructurePublic; + } + case FSharpGlyph.StructureProtected: + { + return Microsoft.CodeAnalysis.Glyph.StructureProtected; + } + case FSharpGlyph.StructurePrivate: + { + return Microsoft.CodeAnalysis.Glyph.StructurePrivate; + } + case FSharpGlyph.StructureInternal: + { + return Microsoft.CodeAnalysis.Glyph.StructureInternal; + } + case FSharpGlyph.TypeParameter: + { + return Microsoft.CodeAnalysis.Glyph.TypeParameter; + } + case FSharpGlyph.Snippet: + { + return Microsoft.CodeAnalysis.Glyph.Snippet; + } + case FSharpGlyph.CompletionWarning: + { + return Microsoft.CodeAnalysis.Glyph.CompletionWarning; + } + case FSharpGlyph.AddReference: + { + return Microsoft.CodeAnalysis.Glyph.AddReference; + } + case FSharpGlyph.NuGet: + { + return Microsoft.CodeAnalysis.Glyph.NuGet; + } + case FSharpGlyph.TargetTypeMatch: + { + return Microsoft.CodeAnalysis.Glyph.TargetTypeMatch; + } + default: + { + throw ExceptionUtilities.UnexpectedValue(glyph); + } + } + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToMatchKindHelpers.cs b/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToMatchKindHelpers.cs new file mode 100644 index 0000000000000..2deda2c764019 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToMatchKindHelpers.cs @@ -0,0 +1,67 @@ +// 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.ExternalAccess.FSharp.NavigateTo; +using Microsoft.CodeAnalysis.NavigateTo; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.NavigateTo +{ + internal static class FSharpNavigateToMatchKindHelpers + { + public static NavigateToMatchKind ConvertTo(FSharpNavigateToMatchKind kind) + { + switch (kind) + { + case FSharpNavigateToMatchKind.Exact: + { + return NavigateToMatchKind.Exact; + } + case FSharpNavigateToMatchKind.Prefix: + { + return NavigateToMatchKind.Prefix; + } + case FSharpNavigateToMatchKind.Substring: + { + return NavigateToMatchKind.Substring; + } + case FSharpNavigateToMatchKind.Regular: + { + return NavigateToMatchKind.Regular; + } + case FSharpNavigateToMatchKind.None: + { + return NavigateToMatchKind.None; + } + case FSharpNavigateToMatchKind.CamelCaseExact: + { + return NavigateToMatchKind.CamelCaseExact; + } + case FSharpNavigateToMatchKind.CamelCasePrefix: + { + return NavigateToMatchKind.CamelCasePrefix; + } + case FSharpNavigateToMatchKind.CamelCaseNonContiguousPrefix: + { + return NavigateToMatchKind.CamelCaseNonContiguousPrefix; + } + case FSharpNavigateToMatchKind.CamelCaseSubstring: + { + return NavigateToMatchKind.CamelCaseSubstring; + } + case FSharpNavigateToMatchKind.CamelCaseNonContiguousSubstring: + { + return NavigateToMatchKind.CamelCaseNonContiguousSubstring; + } + case FSharpNavigateToMatchKind.Fuzzy: + { + return NavigateToMatchKind.Fuzzy; + } + default: + { + throw ExceptionUtilities.UnexpectedValue(kind); + } + } + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToSearchService.cs b/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToSearchService.cs new file mode 100644 index 0000000000000..db82d6497b8df --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/FSharpNavigateToSearchService.cs @@ -0,0 +1,43 @@ +// 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.Collections.Immutable; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.NavigateTo; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.NavigateTo; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.NavigateTo +{ + [Shared] + [ExportLanguageService(typeof(INavigateToSearchService_RemoveInterfaceAboveAndRenameThisAfterInternalsVisibleToUsersUpdate), LanguageNames.FSharp)] + internal class FSharpNavigateToSearchService : INavigateToSearchService_RemoveInterfaceAboveAndRenameThisAfterInternalsVisibleToUsersUpdate + { + private readonly IFSharpNavigateToSearchService _service; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpNavigateToSearchService(IFSharpNavigateToSearchService service) + { + _service = service; + } + + public IImmutableSet KindsProvided => _service.KindsProvided; + + public bool CanFilter => _service.CanFilter; + + public async Task> SearchDocumentAsync(Document document, string searchPattern, IImmutableSet kinds, CancellationToken cancellationToken) + { + var results = await _service.SearchDocumentAsync(document, searchPattern, kinds, cancellationToken).ConfigureAwait(false); + return results.SelectAsArray(x => (INavigateToSearchResult)new InternalFSharpNavigateToSearchResult(x)); + } + + public async Task> SearchProjectAsync(Project project, ImmutableArray priorityDocuments, string searchPattern, IImmutableSet kinds, CancellationToken cancellationToken) + { + var results = await _service.SearchProjectAsync(project, priorityDocuments, searchPattern, kinds, cancellationToken).ConfigureAwait(false); + return results.SelectAsArray(x => (INavigateToSearchResult)new InternalFSharpNavigateToSearchResult(x)); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/InternalFSharpNavigateToSearchResult.cs b/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/InternalFSharpNavigateToSearchResult.cs new file mode 100644 index 0000000000000..05f3594abd4f9 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/NavigateTo/InternalFSharpNavigateToSearchResult.cs @@ -0,0 +1,41 @@ +// 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.ExternalAccess.FSharp.Internal.Navigation; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.NavigateTo; +using Microsoft.CodeAnalysis.NavigateTo; +using Microsoft.CodeAnalysis.Navigation; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.NavigateTo +{ + internal class InternalFSharpNavigateToSearchResult : INavigateToSearchResult + { + public InternalFSharpNavigateToSearchResult(FSharpNavigateToSearchResult result) + { + AdditionalInformation = result.AdditionalInformation; + Kind = result.Kind; + MatchKind = FSharpNavigateToMatchKindHelpers.ConvertTo(result.MatchKind); + Name = result.Name; + NavigableItem = new InternalFSharpNavigableItem(result.NavigableItem); + } + + public string AdditionalInformation { get; } + + public string Kind { get; } + + public NavigateToMatchKind MatchKind { get; } + + public bool IsCaseSensitive => false; + + public string Name { get; } + + public ImmutableArray NameMatchSpans => ImmutableArray.Empty; + + public string SecondarySort => null; + + public string Summary => null; + + public INavigableItem NavigableItem { get; } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Navigation/InternalFSharpNavigableItem.cs b/src/Tools/ExternalAccess/FSharp/Internal/Navigation/InternalFSharpNavigableItem.cs new file mode 100644 index 0000000000000..8cb8aced23088 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Navigation/InternalFSharpNavigableItem.cs @@ -0,0 +1,34 @@ +// 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.ExternalAccess.FSharp.Navigation; +using Microsoft.CodeAnalysis.Navigation; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Navigation +{ + internal class InternalFSharpNavigableItem : INavigableItem + { + public InternalFSharpNavigableItem(FSharpNavigableItem item) + { + Glyph = FSharpGlyphHelpers.ConvertTo(item.Glyph); + DisplayTaggedParts = item.DisplayTaggedParts; + Document = item.Document; + SourceSpan = item.SourceSpan; + } + + public Glyph Glyph { get; } + + public ImmutableArray DisplayTaggedParts { get; } + + public bool DisplayFileLocation => true; + + public bool IsImplicitlyDeclared => false; + + public Document Document { get; } + + public TextSpan SourceSpan { get; } + + public ImmutableArray ChildItems => ImmutableArray.Empty; + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs b/src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs new file mode 100644 index 0000000000000..a94a34835c57c --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs @@ -0,0 +1,68 @@ +// 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.Linq; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.SignatureHelp; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.SignatureHelp +{ + [Shared] + [ExportSignatureHelpProvider(nameof(FSharpSignatureHelpProvider), LanguageNames.FSharp)] + internal class FSharpSignatureHelpProvider : ISignatureHelpProvider + { + private readonly IFSharpSignatureHelpProvider _provider; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpSignatureHelpProvider(IFSharpSignatureHelpProvider provider) + { + _provider = provider; + } + + public async Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, CancellationToken cancellationToken) + { + var mappedTriggerReason = FSharpSignatureHelpTriggerReasonHelpers.ConvertFrom(triggerInfo.TriggerReason); + var mappedTriggerInfo = new FSharpSignatureHelpTriggerInfo(mappedTriggerReason, triggerInfo.TriggerCharacter); + var mappedSignatureHelpItems = await _provider.GetItemsAsync(document, position, mappedTriggerInfo, cancellationToken).ConfigureAwait(false); + + return new SignatureHelpItems( + mappedSignatureHelpItems.Items.Select(x => + new SignatureHelpItem( + x.IsVariadic, + x.DocumentationFactory, + x.PrefixDisplayParts, + x.SeparatorDisplayParts, + x.SuffixDisplayParts, + x.Parameters.Select(y => + new SignatureHelpParameter( + y.Name, + y.IsOptional, + y.DocumentationFactory, + y.DisplayParts, + y.PrefixDisplayParts, + y.SuffixDisplayParts, + y.SelectedDisplayParts)).ToList(), + x.DescriptionParts)).ToList(), + mappedSignatureHelpItems.ApplicableSpan, + mappedSignatureHelpItems.ArgumentIndex, + mappedSignatureHelpItems.ArgumentCount, + mappedSignatureHelpItems.ArgumentName, + mappedSignatureHelpItems.SelectedItemIndex); + } + + public bool IsRetriggerCharacter(char ch) + { + return _provider.IsRetriggerCharacter(ch); + } + + public bool IsTriggerCharacter(char ch) + { + return _provider.IsTriggerCharacter(ch); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpTriggerReasonHelpers.cs b/src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpTriggerReasonHelpers.cs new file mode 100644 index 0000000000000..bde026f627da6 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpTriggerReasonHelpers.cs @@ -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; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp; +using Microsoft.CodeAnalysis.SignatureHelp; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.SignatureHelp +{ + internal static class FSharpSignatureHelpTriggerReasonHelpers + { + public static FSharpSignatureHelpTriggerReason ConvertFrom(SignatureHelpTriggerReason triggerReason) + { + switch (triggerReason) + { + case SignatureHelpTriggerReason.InvokeSignatureHelpCommand: + { + return FSharpSignatureHelpTriggerReason.InvokeSignatureHelpCommand; + } + + case SignatureHelpTriggerReason.RetriggerCommand: + { + return FSharpSignatureHelpTriggerReason.RetriggerCommand; + } + + case SignatureHelpTriggerReason.TypeCharCommand: + { + return FSharpSignatureHelpTriggerReason.TypeCharCommand; + } + + default: + { + throw ExceptionUtilities.UnexpectedValue(triggerReason); + } + } + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/Structure/FSharpBlockStructureService.cs b/src/Tools/ExternalAccess/FSharp/Internal/Structure/FSharpBlockStructureService.cs new file mode 100644 index 0000000000000..96705b4fa2a7d --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/Structure/FSharpBlockStructureService.cs @@ -0,0 +1,34 @@ +// 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.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Structure; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure; +using Microsoft.CodeAnalysis.Host.Mef; +using System; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Structure +{ + [Shared] + [ExportLanguageService(typeof(BlockStructureService), LanguageNames.FSharp)] + internal class FSharpBlockStructureService : BlockStructureService + { + private readonly IFSharpBlockStructureService _service; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpBlockStructureService(IFSharpBlockStructureService service) + { + _service = service; + } + + public override string Language => LanguageNames.FSharp; + + public override async Task GetBlockStructureAsync(Document document, CancellationToken cancellationToken) + { + var blockStructure = await _service.GetBlockStructureAsync(document, cancellationToken).ConfigureAwait(false); + return new BlockStructure(blockStructure.Spans.SelectAsArray(x => new BlockSpan(x.Type, x.IsCollapsible, x.TextSpan, x.HintSpan, x.BannerText, x.AutoCollapse, x.IsDefaultCollapsed))); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/Text/Classification/FSharpSignatureHelpClassifierProvider.cs b/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/Text/Classification/FSharpSignatureHelpClassifierProvider.cs new file mode 100644 index 0000000000000..96b5da8bb62ae --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/Text/Classification/FSharpSignatureHelpClassifierProvider.cs @@ -0,0 +1,33 @@ +// 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.ComponentModel.Composition; +using Microsoft.VisualStudio.Text.Classification; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor; +using Microsoft.VisualStudio.Utilities; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.VisualStudio.Text; +using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Presentation; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.VisualStudio.Text.Classification +{ + [Export(typeof(IClassifierProvider))] + [ContentType(FSharpContentTypeNames.FSharpSignatureHelpContentType)] + internal class FSharpSignatureHelpClassifierProvider : IClassifierProvider + { + private readonly ClassificationTypeMap _typeMap; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public FSharpSignatureHelpClassifierProvider(ClassificationTypeMap typeMap) + { + _typeMap = typeMap; + } + + public IClassifier GetClassifier(ITextBuffer textBuffer) + { + return new SignatureHelpClassifier(textBuffer, _typeMap); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj b/src/Tools/ExternalAccess/FSharp/Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj index f280b723cf640..da1601b8115d8 100644 --- a/src/Tools/ExternalAccess/FSharp/Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj +++ b/src/Tools/ExternalAccess/FSharp/Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj @@ -21,6 +21,7 @@ --> + @@ -76,9 +77,23 @@ - + + + True + True + ExternalAccessFSharpResources.resx + + + + + + ResXFileCodeGenerator + ExternalAccessFSharpResources.Designer.cs + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToItemKind.cs b/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToItemKind.cs new file mode 100644 index 0000000000000..c2ac4b589037f --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToItemKind.cs @@ -0,0 +1,25 @@ +// 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.NavigateTo; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.NavigateTo +{ + internal static class FSharpNavigateToItemKind + { + public static string Line => NavigateToItemKind.Line; + public static string File = NavigateToItemKind.File; + public static string Class => NavigateToItemKind.Class; + public static string Structure => NavigateToItemKind.Structure; + public static string Interface => NavigateToItemKind.Interface; + public static string Delegate => NavigateToItemKind.Delegate; + public static string Enum => NavigateToItemKind.Enum; + public static string Module => NavigateToItemKind.Module; + public static string Constant => NavigateToItemKind.Constant; + public static string EnumItem => NavigateToItemKind.EnumItem; + public static string Field => NavigateToItemKind.Field; + public static string Method => NavigateToItemKind.Method; + public static string Property => NavigateToItemKind.Property; + public static string Event => NavigateToItemKind.Event; + public static string OtherSymbol => NavigateToItemKind.OtherSymbol; + } +} diff --git a/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToMatchKind.cs b/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToMatchKind.cs new file mode 100644 index 0000000000000..c3a8e4ce20b06 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToMatchKind.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.NavigateTo +{ + internal enum FSharpNavigateToMatchKind + { + Exact = 0, + Prefix = 1, + Substring = 2, + Regular = 3, + None = 4, + CamelCaseExact = 5, + CamelCasePrefix = 6, + CamelCaseNonContiguousPrefix = 7, + CamelCaseSubstring = 8, + CamelCaseNonContiguousSubstring = 9, + Fuzzy = 10 + } +} diff --git a/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToSearchResult.cs b/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToSearchResult.cs new file mode 100644 index 0000000000000..3bcd0e14d48a9 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/NavigateTo/FSharpNavigateToSearchResult.cs @@ -0,0 +1,33 @@ +// 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.ExternalAccess.FSharp.Navigation; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.NavigateTo +{ + internal class FSharpNavigateToSearchResult + { + public FSharpNavigateToSearchResult( + string additionalInformation, + string kind, + FSharpNavigateToMatchKind matchKind, + string name, + FSharpNavigableItem navigateItem) + { + AdditionalInformation = additionalInformation; + Kind = kind; + Name = name; + MatchKind = matchKind; + NavigableItem = navigateItem; + } + + public string AdditionalInformation { get; } + + public string Kind { get; } + + public FSharpNavigateToMatchKind MatchKind { get; } + + public string Name { get; } + + public FSharpNavigableItem NavigableItem { get; } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/NavigateTo/IFSharpNavigateToSearchService.cs b/src/Tools/ExternalAccess/FSharp/NavigateTo/IFSharpNavigateToSearchService.cs new file mode 100644 index 0000000000000..fd6060027553f --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/NavigateTo/IFSharpNavigateToSearchService.cs @@ -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.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.NavigateTo +{ + internal interface IFSharpNavigateToSearchService + { + IImmutableSet KindsProvided + { + get; + } + + bool CanFilter + { + get; + } + + Task> SearchProjectAsync(Project project, ImmutableArray priorityDocuments, string searchPattern, IImmutableSet kinds, CancellationToken cancellationToken); + Task> SearchDocumentAsync(Document document, string searchPattern, IImmutableSet kinds, CancellationToken cancellationToken); + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs new file mode 100644 index 0000000000000..eaf9c8d1deaaa --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs @@ -0,0 +1,68 @@ +// 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.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Navigation; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation +{ + [ExportWorkspaceService(typeof(IFSharpDocumentNavigationService)), Shared] + internal class FSharpDocumentNavigationService : IFSharpDocumentNavigationService + { + /// + /// Determines whether it is possible to navigate to the given position in the specified document. + /// + public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan) + { + var service = workspace.Services.GetService(); + return service.CanNavigateToSpan(workspace, documentId, textSpan); + } + + /// + /// Determines whether it is possible to navigate to the given line/offset in the specified document. + /// + public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset) + { + var service = workspace.Services.GetService(); + return service.CanNavigateToLineAndOffset(workspace, documentId, lineNumber, offset); + } + + /// + /// Determines whether it is possible to navigate to the given virtual position in the specified document. + /// + public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0) + { + var service = workspace.Services.GetService(); + return service.CanNavigateToPosition(workspace, documentId, position, virtualSpace); + } + + /// + /// Navigates to the given position in the specified document, opening it if necessary. + /// + public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options = null) + { + var service = workspace.Services.GetService(); + return service.TryNavigateToSpan(workspace, documentId, textSpan, options); + } + + /// + /// Navigates to the given line/offset in the specified document, opening it if necessary. + /// + public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options = null) + { + var service = workspace.Services.GetService(); + return service.TryNavigateToLineAndOffset(workspace, documentId, lineNumber, offset, options); + } + + /// + /// Navigates to the given virtual position in the specified document, opening it if necessary. + /// + public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0, OptionSet options = null) + { + var service = workspace.Services.GetService(); + return service.TryNavigateToPosition(workspace, documentId, position, virtualSpace, options); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigableItem.cs b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigableItem.cs new file mode 100644 index 0000000000000..8f615c82e1e91 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigableItem.cs @@ -0,0 +1,26 @@ +// 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.Text; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation +{ + internal class FSharpNavigableItem + { + public FSharpNavigableItem(FSharpGlyph glyph, ImmutableArray displayTaggedParts, Document document, TextSpan sourceSpan) + { + Glyph = glyph; + DisplayTaggedParts = displayTaggedParts; + Document = document; + SourceSpan = sourceSpan; + } + + public FSharpGlyph Glyph { get; } + + public ImmutableArray DisplayTaggedParts { get; } + + public Document Document { get; } + + public TextSpan SourceSpan { get; } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigationOptions.cs b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigationOptions.cs new file mode 100644 index 0000000000000..b8913fcc98f58 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpNavigationOptions.cs @@ -0,0 +1,12 @@ +// 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.Navigation; +using Microsoft.CodeAnalysis.Options; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation +{ + internal static class FSharpNavigationOptions + { + public static Option PreferProvisionalTab => NavigationOptions.PreferProvisionalTab; + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs b/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs new file mode 100644 index 0000000000000..0f7d696cae118 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs @@ -0,0 +1,41 @@ +// 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.Host; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation +{ + internal interface IFSharpDocumentNavigationService : IWorkspaceService + { + /// + /// Determines whether it is possible to navigate to the given position in the specified document. + /// + bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan); + + /// + /// Determines whether it is possible to navigate to the given line/offset in the specified document. + /// + bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset); + + /// + /// Determines whether it is possible to navigate to the given virtual position in the specified document. + /// + bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0); + + /// + /// Navigates to the given position in the specified document, opening it if necessary. + /// + bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options = null); + + /// + /// Navigates to the given line/offset in the specified document, opening it if necessary. + /// + bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options = null); + + /// + /// Navigates to the given virtual position in the specified document, opening it if necessary. + /// + bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0, OptionSet options = null); + } +} diff --git a/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItem.cs b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItem.cs new file mode 100644 index 0000000000000..69d2519335b7e --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItem.cs @@ -0,0 +1,80 @@ +// 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.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp +{ + internal class FSharpSignatureHelpItem + { + /// + /// True if this signature help item can have an unbounded number of arguments passed to it. + /// If it is variadic then the last parameter will be considered selected, even if the + /// selected parameter index strictly goes past the number of defined parameters for this + /// item. + /// + public bool IsVariadic { get; } + + public ImmutableArray PrefixDisplayParts { get; } + public ImmutableArray SuffixDisplayParts { get; } + + // TODO: This probably won't be sufficient for VB query signature help. It has + // arbitrary separators between parameters. + public ImmutableArray SeparatorDisplayParts { get; } + + public ImmutableArray Parameters { get; } + + public ImmutableArray DescriptionParts { get; internal set; } + + public Func> DocumentationFactory { get; } + + private static readonly Func> s_emptyDocumentationFactory = + _ => SpecializedCollections.EmptyEnumerable(); + + public FSharpSignatureHelpItem( + bool isVariadic, + Func> documentationFactory, + IEnumerable prefixParts, + IEnumerable separatorParts, + IEnumerable suffixParts, + IEnumerable parameters, + IEnumerable descriptionParts) + { + if (isVariadic && !parameters.Any()) + { + throw new ArgumentException(FeaturesResources.Variadic_SignatureHelpItem_must_have_at_least_one_parameter); + } + + this.IsVariadic = isVariadic; + this.DocumentationFactory = documentationFactory ?? s_emptyDocumentationFactory; + this.PrefixDisplayParts = prefixParts.ToImmutableArrayOrEmpty(); + this.SeparatorDisplayParts = separatorParts.ToImmutableArrayOrEmpty(); + this.SuffixDisplayParts = suffixParts.ToImmutableArrayOrEmpty(); + this.Parameters = parameters.ToImmutableArrayOrEmpty(); + this.DescriptionParts = descriptionParts.ToImmutableArrayOrEmpty(); + } + + internal IEnumerable GetAllParts() + { + return + PrefixDisplayParts.Concat( + SeparatorDisplayParts.Concat( + SuffixDisplayParts.Concat( + Parameters.SelectMany(p => p.GetAllParts())).Concat( + DescriptionParts))); + } + + public override string ToString() + { + var prefix = string.Concat(PrefixDisplayParts); + var suffix = string.Concat(SuffixDisplayParts); + var parameters = string.Join(string.Concat(SeparatorDisplayParts), Parameters); + var description = string.Concat(DescriptionParts); + return string.Concat(prefix, parameters, suffix, description); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItems.cs b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItems.cs new file mode 100644 index 0000000000000..3735db23c0d02 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpItems.cs @@ -0,0 +1,103 @@ +// 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.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp +{ + internal class FSharpSignatureHelpItems + { + /// + /// The list of items to present to the user. + /// + public IList Items { get; } + + /// + /// The span this session applies to. + /// + /// Navigation outside this span will cause signature help to be dismissed. + /// + public TextSpan ApplicableSpan { get; } + + /// + /// Returns the specified argument index that the provided position is at in the current document. This + /// index may be greater than the number of arguments in the selected . + /// + public int ArgumentIndex { get; } + + /// + /// Returns the total number of arguments that have been typed in the current document. This may be + /// greater than the ArgumentIndex if there are additional arguments after the provided position. + /// + public int ArgumentCount { get; } + + /// + /// Returns the name of specified argument at the current position in the document. + /// This only applies to languages that allow the user to provide named arguments. + /// If no named argument exists at the current position, then null should be returned. + /// + /// This value is used to determine which documentation comment should be provided for the current + /// parameter. Normally this is determined simply by determining the parameter by index. + /// + public string ArgumentName { get; } + + /// + /// The item to select by default. If this is then the controller will + /// pick the first item that has enough arguments to be viable based on what argument + /// position the user is currently inside of. + /// + public int? SelectedItemIndex { get; } + + public FSharpSignatureHelpItems( + IList items, + TextSpan applicableSpan, + int argumentIndex, + int argumentCount, + string argumentName, + int? selectedItem = null) + { + Contract.ThrowIfNull(items); + Contract.ThrowIfTrue(items.IsEmpty()); + Contract.ThrowIfTrue(selectedItem.HasValue && selectedItem.Value >= items.Count); + + if (argumentIndex < 0) + { + throw new ArgumentException($"{nameof(argumentIndex)} < 0. {argumentIndex} < 0", nameof(argumentIndex)); + } + + if (argumentCount < argumentIndex) + { + throw new ArgumentException($"{nameof(argumentCount)} < {nameof(argumentIndex)}. {argumentCount} < {argumentIndex}", nameof(argumentIndex)); + } + + // Adjust the `selectedItem` index if duplicates are able to be removed. + var distinctItems = items.Distinct().ToList(); + if (selectedItem.HasValue && items.Count != distinctItems.Count) + { + // `selectedItem` index has already been determined to be valid, it now needs to be adjusted to point + // to the equivalent item in the reduced list to account for duplicates being removed + // E.g., + // items = {A, A, B, B, C, D} + // selectedItem = 4 (index for item C) + // ergo + // distinctItems = {A, B, C, D} + // actualItem = C + // selectedItem = 2 (index for item C) + var actualItem = items[selectedItem.Value]; + selectedItem = distinctItems.IndexOf(actualItem); + Debug.Assert(selectedItem.Value >= 0, "actual item was not part of the final list"); + } + + this.Items = distinctItems; + this.ApplicableSpan = applicableSpan; + this.ArgumentIndex = argumentIndex; + this.ArgumentCount = argumentCount; + this.SelectedItemIndex = selectedItem; + this.ArgumentName = argumentName; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpParameter.cs b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpParameter.cs new file mode 100644 index 0000000000000..78965b2d4f956 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpParameter.cs @@ -0,0 +1,88 @@ +// 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.Collections.Generic; +using System.Linq; +using System.Threading; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp +{ + internal class FSharpSignatureHelpParameter + { + /// + /// The name of this parameter. + /// + public string Name { get; } + + /// + /// Documentation for this parameter. This should normally be presented to the user when + /// this parameter is selected. + /// + public Func> DocumentationFactory { get; } + + /// + /// Display parts to show before the normal display parts for the parameter. + /// + public IList PrefixDisplayParts { get; } + + /// + /// Display parts to show after the normal display parts for the parameter. + /// + public IList SuffixDisplayParts { get; } + + /// + /// Display parts for this parameter. This should normally be presented to the user as part + /// of the entire signature display. + /// + public IList DisplayParts { get; } + + /// + /// True if this parameter is optional or not. Optional parameters may be presented in a + /// different manner to users. + /// + public bool IsOptional { get; } + + /// + /// Display parts for this parameter that should be presented to the user when this + /// parameter is selected. + /// + public IList SelectedDisplayParts { get; } + + private static readonly Func> s_emptyDocumentationFactory = + _ => SpecializedCollections.EmptyEnumerable(); + + public FSharpSignatureHelpParameter( + string name, + bool isOptional, + Func> documentationFactory, + IEnumerable displayParts, + IEnumerable prefixDisplayParts = null, + IEnumerable suffixDisplayParts = null, + IEnumerable selectedDisplayParts = null) + { + this.Name = name ?? string.Empty; + this.IsOptional = isOptional; + this.DocumentationFactory = documentationFactory ?? s_emptyDocumentationFactory; + this.DisplayParts = displayParts.ToImmutableArrayOrEmpty(); + this.PrefixDisplayParts = prefixDisplayParts.ToImmutableArrayOrEmpty(); + this.SuffixDisplayParts = suffixDisplayParts.ToImmutableArrayOrEmpty(); + this.SelectedDisplayParts = selectedDisplayParts.ToImmutableArrayOrEmpty(); + } + + internal IEnumerable GetAllParts() + { + return this.PrefixDisplayParts.Concat(this.DisplayParts) + .Concat(this.SuffixDisplayParts) + .Concat(this.SelectedDisplayParts); + } + + public override string ToString() + { + var prefix = string.Concat(PrefixDisplayParts); + var display = string.Concat(DisplayParts); + var suffix = string.Concat(SuffixDisplayParts); + return string.Concat(prefix, display, suffix); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerInfo.cs b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerInfo.cs new file mode 100644 index 0000000000000..c07dd984c3485 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerInfo.cs @@ -0,0 +1,19 @@ +// 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 Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp +{ + internal readonly struct FSharpSignatureHelpTriggerInfo + { + public FSharpSignatureHelpTriggerReason TriggerReason { get; } + public char? TriggerCharacter { get; } + + internal FSharpSignatureHelpTriggerInfo(FSharpSignatureHelpTriggerReason triggerReason, char? triggerCharacter = null) + { + Contract.ThrowIfTrue(triggerReason == FSharpSignatureHelpTriggerReason.TypeCharCommand && triggerCharacter == null); + this.TriggerReason = triggerReason; + this.TriggerCharacter = triggerCharacter; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerReason.cs b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerReason.cs new file mode 100644 index 0000000000000..f1b78cd2832d1 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/SignatureHelp/FSharpSignatureHelpTriggerReason.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp +{ + internal enum FSharpSignatureHelpTriggerReason + { + /// + /// Signature Help was triggered through the 'Invoke Signature Help' command + /// + InvokeSignatureHelpCommand, + + /// + /// Signature Help was triggered through the 'Type Char' command. + /// + TypeCharCommand, + + /// + /// Signature Help was triggered through typing a closing brace. + /// + RetriggerCommand, + } +} diff --git a/src/Tools/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs b/src/Tools/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs new file mode 100644 index 0000000000000..f773211bc8e63 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs @@ -0,0 +1,27 @@ +// 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; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp +{ + internal interface IFSharpSignatureHelpProvider + { + /// + /// Returns true if the character might trigger completion, + /// e.g. '(' and ',' for method invocations + /// + bool IsTriggerCharacter(char ch); + + /// + /// Returns true if the character might end a Signature Help session, + /// e.g. ')' for method invocations. + /// + bool IsRetriggerCharacter(char ch); + + /// + /// Returns valid signature help items at the specified position in the document. + /// + Task GetItemsAsync(Document document, int position, FSharpSignatureHelpTriggerInfo triggerInfo, CancellationToken cancellationToken); + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockSpan.cs b/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockSpan.cs new file mode 100644 index 0000000000000..d15f3341d2ad4 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockSpan.cs @@ -0,0 +1,68 @@ +// 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.Text; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure +{ + internal readonly struct FSharpBlockSpan + { + private const string Ellipses = "..."; + + /// + /// Whether or not this span can be collapsed. + /// + public bool IsCollapsible { get; } + + /// + /// The span of text to collapse. + /// + public TextSpan TextSpan { get; } + + /// + /// The span of text to display in the hint on mouse hover. + /// + public TextSpan HintSpan { get; } + + /// + /// The text to display inside the collapsed region. + /// + public string BannerText { get; } + + /// + /// Whether or not this region should be automatically collapsed when the 'Collapse to Definitions' command is invoked. + /// + public bool AutoCollapse { get; } + + /// + /// Whether this region should be collapsed by default when a file is opened the first time. + /// + public bool IsDefaultCollapsed { get; } + + public string Type { get; } + + public FSharpBlockSpan( + string type, bool isCollapsible, TextSpan textSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) + : this(type, isCollapsible, textSpan, textSpan, bannerText, autoCollapse, isDefaultCollapsed) + { + } + + public FSharpBlockSpan( + string type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) + { + TextSpan = textSpan; + BannerText = bannerText; + HintSpan = hintSpan; + AutoCollapse = autoCollapse; + IsDefaultCollapsed = isDefaultCollapsed; + IsCollapsible = isCollapsible; + Type = type; + } + + public override string ToString() + { + return this.TextSpan != this.HintSpan + ? $"{{Span={TextSpan}, HintSpan={HintSpan}, BannerText=\"{BannerText}\", AutoCollapse={AutoCollapse}, IsDefaultCollapsed={IsDefaultCollapsed}}}" + : $"{{Span={TextSpan}, BannerText=\"{BannerText}\", AutoCollapse={AutoCollapse}, IsDefaultCollapsed={IsDefaultCollapsed}}}"; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockStructure.cs b/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockStructure.cs new file mode 100644 index 0000000000000..647d1b5d5d784 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockStructure.cs @@ -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.Collections.Immutable; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure +{ + internal class FSharpBlockStructure + { + public ImmutableArray Spans { get; } + + public FSharpBlockStructure(ImmutableArray spans) + { + Spans = spans; + } + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockTypes.cs b/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockTypes.cs new file mode 100644 index 0000000000000..8f2902dc2d889 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Structure/FSharpBlockTypes.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 Microsoft.CodeAnalysis.Structure; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure +{ + internal static class FSharpBlockTypes + { + // Basic types. + public static string Nonstructural => BlockTypes.Nonstructural; + + // Trivstatic + public static string Comment => BlockTypes.Comment; + public static string PreprocessorRegion => BlockTypes.PreprocessorRegion; + + // Top static declarations. + public static string Imports => BlockTypes.Imports; + public static string Namespace => BlockTypes.Namespace; + public static string Type => BlockTypes.Type; + public static string Member => BlockTypes.Member; + + // Statstatic and expressions. + public static string Statement => BlockTypes.Statement; + public static string Conditional => BlockTypes.Conditional; + public static string Loop => BlockTypes.Loop; + + public static string Expression => BlockTypes.Expression; + } +} diff --git a/src/Tools/ExternalAccess/FSharp/Structure/IFSharpBlockStructureService.cs b/src/Tools/ExternalAccess/FSharp/Structure/IFSharpBlockStructureService.cs new file mode 100644 index 0000000000000..7a3a9fefadd0f --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/Structure/IFSharpBlockStructureService.cs @@ -0,0 +1,12 @@ +// 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; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure +{ + internal interface IFSharpBlockStructureService + { + Task GetBlockStructureAsync(Document document, CancellationToken cancellationToken); + } +} diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.cs.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.cs.xlf new file mode 100644 index 0000000000000..42ef58b308cab --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.cs.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.de.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.de.xlf new file mode 100644 index 0000000000000..f978efb3d2893 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.de.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.es.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.es.xlf new file mode 100644 index 0000000000000..563123a994995 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.es.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.fr.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.fr.xlf new file mode 100644 index 0000000000000..91d0dca07bc85 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.fr.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.it.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.it.xlf new file mode 100644 index 0000000000000..b439af9ecfd27 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.it.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ja.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ja.xlf new file mode 100644 index 0000000000000..be4cb1a7bb962 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ja.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ko.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ko.xlf new file mode 100644 index 0000000000000..ee7b880ac81fe --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ko.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pl.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pl.xlf new file mode 100644 index 0000000000000..f11a2d22f02ef --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pl.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pt-BR.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pt-BR.xlf new file mode 100644 index 0000000000000..ef35520ae22dc --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.pt-BR.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ru.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ru.xlf new file mode 100644 index 0000000000000..fc57cf5d5dee6 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ru.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.tr.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.tr.xlf new file mode 100644 index 0000000000000..0500d617763ac --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.tr.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hans.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hans.xlf new file mode 100644 index 0000000000000..8467efdbe14f8 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hans.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hant.xlf b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hant.xlf new file mode 100644 index 0000000000000..608a49cb90560 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.zh-Hant.xlf @@ -0,0 +1,132 @@ + + + + + + Add an assembly reference to '{0}' + Add an assembly reference to '{0}' + + + + Add 'new' keyword + Add 'new' keyword + + + + Add a project reference to '{0}' + Add a project reference to '{0}' + + + + Cannot determine the symbol under the caret + Cannot determine the symbol under the caret + + + + Cannot navigate to the requested location + Cannot navigate to the requested location + + + + Exceptions: + Exceptions: + + + + F# Disposable Types + F# Disposable Types + + + + F# Functions / Methods + F# Functions / Methods + + + + F# Mutable Variables / Reference Cells + F# Mutable Variables / Reference Cells + + + + F# Printf Format + F# Printf Format + + + + F# Properties + F# Properties + + + + Generic parameters: + Generic parameters: + + + + Implement interface + Implement interface + + + + Implement interface without type annotation + Implement interface without type annotation + + + + Locating the symbol under the caret... + Locating the symbol under the caret... + + + + Name can be simplified. + Name can be simplified. + + + + Navigate to symbol failed: {0} + Navigate to symbol failed: {0} + + + + Navigating to symbol... + Navigating to symbol... + + + + Prefix '{0}' with underscore + Prefix '{0}' with underscore + + + + Remove unused open declarations + Remove unused open declarations + + + + Rename '{0}' to '__' + Rename '{0}' to '__' + + + + Rename '{0}' to '_' + Rename '{0}' to '_' + + + + Simplify name + Simplify name + + + + The value is unused + The value is unused + + + + Open declaration can be removed. + Open declaration can be removed. + + + + + \ No newline at end of file diff --git a/src/Tools/ExternalAccess/FSharpTest/FSharpGlyphTests.cs b/src/Tools/ExternalAccess/FSharpTest/FSharpGlyphTests.cs new file mode 100644 index 0000000000000..ab30e91cd2262 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharpTest/FSharpGlyphTests.cs @@ -0,0 +1,677 @@ +// 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.Collections.Generic; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests +{ + public class FSharpGlyphTests + { + public static IEnumerable enumValues() + { + foreach (var number in Enum.GetValues(typeof(FSharpGlyph))) + { + yield return new object[] { number }; + } + } + + public static IEnumerable enumValuesOpposite() + { + foreach (var number in Enum.GetValues(typeof(Glyph))) + { + yield return new object[] { number }; + } + } + + internal static FSharpGlyph GetExpectedFSharpGlyph(Microsoft.CodeAnalysis.Glyph glyph) + { + switch (glyph) + { + case Microsoft.CodeAnalysis.Glyph.None: + { + return FSharpGlyph.None; + } + case Microsoft.CodeAnalysis.Glyph.Assembly: + { + return FSharpGlyph.Assembly; + } + case Microsoft.CodeAnalysis.Glyph.BasicFile: + { + return FSharpGlyph.BasicFile; + } + case Microsoft.CodeAnalysis.Glyph.BasicProject: + { + return FSharpGlyph.BasicProject; + } + case Microsoft.CodeAnalysis.Glyph.ClassPublic: + { + return FSharpGlyph.ClassPublic; + } + case Microsoft.CodeAnalysis.Glyph.ClassProtected: + { + return FSharpGlyph.ClassProtected; + } + case Microsoft.CodeAnalysis.Glyph.ClassPrivate: + { + return FSharpGlyph.ClassPrivate; + } + case Microsoft.CodeAnalysis.Glyph.ClassInternal: + { + return FSharpGlyph.ClassInternal; + } + case Microsoft.CodeAnalysis.Glyph.CSharpFile: + { + return FSharpGlyph.CSharpFile; + } + case Microsoft.CodeAnalysis.Glyph.CSharpProject: + { + return FSharpGlyph.CSharpProject; + } + case Microsoft.CodeAnalysis.Glyph.ConstantPublic: + { + return FSharpGlyph.ConstantPublic; + } + case Microsoft.CodeAnalysis.Glyph.ConstantProtected: + { + return FSharpGlyph.ConstantProtected; + } + case Microsoft.CodeAnalysis.Glyph.ConstantPrivate: + { + return FSharpGlyph.ConstantPrivate; + } + case Microsoft.CodeAnalysis.Glyph.ConstantInternal: + { + return FSharpGlyph.ConstantInternal; + } + case Microsoft.CodeAnalysis.Glyph.DelegatePublic: + { + return FSharpGlyph.DelegatePublic; + } + case Microsoft.CodeAnalysis.Glyph.DelegateProtected: + { + return FSharpGlyph.DelegateProtected; + } + case Microsoft.CodeAnalysis.Glyph.DelegatePrivate: + { + return FSharpGlyph.DelegatePrivate; + } + case Microsoft.CodeAnalysis.Glyph.DelegateInternal: + { + return FSharpGlyph.DelegateInternal; + } + case Microsoft.CodeAnalysis.Glyph.EnumPublic: + { + return FSharpGlyph.EnumPublic; + } + case Microsoft.CodeAnalysis.Glyph.EnumProtected: + { + return FSharpGlyph.EnumProtected; + } + case Microsoft.CodeAnalysis.Glyph.EnumPrivate: + { + return FSharpGlyph.EnumPrivate; + } + case Microsoft.CodeAnalysis.Glyph.EnumInternal: + { + return FSharpGlyph.EnumInternal; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberPublic: + { + return FSharpGlyph.EnumMemberPublic; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberProtected: + { + return FSharpGlyph.EnumMemberProtected; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate: + { + return FSharpGlyph.EnumMemberPrivate; + } + case Microsoft.CodeAnalysis.Glyph.EnumMemberInternal: + { + return FSharpGlyph.EnumMemberInternal; + } + case Microsoft.CodeAnalysis.Glyph.Error: + { + return FSharpGlyph.Error; + } + case Microsoft.CodeAnalysis.Glyph.StatusInformation: + { + return FSharpGlyph.StatusInformation; + } + case Microsoft.CodeAnalysis.Glyph.EventPublic: + { + return FSharpGlyph.EventPublic; + } + case Microsoft.CodeAnalysis.Glyph.EventProtected: + { + return FSharpGlyph.EventProtected; + } + case Microsoft.CodeAnalysis.Glyph.EventPrivate: + { + return FSharpGlyph.EventPrivate; + } + case Microsoft.CodeAnalysis.Glyph.EventInternal: + { + return FSharpGlyph.EventInternal; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic: + { + return FSharpGlyph.ExtensionMethodPublic; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected: + { + return FSharpGlyph.ExtensionMethodProtected; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate: + { + return FSharpGlyph.ExtensionMethodPrivate; + } + case Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal: + { + return FSharpGlyph.ExtensionMethodInternal; + } + case Microsoft.CodeAnalysis.Glyph.FieldPublic: + { + return FSharpGlyph.FieldPublic; + } + case Microsoft.CodeAnalysis.Glyph.FieldProtected: + { + return FSharpGlyph.FieldProtected; + } + case Microsoft.CodeAnalysis.Glyph.FieldPrivate: + { + return FSharpGlyph.FieldPrivate; + } + case Microsoft.CodeAnalysis.Glyph.FieldInternal: + { + return FSharpGlyph.FieldInternal; + } + case Microsoft.CodeAnalysis.Glyph.InterfacePublic: + { + return FSharpGlyph.InterfacePublic; + } + case Microsoft.CodeAnalysis.Glyph.InterfaceProtected: + { + return FSharpGlyph.InterfaceProtected; + } + case Microsoft.CodeAnalysis.Glyph.InterfacePrivate: + { + return FSharpGlyph.InterfacePrivate; + } + case Microsoft.CodeAnalysis.Glyph.InterfaceInternal: + { + return FSharpGlyph.InterfaceInternal; + } + case Microsoft.CodeAnalysis.Glyph.Intrinsic: + { + return FSharpGlyph.Intrinsic; + } + case Microsoft.CodeAnalysis.Glyph.Keyword: + { + return FSharpGlyph.Keyword; + } + case Microsoft.CodeAnalysis.Glyph.Label: + { + return FSharpGlyph.Label; + } + case Microsoft.CodeAnalysis.Glyph.Local: + { + return FSharpGlyph.Local; + } + case Microsoft.CodeAnalysis.Glyph.Namespace: + { + return FSharpGlyph.Namespace; + } + case Microsoft.CodeAnalysis.Glyph.MethodPublic: + { + return FSharpGlyph.MethodPublic; + } + case Microsoft.CodeAnalysis.Glyph.MethodProtected: + { + return FSharpGlyph.MethodProtected; + } + case Microsoft.CodeAnalysis.Glyph.MethodPrivate: + { + return FSharpGlyph.MethodPrivate; + } + case Microsoft.CodeAnalysis.Glyph.MethodInternal: + { + return FSharpGlyph.MethodInternal; + } + case Microsoft.CodeAnalysis.Glyph.ModulePublic: + { + return FSharpGlyph.ModulePublic; + } + case Microsoft.CodeAnalysis.Glyph.ModuleProtected: + { + return FSharpGlyph.ModuleProtected; + } + case Microsoft.CodeAnalysis.Glyph.ModulePrivate: + { + return FSharpGlyph.ModulePrivate; + } + case Microsoft.CodeAnalysis.Glyph.ModuleInternal: + { + return FSharpGlyph.ModuleInternal; + } + case Microsoft.CodeAnalysis.Glyph.OpenFolder: + { + return FSharpGlyph.OpenFolder; + } + case Microsoft.CodeAnalysis.Glyph.Operator: + { + return FSharpGlyph.Operator; + } + case Microsoft.CodeAnalysis.Glyph.Parameter: + { + return FSharpGlyph.Parameter; + } + case Microsoft.CodeAnalysis.Glyph.PropertyPublic: + { + return FSharpGlyph.PropertyPublic; + } + case Microsoft.CodeAnalysis.Glyph.PropertyProtected: + { + return FSharpGlyph.PropertyProtected; + } + case Microsoft.CodeAnalysis.Glyph.PropertyPrivate: + { + return FSharpGlyph.PropertyPrivate; + } + case Microsoft.CodeAnalysis.Glyph.PropertyInternal: + { + return FSharpGlyph.PropertyInternal; + } + case Microsoft.CodeAnalysis.Glyph.RangeVariable: + { + return FSharpGlyph.RangeVariable; + } + case Microsoft.CodeAnalysis.Glyph.Reference: + { + return FSharpGlyph.Reference; + } + case Microsoft.CodeAnalysis.Glyph.StructurePublic: + { + return FSharpGlyph.StructurePublic; + } + case Microsoft.CodeAnalysis.Glyph.StructureProtected: + { + return FSharpGlyph.StructureProtected; + } + case Microsoft.CodeAnalysis.Glyph.StructurePrivate: + { + return FSharpGlyph.StructurePrivate; + } + case Microsoft.CodeAnalysis.Glyph.StructureInternal: + { + return FSharpGlyph.StructureInternal; + } + case Microsoft.CodeAnalysis.Glyph.TypeParameter: + { + return FSharpGlyph.TypeParameter; + } + case Microsoft.CodeAnalysis.Glyph.Snippet: + { + return FSharpGlyph.Snippet; + } + case Microsoft.CodeAnalysis.Glyph.CompletionWarning: + { + return FSharpGlyph.CompletionWarning; + } + case Microsoft.CodeAnalysis.Glyph.AddReference: + { + return FSharpGlyph.AddReference; + } + case Microsoft.CodeAnalysis.Glyph.NuGet: + { + return FSharpGlyph.NuGet; + } + case Microsoft.CodeAnalysis.Glyph.TargetTypeMatch: + { + return FSharpGlyph.TargetTypeMatch; + } + default: + { + throw ExceptionUtilities.UnexpectedValue(glyph); + } + } + } + + internal static Microsoft.CodeAnalysis.Glyph GetExpectedGlyph(FSharpGlyph glyph) + { + switch (glyph) + { + case FSharpGlyph.None: + { + return Microsoft.CodeAnalysis.Glyph.None; + } + case FSharpGlyph.Assembly: + { + return Microsoft.CodeAnalysis.Glyph.Assembly; + } + case FSharpGlyph.BasicFile: + { + return Microsoft.CodeAnalysis.Glyph.BasicFile; + } + case FSharpGlyph.BasicProject: + { + return Microsoft.CodeAnalysis.Glyph.BasicProject; + } + case FSharpGlyph.ClassPublic: + { + return Microsoft.CodeAnalysis.Glyph.ClassPublic; + } + case FSharpGlyph.ClassProtected: + { + return Microsoft.CodeAnalysis.Glyph.ClassProtected; + } + case FSharpGlyph.ClassPrivate: + { + return Microsoft.CodeAnalysis.Glyph.ClassPrivate; + } + case FSharpGlyph.ClassInternal: + { + return Microsoft.CodeAnalysis.Glyph.ClassInternal; + } + case FSharpGlyph.CSharpFile: + { + return Microsoft.CodeAnalysis.Glyph.CSharpFile; + } + case FSharpGlyph.CSharpProject: + { + return Microsoft.CodeAnalysis.Glyph.CSharpProject; + } + case FSharpGlyph.ConstantPublic: + { + return Microsoft.CodeAnalysis.Glyph.ConstantPublic; + } + case FSharpGlyph.ConstantProtected: + { + return Microsoft.CodeAnalysis.Glyph.ConstantProtected; + } + case FSharpGlyph.ConstantPrivate: + { + return Microsoft.CodeAnalysis.Glyph.ConstantPrivate; + } + case FSharpGlyph.ConstantInternal: + { + return Microsoft.CodeAnalysis.Glyph.ConstantInternal; + } + case FSharpGlyph.DelegatePublic: + { + return Microsoft.CodeAnalysis.Glyph.DelegatePublic; + } + case FSharpGlyph.DelegateProtected: + { + return Microsoft.CodeAnalysis.Glyph.DelegateProtected; + } + case FSharpGlyph.DelegatePrivate: + { + return Microsoft.CodeAnalysis.Glyph.DelegatePrivate; + } + case FSharpGlyph.DelegateInternal: + { + return Microsoft.CodeAnalysis.Glyph.DelegateInternal; + } + case FSharpGlyph.EnumPublic: + { + return Microsoft.CodeAnalysis.Glyph.EnumPublic; + } + case FSharpGlyph.EnumProtected: + { + return Microsoft.CodeAnalysis.Glyph.EnumProtected; + } + case FSharpGlyph.EnumPrivate: + { + return Microsoft.CodeAnalysis.Glyph.EnumPrivate; + } + case FSharpGlyph.EnumInternal: + { + return Microsoft.CodeAnalysis.Glyph.EnumInternal; + } + case FSharpGlyph.EnumMemberPublic: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberPublic; + } + case FSharpGlyph.EnumMemberProtected: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberProtected; + } + case FSharpGlyph.EnumMemberPrivate: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate; + } + case FSharpGlyph.EnumMemberInternal: + { + return Microsoft.CodeAnalysis.Glyph.EnumMemberInternal; + } + case FSharpGlyph.Error: + { + return Microsoft.CodeAnalysis.Glyph.Error; + } + case FSharpGlyph.StatusInformation: + { + return Microsoft.CodeAnalysis.Glyph.StatusInformation; + } + case FSharpGlyph.EventPublic: + { + return Microsoft.CodeAnalysis.Glyph.EventPublic; + } + case FSharpGlyph.EventProtected: + { + return Microsoft.CodeAnalysis.Glyph.EventProtected; + } + case FSharpGlyph.EventPrivate: + { + return Microsoft.CodeAnalysis.Glyph.EventPrivate; + } + case FSharpGlyph.EventInternal: + { + return Microsoft.CodeAnalysis.Glyph.EventInternal; + } + case FSharpGlyph.ExtensionMethodPublic: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic; + } + case FSharpGlyph.ExtensionMethodProtected: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected; + } + case FSharpGlyph.ExtensionMethodPrivate: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate; + } + case FSharpGlyph.ExtensionMethodInternal: + { + return Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal; + } + case FSharpGlyph.FieldPublic: + { + return Microsoft.CodeAnalysis.Glyph.FieldPublic; + } + case FSharpGlyph.FieldProtected: + { + return Microsoft.CodeAnalysis.Glyph.FieldProtected; + } + case FSharpGlyph.FieldPrivate: + { + return Microsoft.CodeAnalysis.Glyph.FieldPrivate; + } + case FSharpGlyph.FieldInternal: + { + return Microsoft.CodeAnalysis.Glyph.FieldInternal; + } + case FSharpGlyph.InterfacePublic: + { + return Microsoft.CodeAnalysis.Glyph.InterfacePublic; + } + case FSharpGlyph.InterfaceProtected: + { + return Microsoft.CodeAnalysis.Glyph.InterfaceProtected; + } + case FSharpGlyph.InterfacePrivate: + { + return Microsoft.CodeAnalysis.Glyph.InterfacePrivate; + } + case FSharpGlyph.InterfaceInternal: + { + return Microsoft.CodeAnalysis.Glyph.InterfaceInternal; + } + case FSharpGlyph.Intrinsic: + { + return Microsoft.CodeAnalysis.Glyph.Intrinsic; + } + case FSharpGlyph.Keyword: + { + return Microsoft.CodeAnalysis.Glyph.Keyword; + } + case FSharpGlyph.Label: + { + return Microsoft.CodeAnalysis.Glyph.Label; + } + case FSharpGlyph.Local: + { + return Microsoft.CodeAnalysis.Glyph.Local; + } + case FSharpGlyph.Namespace: + { + return Microsoft.CodeAnalysis.Glyph.Namespace; + } + case FSharpGlyph.MethodPublic: + { + return Microsoft.CodeAnalysis.Glyph.MethodPublic; + } + case FSharpGlyph.MethodProtected: + { + return Microsoft.CodeAnalysis.Glyph.MethodProtected; + } + case FSharpGlyph.MethodPrivate: + { + return Microsoft.CodeAnalysis.Glyph.MethodPrivate; + } + case FSharpGlyph.MethodInternal: + { + return Microsoft.CodeAnalysis.Glyph.MethodInternal; + } + case FSharpGlyph.ModulePublic: + { + return Microsoft.CodeAnalysis.Glyph.ModulePublic; + } + case FSharpGlyph.ModuleProtected: + { + return Microsoft.CodeAnalysis.Glyph.ModuleProtected; + } + case FSharpGlyph.ModulePrivate: + { + return Microsoft.CodeAnalysis.Glyph.ModulePrivate; + } + case FSharpGlyph.ModuleInternal: + { + return Microsoft.CodeAnalysis.Glyph.ModuleInternal; + } + case FSharpGlyph.OpenFolder: + { + return Microsoft.CodeAnalysis.Glyph.OpenFolder; + } + case FSharpGlyph.Operator: + { + return Microsoft.CodeAnalysis.Glyph.Operator; + } + case FSharpGlyph.Parameter: + { + return Microsoft.CodeAnalysis.Glyph.Parameter; + } + case FSharpGlyph.PropertyPublic: + { + return Microsoft.CodeAnalysis.Glyph.PropertyPublic; + } + case FSharpGlyph.PropertyProtected: + { + return Microsoft.CodeAnalysis.Glyph.PropertyProtected; + } + case FSharpGlyph.PropertyPrivate: + { + return Microsoft.CodeAnalysis.Glyph.PropertyPrivate; + } + case FSharpGlyph.PropertyInternal: + { + return Microsoft.CodeAnalysis.Glyph.PropertyInternal; + } + case FSharpGlyph.RangeVariable: + { + return Microsoft.CodeAnalysis.Glyph.RangeVariable; + } + case FSharpGlyph.Reference: + { + return Microsoft.CodeAnalysis.Glyph.Reference; + } + case FSharpGlyph.StructurePublic: + { + return Microsoft.CodeAnalysis.Glyph.StructurePublic; + } + case FSharpGlyph.StructureProtected: + { + return Microsoft.CodeAnalysis.Glyph.StructureProtected; + } + case FSharpGlyph.StructurePrivate: + { + return Microsoft.CodeAnalysis.Glyph.StructurePrivate; + } + case FSharpGlyph.StructureInternal: + { + return Microsoft.CodeAnalysis.Glyph.StructureInternal; + } + case FSharpGlyph.TypeParameter: + { + return Microsoft.CodeAnalysis.Glyph.TypeParameter; + } + case FSharpGlyph.Snippet: + { + return Microsoft.CodeAnalysis.Glyph.Snippet; + } + case FSharpGlyph.CompletionWarning: + { + return Microsoft.CodeAnalysis.Glyph.CompletionWarning; + } + case FSharpGlyph.AddReference: + { + return Microsoft.CodeAnalysis.Glyph.AddReference; + } + case FSharpGlyph.NuGet: + { + return Microsoft.CodeAnalysis.Glyph.NuGet; + } + case FSharpGlyph.TargetTypeMatch: + { + return Microsoft.CodeAnalysis.Glyph.TargetTypeMatch; + } + default: + { + throw ExceptionUtilities.UnexpectedValue(glyph); + } + } + } + + [Theory] + [MemberData(nameof(enumValues))] + internal void MapsCorrectly(FSharpGlyph glyph) + { + var actual = FSharpGlyphHelpers.ConvertTo(glyph); + var expected = GetExpectedGlyph(glyph); + Assert.Equal(expected, actual); + } + + [Theory] + [MemberData(nameof(enumValuesOpposite))] + internal void MapsCorrectlyOpposite(Glyph glyph) + { + var actual = FSharpGlyphHelpers.ConvertFrom(glyph); + var expected = GetExpectedFSharpGlyph(glyph); + Assert.Equal(expected, actual); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharpTest/FSharpHighlightSpanKindTests.cs b/src/Tools/ExternalAccess/FSharpTest/FSharpHighlightSpanKindTests.cs new file mode 100644 index 0000000000000..3d0a1f7c11986 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharpTest/FSharpHighlightSpanKindTests.cs @@ -0,0 +1,63 @@ +// 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.Collections.Generic; +using Microsoft.CodeAnalysis.DocumentHighlighting; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.DocumentHighlighting; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.DocumentHighlighting; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests +{ + public class FSharpHighlightSpanKindTests + { + public static IEnumerable enumValues() + { + foreach (var number in Enum.GetValues(typeof(FSharpHighlightSpanKind))) + { + yield return new object[] { number }; + } + } + + internal static HighlightSpanKind GetExpectedHighlightSpanKind(FSharpHighlightSpanKind kind) + { + switch (kind) + { + case FSharpHighlightSpanKind.None: + { + return HighlightSpanKind.None; + } + + case FSharpHighlightSpanKind.Definition: + { + return HighlightSpanKind.Definition; + } + + case FSharpHighlightSpanKind.Reference: + { + return HighlightSpanKind.Reference; + } + + case FSharpHighlightSpanKind.WrittenReference: + { + return HighlightSpanKind.WrittenReference; + } + + default: + { + throw ExceptionUtilities.UnexpectedValue(kind); + } + } + } + + [Theory] + [MemberData(nameof(enumValues))] + internal void MapsCorrectly(FSharpHighlightSpanKind kind) + { + var actual = FSharpHighlightSpanKindHelpers.ConvertTo(kind); + var expected = GetExpectedHighlightSpanKind(kind); + Assert.Equal(expected, actual); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharpTest/FSharpInlineRenameReplacementKindTests.cs b/src/Tools/ExternalAccess/FSharpTest/FSharpInlineRenameReplacementKindTests.cs new file mode 100644 index 0000000000000..59596e5db5b98 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharpTest/FSharpInlineRenameReplacementKindTests.cs @@ -0,0 +1,68 @@ +// 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.Collections.Generic; +using Microsoft.CodeAnalysis.Editor; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.Editor; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests +{ + public class FSharpInlineRenameReplacementKindTests + { + public static IEnumerable enumValues() + { + foreach (var number in Enum.GetValues(typeof(FSharpInlineRenameReplacementKind))) + { + yield return new object[] { number }; + } + } + + internal static InlineRenameReplacementKind GetExpectedInlineRenameReplacementKind(FSharpInlineRenameReplacementKind kind) + { + switch (kind) + { + case FSharpInlineRenameReplacementKind.NoConflict: + { + return InlineRenameReplacementKind.NoConflict; + } + + case FSharpInlineRenameReplacementKind.ResolvedReferenceConflict: + { + return InlineRenameReplacementKind.ResolvedReferenceConflict; + } + + case FSharpInlineRenameReplacementKind.ResolvedNonReferenceConflict: + { + return InlineRenameReplacementKind.ResolvedNonReferenceConflict; + } + + case FSharpInlineRenameReplacementKind.UnresolvedConflict: + { + return InlineRenameReplacementKind.UnresolvedConflict; + } + + case FSharpInlineRenameReplacementKind.Complexified: + { + return InlineRenameReplacementKind.Complexified; + } + + default: + { + throw ExceptionUtilities.UnexpectedValue(kind); + } + } + } + + [Theory] + [MemberData(nameof(enumValues))] + internal void MapsCorrectly(FSharpInlineRenameReplacementKind kind) + { + var actual = FSharpInlineRenameReplacementKindHelpers.ConvertTo(kind); + var expected = GetExpectedInlineRenameReplacementKind(kind); + Assert.Equal(expected, actual); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharpTest/FSharpNavigateToMatchKindTests.cs b/src/Tools/ExternalAccess/FSharpTest/FSharpNavigateToMatchKindTests.cs new file mode 100644 index 0000000000000..3b18aa55e2ca7 --- /dev/null +++ b/src/Tools/ExternalAccess/FSharpTest/FSharpNavigateToMatchKindTests.cs @@ -0,0 +1,87 @@ +// 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.Collections.Generic; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.NavigateTo; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.NavigateTo; +using Microsoft.CodeAnalysis.NavigateTo; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests +{ + public class FSharpNavigateToMatchKindTests + { + public static IEnumerable enumValues() + { + foreach (var number in Enum.GetValues(typeof(FSharpNavigateToMatchKind))) + { + yield return new object[] { number }; + } + } + + internal static NavigateToMatchKind GetExpectedNavigateToMatchKind(FSharpNavigateToMatchKind kind) + { + switch (kind) + { + case FSharpNavigateToMatchKind.Exact: + { + return NavigateToMatchKind.Exact; + } + case FSharpNavigateToMatchKind.Prefix: + { + return NavigateToMatchKind.Prefix; + } + case FSharpNavigateToMatchKind.Substring: + { + return NavigateToMatchKind.Substring; + } + case FSharpNavigateToMatchKind.Regular: + { + return NavigateToMatchKind.Regular; + } + case FSharpNavigateToMatchKind.None: + { + return NavigateToMatchKind.None; + } + case FSharpNavigateToMatchKind.CamelCaseExact: + { + return NavigateToMatchKind.CamelCaseExact; + } + case FSharpNavigateToMatchKind.CamelCasePrefix: + { + return NavigateToMatchKind.CamelCasePrefix; + } + case FSharpNavigateToMatchKind.CamelCaseNonContiguousPrefix: + { + return NavigateToMatchKind.CamelCaseNonContiguousPrefix; + } + case FSharpNavigateToMatchKind.CamelCaseSubstring: + { + return NavigateToMatchKind.CamelCaseSubstring; + } + case FSharpNavigateToMatchKind.CamelCaseNonContiguousSubstring: + { + return NavigateToMatchKind.CamelCaseNonContiguousSubstring; + } + case FSharpNavigateToMatchKind.Fuzzy: + { + return NavigateToMatchKind.Fuzzy; + } + default: + { + throw ExceptionUtilities.UnexpectedValue(kind); + } + } + } + + [Theory] + [MemberData(nameof(enumValues))] + internal void MapsCorrectly(FSharpNavigateToMatchKind kind) + { + var actual = FSharpNavigateToMatchKindHelpers.ConvertTo(kind); + var expected = GetExpectedNavigateToMatchKind(kind); + Assert.Equal(expected, actual); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharpTest/FSharpSignatureHelpTriggerReasonTests.cs b/src/Tools/ExternalAccess/FSharpTest/FSharpSignatureHelpTriggerReasonTests.cs new file mode 100644 index 0000000000000..237fe89a884ca --- /dev/null +++ b/src/Tools/ExternalAccess/FSharpTest/FSharpSignatureHelpTriggerReasonTests.cs @@ -0,0 +1,58 @@ +// 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.Collections.Generic; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.SignatureHelp; +using Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp; +using Microsoft.CodeAnalysis.SignatureHelp; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests +{ + public class FSharpSignatureHelpTriggerReasonTests + { + public static IEnumerable enumValues() + { + foreach (var number in Enum.GetValues(typeof(SignatureHelpTriggerReason))) + { + yield return new object[] { number }; + } + } + + internal static FSharpSignatureHelpTriggerReason GetExpectedTriggerReason(SignatureHelpTriggerReason triggerReason) + { + switch (triggerReason) + { + case SignatureHelpTriggerReason.InvokeSignatureHelpCommand: + { + return FSharpSignatureHelpTriggerReason.InvokeSignatureHelpCommand; + } + + case SignatureHelpTriggerReason.RetriggerCommand: + { + return FSharpSignatureHelpTriggerReason.RetriggerCommand; + } + + case SignatureHelpTriggerReason.TypeCharCommand: + { + return FSharpSignatureHelpTriggerReason.TypeCharCommand; + } + + default: + { + throw ExceptionUtilities.UnexpectedValue(triggerReason); + } + } + } + + [Theory] + [MemberData(nameof(enumValues))] + internal void MapsCorrectly(SignatureHelpTriggerReason triggerReason) + { + var actual = FSharpSignatureHelpTriggerReasonHelpers.ConvertFrom(triggerReason); + var expected = GetExpectedTriggerReason(triggerReason); + Assert.Equal(expected, actual); + } + } +} diff --git a/src/Tools/ExternalAccess/FSharpTest/Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj b/src/Tools/ExternalAccess/FSharpTest/Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj new file mode 100644 index 0000000000000..e166d9241e0fb --- /dev/null +++ b/src/Tools/ExternalAccess/FSharpTest/Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj @@ -0,0 +1,55 @@ + + + + + Library + Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests + net472 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj b/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj index e33cc52c75994..2bb827e94ac69 100644 --- a/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj +++ b/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj @@ -111,6 +111,7 @@ + diff --git a/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj b/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj index fe3e6d272101e..3fe576f1a4e9e 100644 --- a/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj +++ b/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj @@ -25,6 +25,7 @@ + diff --git a/src/VisualStudio/Setup/source.extension.vsixmanifest b/src/VisualStudio/Setup/source.extension.vsixmanifest index e61b589e7b099..391210ff97bfe 100644 --- a/src/VisualStudio/Setup/source.extension.vsixmanifest +++ b/src/VisualStudio/Setup/source.extension.vsixmanifest @@ -67,6 +67,7 @@ + diff --git a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj index 9663ac0316d34..9b2776923aa43 100644 --- a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj @@ -259,7 +259,6 @@ - @@ -301,6 +300,7 @@ +