diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.1.xxx.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.1.xxx.nuspec
index f08c762cc3a..c97e0fd543e 100644
--- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.1.xxx.nuspec
+++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.1.xxx.nuspec
@@ -25,6 +25,12 @@
$projectUrl$
$tags$
+
+
+
+
+
+
@@ -50,6 +56,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.2.xxx.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.2.xxx.nuspec
index 87ac62b5e53..f04695638b4 100644
--- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.2.xxx.nuspec
+++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.4.2.xxx.nuspec
@@ -44,6 +44,8 @@
+
+
diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs
index 5927be7f511..01404d469e5 100644
--- a/src/fsharp/FSharp.Core/prim-types.fs
+++ b/src/fsharp/FSharp.Core/prim-types.fs
@@ -5260,10 +5260,11 @@ namespace Microsoft.FSharp.Core
state.Current
{ new IEnumerator<'T> with
- member __.Dispose () = ()
-
member __.Current = current ()
+ interface System.IDisposable with
+ member __.Dispose () = ()
+
interface IEnumerator with
member __.Current = box (current ())
@@ -5317,9 +5318,11 @@ namespace Microsoft.FSharp.Core
derefValue
{ new IEnumerator<'T> with
- member __.Dispose () = ()
member __.Current = current ()
+ interface System.IDisposable with
+ member __.Dispose () = ()
+
interface IEnumerator with
member __.Current = box (current ())
member __.Reset () = value := n - LanguagePrimitives.GenericOne
diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs
index b7334d6eaf7..91f180a4b8b 100644
--- a/src/fsharp/FSharp.Core/seq.fs
+++ b/src/fsharp/FSharp.Core/seq.fs
@@ -406,7 +406,7 @@ namespace Microsoft.FSharp.Collections
if not finished then disposeG g
// Internal type, used to optimize Enumerator/Generator chains
- type LazyGeneratorWrappingEnumerator<'T>(e:System.Collections.Generic.IEnumerator<'T>) =
+ type LazyGeneratorWrappingEnumerator<'T>(e:IEnumerator<'T>) =
member g.Enumerator = e
interface Generator<'T> with
member g.Apply = (fun () ->
@@ -419,9 +419,9 @@ namespace Microsoft.FSharp.Collections
let EnumerateFromGenerator(g:Generator<'T>) =
match g with
| :? LazyGeneratorWrappingEnumerator<'T> as g -> g.Enumerator
- | _ -> (new EnumeratorWrappingLazyGenerator<_>(g) :> System.Collections.Generic.IEnumerator<_>)
+ | _ -> (new EnumeratorWrappingLazyGenerator<'T>(g) :> IEnumerator<'T>)
- let GenerateFromEnumerator (e:System.Collections.Generic.IEnumerator<'T>) =
+ let GenerateFromEnumerator (e:IEnumerator<'T>) =
match e with
| :? EnumeratorWrappingLazyGenerator<'T> as e -> e.Generator
| _ -> (new LazyGeneratorWrappingEnumerator<'T>(e) :> Generator<'T>)
diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs
index e733d7f9a2d..7181997cc50 100644
--- a/src/fsharp/FSharp.Core/seqcore.fs
+++ b/src/fsharp/FSharp.Core/seqcore.fs
@@ -395,6 +395,7 @@ namespace Microsoft.FSharp.Core.CompilerServices
member x.GetEnumerator() = (x.GetFreshEnumerator() :> IEnumerator)
interface IEnumerator<'T> with
member x.Current = if redirect then redirectTo.LastGenerated else x.LastGenerated
+ interface System.IDisposable with
member x.Dispose() = if redirect then redirectTo.Close() else x.Close()
interface IEnumerator with
member x.Current = box (if redirect then redirectTo.LastGenerated else x.LastGenerated)
diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi
index ebd7accb8e5..5cb50c0548d 100644
--- a/src/fsharp/FSharp.Core/seqcore.fsi
+++ b/src/fsharp/FSharp.Core/seqcore.fsi
@@ -148,3 +148,4 @@ namespace Microsoft.FSharp.Core.CompilerServices
interface IEnumerable
interface IEnumerator<'T>
interface IEnumerator
+ interface IDisposable
diff --git a/vsintegration/Vsix/VisualFSharpOpenSource/Source.extension.vsixmanifest b/vsintegration/Vsix/VisualFSharpOpenSource/Source.extension.vsixmanifest
index 4b992a555a7..2bc1ec60547 100644
--- a/vsintegration/Vsix/VisualFSharpOpenSource/Source.extension.vsixmanifest
+++ b/vsintegration/Vsix/VisualFSharpOpenSource/Source.extension.vsixmanifest
@@ -15,7 +15,7 @@
-
+
diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs
index c75ca4bda69..cf32c6fb042 100644
--- a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs
+++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs
@@ -65,7 +65,7 @@ module internal ClassificationDefinitions =
) =
let (| LightTheme | DarkTheme | UnknownTheme |) id =
- if id = KnownColorThemes.Light || id = KnownColorThemes.Blue then LightTheme
+ if id = KnownColorThemes.Light || id = KnownColorThemes.Blue || id = Guids.blueHighContrastThemeId then LightTheme
elif id = KnownColorThemes.Dark then DarkTheme
else UnknownTheme
diff --git a/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs b/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs
index 78afeb6aa7f..a9d9ba0abdd 100644
--- a/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs
+++ b/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs
@@ -21,7 +21,7 @@ type internal FSharpColorizationService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
static let userOpName = "SemanticColorization"
diff --git a/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs b/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs
index 40fa6329966..01f42eb3164 100644
--- a/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs
+++ b/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs
@@ -22,7 +22,7 @@ type internal FSharpAddOpenCodeFixProvider
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
assemblyContentProvider: AssemblyContentProvider
) =
inherit CodeFixProvider()
diff --git a/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs b/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs
index 9d9f91d5ce9..e3cc1180bd2 100644
--- a/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs
+++ b/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs
@@ -29,7 +29,7 @@ type internal FSharpImplementInterfaceCodeFixProvider
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
inherit CodeFixProvider()
let fixableDiagnosticIds = ["FS0366"]
diff --git a/vsintegration/src/FSharp.Editor/CodeFix/ProposeUppercaseLabel.fs b/vsintegration/src/FSharp.Editor/CodeFix/ProposeUppercaseLabel.fs
index f414d725c8d..4087859661b 100644
--- a/vsintegration/src/FSharp.Editor/CodeFix/ProposeUppercaseLabel.fs
+++ b/vsintegration/src/FSharp.Editor/CodeFix/ProposeUppercaseLabel.fs
@@ -12,7 +12,7 @@ type internal FSharpProposeUpperCaseLabelCodeFixProvider
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
inherit CodeFixProvider()
let fixableDiagnosticIds = ["FS0053"]
diff --git a/vsintegration/src/FSharp.Editor/CodeFix/RemoveUnusedOpens.fs b/vsintegration/src/FSharp.Editor/CodeFix/RemoveUnusedOpens.fs
index e9276b66ca5..31825751e83 100644
--- a/vsintegration/src/FSharp.Editor/CodeFix/RemoveUnusedOpens.fs
+++ b/vsintegration/src/FSharp.Editor/CodeFix/RemoveUnusedOpens.fs
@@ -19,7 +19,7 @@ type internal FSharpRemoveUnusedOpensCodeFixProvider
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
inherit CodeFixProvider()
let fixableDiagnosticIds = [IDEDiagnosticIds.RemoveUnnecessaryImportsDiagnosticId]
diff --git a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs
index acebea92477..b364d6fe219 100644
--- a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs
+++ b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs
@@ -20,7 +20,7 @@ type internal FSharpRenameUnusedValueCodeFixProvider
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
inherit CodeFixProvider()
diff --git a/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs b/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs
index e0fa2cd5c74..e0c461e92c4 100644
--- a/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs
+++ b/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs
@@ -19,7 +19,7 @@ type internal FSharpHelpContextService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
static let userOpName = "ImplementInterfaceCodeFix"
diff --git a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs
index c5ed4e46537..031b132c618 100644
--- a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs
+++ b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs
@@ -21,7 +21,7 @@ type internal XmlDocCommandFilter
wpfTextView: IWpfTextView,
filePath: string,
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
workspace: VisualStudioWorkspaceImpl
) =
@@ -117,7 +117,7 @@ type internal XmlDocCommandFilter
type internal XmlDocCommandFilterProvider
[]
(checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
workspace: VisualStudioWorkspaceImpl,
textDocumentFactoryService: ITextDocumentFactoryService,
editorFactory: IVsEditorAdaptersFactoryService) =
diff --git a/vsintegration/src/FSharp.Editor/Common/Constants.fs b/vsintegration/src/FSharp.Editor/Common/Constants.fs
index 88238c467f2..bb85b0ef7af 100644
--- a/vsintegration/src/FSharp.Editor/Common/Constants.fs
+++ b/vsintegration/src/FSharp.Editor/Common/Constants.fs
@@ -72,3 +72,5 @@ module internal Guids =
[]
/// "8FDA964A-263D-4B4E-9560-29897535217C"
let languageServicePerformanceOptionPageIdString = "8FDA964A-263D-4B4E-9560-29897535217C"
+
+ let blueHighContrastThemeId = Guid "{ce94d289-8481-498b-8ca9-9b6191a315b9}"
diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs
index 63f42c01883..00e6fb51bdb 100644
--- a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs
+++ b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs
@@ -27,7 +27,7 @@ type internal FSharpCompletionProvider
workspace: Workspace,
serviceProvider: SVsServiceProvider,
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
assemblyContentProvider: AssemblyContentProvider
) =
@@ -231,7 +231,7 @@ type internal FSharpCompletionProvider
let documentation = List()
let collector = RoslynHelpers.CollectTaggedText documentation
// mix main description and xmldoc by using one collector
- XmlDocumentation.BuildDataTipText(documentationBuilder, collector, collector, description)
+ XmlDocumentation.BuildDataTipText(documentationBuilder, collector, collector, collector, collector, collector, description)
return CompletionDescription.Create(documentation.ToImmutableArray())
else
return CompletionDescription.Empty
diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs
index d9b8fa435d9..394e4e355a4 100644
--- a/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs
+++ b/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs
@@ -17,7 +17,7 @@ type internal FSharpCompletionService
workspace: Workspace,
serviceProvider: SVsServiceProvider,
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
assemblyContentProvider: AssemblyContentProvider
) =
inherit CompletionServiceWithProviders(workspace)
@@ -47,7 +47,7 @@ type internal FSharpCompletionServiceFactory
(
serviceProvider: SVsServiceProvider,
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
assemblyContentProvider: AssemblyContentProvider
) =
interface ILanguageServiceFactory with
diff --git a/vsintegration/src/FSharp.Editor/Completion/FileSystemCompletion.fs b/vsintegration/src/FSharp.Editor/Completion/FileSystemCompletion.fs
index 2bf10815d1a..2c57af93293 100644
--- a/vsintegration/src/FSharp.Editor/Completion/FileSystemCompletion.fs
+++ b/vsintegration/src/FSharp.Editor/Completion/FileSystemCompletion.fs
@@ -22,7 +22,7 @@ type internal Completion =
AllowableExtensions = allowableExtensions
UseIncludeDirectives = useIncludeDirectives }
-type internal HashDirectiveCompletionProvider(workspace: Workspace, projectInfoManager: ProjectInfoManager, completions: Completion list) =
+type internal HashDirectiveCompletionProvider(workspace: Workspace, projectInfoManager: FSharpProjectOptionsManager, completions: Completion list) =
inherit CommonCompletionProvider()
let [] NetworkPath = "\\\\"
diff --git a/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs b/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs
index 923ab5672fa..09e5c713908 100644
--- a/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs
+++ b/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs
@@ -25,7 +25,7 @@ type internal FSharpSignatureHelpProvider
(
serviceProvider: SVsServiceProvider,
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
static let userOpName = "SignatureHelpProvider"
diff --git a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs
index 827bca085ef..84a692a6123 100644
--- a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs
+++ b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs
@@ -23,7 +23,7 @@ type internal FSharpBreakpointResolutionService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
static let userOpName = "BreakpointResolution"
diff --git a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs
index 052e5b4dbec..88d68af2f65 100644
--- a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs
+++ b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs
@@ -18,7 +18,7 @@ open Microsoft.VisualStudio.FSharp.LanguageService
[]
[, FSharpConstants.FSharpLanguageName)>]
-type internal FSharpLanguageDebugInfoService [](projectInfoManager: ProjectInfoManager) =
+type internal FSharpLanguageDebugInfoService [](projectInfoManager: FSharpProjectOptionsManager) =
static member GetDataTipInformation(sourceText: SourceText, position: int, tokens: List): TextSpan option =
let tokenIndex = tokens |> Seq.tryFindIndex(fun t -> t.TextSpan.Contains(position))
diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs
index d1945e34318..c9f49c71abe 100644
--- a/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs
+++ b/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs
@@ -30,7 +30,7 @@ type internal FSharpDocumentDiagnosticAnalyzer() =
document.Project.Solution.Workspace.Services.GetService().Checker
let getProjectInfoManager(document: Document) =
- document.Project.Solution.Workspace.Services.GetService().ProjectInfoManager
+ document.Project.Solution.Workspace.Services.GetService().FSharpProjectOptionsManager
static let errorInfoEqualityComparer =
{ new IEqualityComparer with
diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs
index 28fdae8e51b..474dc3b52f4 100644
--- a/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs
+++ b/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs
@@ -24,7 +24,7 @@ type internal SimplifyNameDiagnosticAnalyzer() =
inherit DocumentDiagnosticAnalyzer()
static let userOpName = "SimplifyNameDiagnosticAnalyzer"
- let getProjectInfoManager (document: Document) = document.Project.Solution.Workspace.Services.GetService().ProjectInfoManager
+ let getProjectInfoManager (document: Document) = document.Project.Solution.Workspace.Services.GetService().FSharpProjectOptionsManager
let getChecker (document: Document) = document.Project.Solution.Workspace.Services.GetService().Checker
let getPlidLength (plid: string list) = (plid |> List.sumBy String.length) + plid.Length
static let cache = ConditionalWeakTable>()
diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs
index caed13b7d4b..d9f23cbc25e 100644
--- a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs
+++ b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs
@@ -17,7 +17,7 @@ type internal UnusedDeclarationsAnalyzer() =
inherit DocumentDiagnosticAnalyzer()
static let userOpName = "UnusedDeclarationsAnalyzer"
- let getProjectInfoManager (document: Document) = document.Project.Solution.Workspace.Services.GetService().ProjectInfoManager
+ let getProjectInfoManager (document: Document) = document.Project.Solution.Workspace.Services.GetService().FSharpProjectOptionsManager
let getChecker (document: Document) = document.Project.Solution.Workspace.Services.GetService().Checker
let [] DescriptorId = "FS1182"
diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs
index cc137a7f913..ece2f0d0935 100644
--- a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs
+++ b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs
@@ -143,7 +143,7 @@ module private UnusedOpens =
type internal UnusedOpensDiagnosticAnalyzer() =
inherit DocumentDiagnosticAnalyzer()
- let getProjectInfoManager (document: Document) = document.Project.Solution.Workspace.Services.GetService().ProjectInfoManager
+ let getProjectInfoManager (document: Document) = document.Project.Solution.Workspace.Services.GetService().FSharpProjectOptionsManager
let getChecker (document: Document) = document.Project.Solution.Workspace.Services.GetService().Checker
static let userOpName = "UnusedOpensAnalyzer"
diff --git a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs
index f7fe5f947f4..8e66d49bde1 100644
--- a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs
+++ b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs
@@ -23,7 +23,7 @@ type internal FSharpHighlightSpan =
[]
[, FSharpConstants.FSharpLanguageName)>]
-type internal FSharpDocumentHighlightsService [] (checkerProvider: FSharpCheckerProvider, projectInfoManager: ProjectInfoManager) =
+type internal FSharpDocumentHighlightsService [] (checkerProvider: FSharpCheckerProvider, projectInfoManager: FSharpProjectOptionsManager) =
static let userOpName = "DocumentHighlights"
diff --git a/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs b/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs
index 1dcd1fe8aab..63b94d1dfb5 100644
--- a/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs
+++ b/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs
@@ -12,7 +12,7 @@ type internal FSharpBraceMatchingService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
static let userOpName = "BraceMatching"
diff --git a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs
index c26879c2dbd..b2b90f9a5e4 100644
--- a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs
+++ b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs
@@ -18,7 +18,7 @@ open Microsoft.FSharp.Compiler.SourceCodeServices
[, FSharpConstants.FSharpLanguageName)>]
type internal FSharpIndentationService
[]
- (projectInfoManager: ProjectInfoManager) =
+ (projectInfoManager: FSharpProjectOptionsManager) =
static member GetDesiredIndentation(documentId: DocumentId, sourceText: SourceText, filePath: string, lineNumber: int, tabSize: int, optionsOpt: FSharpProjectOptions option): Option =
// Match indentation with previous line
diff --git a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs
index 50c933324ff..05b02d7f2c2 100644
--- a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs
+++ b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs
@@ -73,7 +73,7 @@ type internal InlineRenameLocationSet(locationsByDocument: DocumentLocations [],
type internal InlineRenameInfo
(
checker: FSharpChecker,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
document: Document,
triggerSpan: TextSpan,
lexerSymbol: LexerSymbol,
@@ -141,13 +141,13 @@ type internal InlineRenameInfo
type internal InlineRenameService
[]
(
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
checkerProvider: FSharpCheckerProvider,
[] _refactorNotifyServices: seq
) =
static let userOpName = "InlineRename"
- static member GetInlineRenameInfo(checker: FSharpChecker, projectInfoManager: ProjectInfoManager, document: Document, sourceText: SourceText, position: int,
+ static member GetInlineRenameInfo(checker: FSharpChecker, projectInfoManager: FSharpProjectOptionsManager, document: Document, sourceText: SourceText, position: int,
defines: string list, options: FSharpProjectOptions) : Async =
asyncMaybe {
let textLine = sourceText.Lines.GetLineFromPosition(position)
diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
index 3936383e33d..796fcde6f56 100644
--- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
+++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
@@ -77,12 +77,20 @@ type internal FSharpCheckerProvider
member this.Checker = checker.Value
+
+
/// A value and a function to recompute/refresh the value. The function is passed a flag indicating if a refresh is happening.
type Refreshable<'T> = 'T * (bool -> 'T)
-// Exposes project information as MEF component
-[); Composition.Shared>]
-type internal ProjectInfoManager
+/// Exposes FCS FSharpProjectOptions information management as MEF component.
+//
+// This service allows analyzers to get an appropriate FSharpProjectOptions value for a project or single file.
+// It also allows a 'cheaper' route to get the project options relevant to parsing (e.g. the #define values).
+// The main entrypoints are TryGetOptionsForDocumentOrProject and TryGetOptionsForEditingDocumentOrProject.
+
+
+[); Composition.Shared>]
+type internal FSharpProjectOptionsManager
[]
(
checkerProvider: FSharpCheckerProvider,
@@ -202,7 +210,7 @@ type internal ProjectInfoManager
type internal FSharpCheckerWorkspaceService =
inherit Microsoft.CodeAnalysis.Host.IWorkspaceService
abstract Checker: FSharpChecker
- abstract ProjectInfoManager: ProjectInfoManager
+ abstract FSharpProjectOptionsManager: FSharpProjectOptionsManager
type internal RoamingProfileStorageLocation(keyName: string) =
inherit OptionStorageLocation()
@@ -222,13 +230,13 @@ type internal FSharpCheckerWorkspaceServiceFactory
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
interface Microsoft.CodeAnalysis.Host.Mef.IWorkspaceServiceFactory with
member this.CreateService(_workspaceServices) =
upcast { new FSharpCheckerWorkspaceService with
member this.Checker = checkerProvider.Checker
- member this.ProjectInfoManager = projectInfoManager }
+ member this.FSharpProjectOptionsManager = projectInfoManager }
type
[]
@@ -289,7 +297,7 @@ and
internal FSharpLanguageService(package : FSharpPackage) =
inherit AbstractLanguageService(package)
- let projectInfoManager = package.ComponentModel.DefaultExportProvider.GetExport().Value
+ let projectInfoManager = package.ComponentModel.DefaultExportProvider.GetExport().Value
let projectDisplayNameOf projectFileName =
if String.IsNullOrWhiteSpace projectFileName then projectFileName
diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs
index e29742a119a..b33a8a71779 100644
--- a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs
+++ b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs
@@ -16,7 +16,7 @@ open Microsoft.VisualStudio.FSharp.Editor.Symbols
module internal SymbolHelpers =
let getSymbolUsesInSolution (symbol: FSharpSymbol, declLoc: SymbolDeclarationLocation, checkFileResults: FSharpCheckFileResults,
- projectInfoManager: ProjectInfoManager, checker: FSharpChecker, solution: Solution, userOpName) =
+ projectInfoManager: FSharpProjectOptionsManager, checker: FSharpChecker, solution: Solution, userOpName) =
async {
let! symbolUses =
match declLoc with
@@ -63,7 +63,7 @@ module internal SymbolHelpers =
type OriginalText = string
- let changeAllSymbolReferences (document: Document, symbolSpan: TextSpan, textChanger: string -> string, projectInfoManager: ProjectInfoManager, checker: FSharpChecker, userOpName)
+ let changeAllSymbolReferences (document: Document, symbolSpan: TextSpan, textChanger: string -> string, projectInfoManager: FSharpProjectOptionsManager, checker: FSharpChecker, userOpName)
: Async<(Func> * OriginalText) option> =
asyncMaybe {
do! Option.guard (symbolSpan.Length > 0)
diff --git a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs
index c74de506637..2f1deed46ed 100644
--- a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs
+++ b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs
@@ -20,7 +20,7 @@ type internal FSharpFindUsagesService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
static let userOpName = "FindUsages"
diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs
index 556bbb216b8..1abd8154315 100644
--- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs
+++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs
@@ -34,7 +34,7 @@ type internal FSharpNavigableItem(document: Document, textSpan: TextSpan) =
member this.DisplayTaggedParts = ImmutableArray.Empty
member this.ChildItems = ImmutableArray.Empty
-type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: ProjectInfoManager) =
+type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: FSharpProjectOptionsManager) =
static let userOpName = "GoToDefinition"
@@ -151,7 +151,7 @@ type internal FSharpGoToDefinitionService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
[] _presenters: IEnumerable
) =
diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs
index bdf2d1a8143..5a6891b9c7c 100644
--- a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs
+++ b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs
@@ -182,7 +182,7 @@ type internal FSharpNavigateToSearchService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
let itemsByDocumentId = ConditionalWeakTable()
diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs
index ef1811553ac..a2af8b357c1 100644
--- a/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs
+++ b/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs
@@ -23,7 +23,7 @@ type internal FSharpNavigationBarItemService
[]
(
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager
+ projectInfoManager: FSharpProjectOptionsManager
) =
static let userOpName = "NavigationBarItem"
diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs
index 54085683233..394dcba850b 100644
--- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs
+++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs
@@ -37,7 +37,7 @@ module private FSharpQuickInfo =
let getTooltipFromRange
(
checker: FSharpChecker,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
document: Document,
declRange: range,
cancellationToken: CancellationToken
@@ -81,7 +81,7 @@ module private FSharpQuickInfo =
let getTooltipInfo
(
checker: FSharpChecker,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
document: Document,
position: int,
cancellationToken: CancellationToken
@@ -160,7 +160,7 @@ type internal FSharpQuickInfoProvider
(
[)>] serviceProvider: IServiceProvider,
checkerProvider: FSharpCheckerProvider,
- projectInfoManager: ProjectInfoManager,
+ projectInfoManager: FSharpProjectOptionsManager,
gotoDefinitionService: FSharpGoToDefinitionService,
viewProvider: QuickInfoViewProvider
) =
diff --git a/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs b/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs
index c3ec952913a..c38861216ef 100644
--- a/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs
+++ b/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs
@@ -139,7 +139,7 @@ module internal BlockStructure =
open BlockStructure
-type internal FSharpBlockStructureService(checker: FSharpChecker, projectInfoManager: ProjectInfoManager) =
+type internal FSharpBlockStructureService(checker: FSharpChecker, projectInfoManager: FSharpProjectOptionsManager) =
inherit BlockStructureService()
static let userOpName = "BlockStructure"
@@ -158,7 +158,7 @@ type internal FSharpBlockStructureService(checker: FSharpChecker, projectInfoMan
|> RoslynHelpers.StartAsyncAsTask(cancellationToken)
[, FSharpConstants.FSharpLanguageName); Shared>]
-type internal FSharpBlockStructureServiceFactory [](checkerProvider: FSharpCheckerProvider, projectInfoManager: ProjectInfoManager) =
+type internal FSharpBlockStructureServiceFactory [](checkerProvider: FSharpCheckerProvider, projectInfoManager: FSharpProjectOptionsManager) =
interface ILanguageServiceFactory with
member __.CreateLanguageService(_languageServices) =
upcast FSharpBlockStructureService(checkerProvider.Checker, projectInfoManager)
\ No newline at end of file
diff --git a/vsintegration/src/FSharp.LanguageService.Base/CodeWindowManager.cs b/vsintegration/src/FSharp.LanguageService.Base/CodeWindowManager.cs
index 724e7b7fd6f..9a6f1807a39 100644
--- a/vsintegration/src/FSharp.LanguageService.Base/CodeWindowManager.cs
+++ b/vsintegration/src/FSharp.LanguageService.Base/CodeWindowManager.cs
@@ -35,7 +35,7 @@ public class CodeWindowManager : IVsCodeWindowManager {
TypeAndMemberDropdownBars dropDownHelper;
IVsCodeWindow codeWindow;
ArrayList viewFilters;
- LanguageService service;
+ LanguageService_DEPRECATED service;
ISource source;
#if DOCUMENT_PROPERTIES
DocumentProperties properties;
@@ -46,7 +46,7 @@ public class CodeWindowManager : IVsCodeWindowManager {
/// the IVsLanguageInfo.GetCodeWindowManager method. You can override CreateCodeWindowManager
/// on your LanguageService if you want to plug in a different CodeWindowManager.
///
- internal CodeWindowManager(LanguageService service, IVsCodeWindow codeWindow, ISource source) {
+ internal CodeWindowManager(LanguageService_DEPRECATED service, IVsCodeWindow codeWindow, ISource source) {
this.service = service;
this.codeWindow = codeWindow;
this.viewFilters = new ArrayList();
@@ -90,7 +90,7 @@ void CloseFilters() {
}
/// Returns the LanguageService object that created this code window manager
- internal LanguageService LanguageService {
+ internal LanguageService_DEPRECATED LanguageService {
get { return this.service; }
}
/// returns the Source object associated with the IVsTextLines buffer for this code window
@@ -223,7 +223,7 @@ public virtual void OnSetFocus(IVsTextView textView) {
///
internal abstract class TypeAndMemberDropdownBars : IVsDropdownBarClient {
/// The language service object that created this object and calls its SynchronizeDropdowns method
- private LanguageService languageService;
+ private LanguageService_DEPRECATED languageService;
/// The correspoding VS object that represents the two drop down bars. The VS object uses call backs to pull information from
/// this object and makes itself known to this object by calling SetDropdownBar
@@ -247,7 +247,7 @@ internal abstract class TypeAndMemberDropdownBars : IVsDropdownBarClient {
const int DropClasses = 0;
const int DropMethods = 1;
- protected TypeAndMemberDropdownBars(LanguageService languageService) {
+ protected TypeAndMemberDropdownBars(LanguageService_DEPRECATED languageService) {
this.languageService = languageService;
this.dropDownTypes = new ArrayList();
this.dropDownMembers = new ArrayList();
@@ -286,7 +286,7 @@ internal void SynchronizeDropdowns(IVsTextView textView, int line, int col) {
/// The selected type (you can update this)
/// The selected member (you can update this)
/// true if something was updated
- public abstract bool OnSynchronizeDropdowns(LanguageService languageService, IVsTextView textView, int line, int col, ArrayList dropDownTypes, ArrayList dropDownMembers, ref int selectedType, ref int selectedMember);
+ public abstract bool OnSynchronizeDropdowns(LanguageService_DEPRECATED languageService, IVsTextView textView, int line, int col, ArrayList dropDownTypes, ArrayList dropDownMembers, ref int selectedType, ref int selectedMember);
// IVsDropdownBarClient methods
diff --git a/vsintegration/src/FSharp.LanguageService.Base/ExpansionProvider.cs b/vsintegration/src/FSharp.LanguageService.Base/ExpansionProvider.cs
index 3cca5617143..d00cff2a104 100644
--- a/vsintegration/src/FSharp.LanguageService.Base/ExpansionProvider.cs
+++ b/vsintegration/src/FSharp.LanguageService.Base/ExpansionProvider.cs
@@ -305,7 +305,7 @@ internal virtual int FindExpansionByShortcut(IVsTextView view, string shortcut,
this.view = view;
title = path = null;
- LanguageService svc = this.source.LanguageService;
+ LanguageService_DEPRECATED svc = this.source.LanguageService;
IVsExpansionManager mgr = svc.Site.GetService(typeof(SVsExpansionManager)) as IVsExpansionManager;
if (mgr == null) return NativeMethods.E_FAIL ;
Guid guidLanguage = svc.GetLanguageServiceGuid();
diff --git a/vsintegration/src/FSharp.LanguageService.Base/Interfaces.cs b/vsintegration/src/FSharp.LanguageService.Base/Interfaces.cs
index a401a738d44..5a77023a13d 100644
--- a/vsintegration/src/FSharp.LanguageService.Base/Interfaces.cs
+++ b/vsintegration/src/FSharp.LanguageService.Base/Interfaces.cs
@@ -28,7 +28,6 @@ enum RequireFreshResults
No = 0
}
- // The interface between FSharpSourceBase+FSharpSource and the rest of the language service.
interface ISource : IDisposable
{
void Open();
@@ -48,7 +47,7 @@ interface ISource : IDisposable
TextSpan UncommentSpan(TextSpan span);
TextSpan CommentSpan(TextSpan span);
ExpansionProvider GetExpansionProvider();
- BackgroundRequest BeginBackgroundRequest(int line, int idx, TokenInfo info, BackgroundRequestReason reason, IVsTextView view, RequireFreshResults requireFreshResults, BackgroundRequestResultHandler callback, MethodTipMiscellany misc = 0);
+ BackgroundRequest_DEPRECATED BeginBackgroundRequest(int line, int idx, TokenInfo info, BackgroundRequestReason reason, IVsTextView view, RequireFreshResults requireFreshResults, BackgroundRequestResultHandler callback, MethodTipMiscellany_DEPRECATED misc = 0);
CompletionSet CompletionSet { get; }
void Completion(IVsTextView textView, TokenInfo info, BackgroundRequestReason reason, RequireFreshResults requireFreshResults);
bool IsCompletorActive { get; }
@@ -64,18 +63,18 @@ interface ISource : IDisposable
void DisableOutlining();
void OnCommand(IVsTextView textView, Microsoft.VisualStudio.VSConstants.VSStd2KCmdID command, char ch);
TokenInfo GetTokenInfo(int line, int col);
- void MethodTip(IVsTextView textView, int line, int index, TokenInfo info, MethodTipMiscellany methodTipMiscellany, RequireFreshResults requireFreshResults);
+ void MethodTip(IVsTextView textView, int line, int index, TokenInfo info, MethodTipMiscellany_DEPRECATED methodTipMiscellany, RequireFreshResults requireFreshResults);
void GetPairExtents(IVsTextView textView, int line, int col, out TextSpan span);
bool GetWordExtent(int line, int idx, WORDEXTFLAGS flags, out int startIdx, out int endIdx);
int GetLineCount();
- LanguageService LanguageService { get; }
+ LanguageService_DEPRECATED LanguageService { get; }
void Recolorize(int startLine, int endLine);
TextSpan DirtySpan { get; }
Colorizer GetColorizer();
AuthoringSink CreateAuthoringSink(BackgroundRequestReason reason, int line, int col);
string GetFilePath();
void OnIdle(bool periodic);
- void HandleUntypedParseOrFullTypeCheckResponse(BackgroundRequest req);
+ void HandleUntypedParseOrFullTypeCheckResponse(BackgroundRequest_DEPRECATED req);
IVsHiddenTextSession GetHiddenTextSession();
string GetExpressionAtPosition(int line, int column);
DateTime OpenedTime { get; }
diff --git a/vsintegration/src/FSharp.LanguageService.Base/LanguageService.cs b/vsintegration/src/FSharp.LanguageService.Base/LanguageService.cs
index 810bbe61e09..384403857db 100644
--- a/vsintegration/src/FSharp.LanguageService.Base/LanguageService.cs
+++ b/vsintegration/src/FSharp.LanguageService.Base/LanguageService.cs
@@ -53,7 +53,13 @@ internal enum BackgroundRequestReason
};
[CLSCompliant(false), ComVisible(true)]
- public abstract class LanguageService : IDisposable,
+ //
+ // Note: Tests using this code should either be adjusted to test the corresponding feature in
+ // FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+ // functionality and thus have considerable value, they should ony be deleted if we are sure this
+ // is not the case.
+ //
+ public abstract class LanguageService_DEPRECATED : IDisposable,
IVsLanguageContextProvider, IOleServiceProvider,
IObjectWithSite, IVsDebuggerEvents,
IVsFormatFilterProvider,
@@ -71,7 +77,7 @@ public abstract class LanguageService : IDisposable,
private int lcid;
private bool isServingBackgroundRequest; // used to stop the OnIdle thread making new background requests when a request is already running
- protected LanguageService()
+ protected LanguageService_DEPRECATED()
{
this.codeWindowManagers = new ArrayList();
this.sources = new ArrayList();
@@ -149,7 +155,7 @@ public virtual void Dispose()
/// for your package.
internal abstract LanguagePreferences GetLanguagePreferences();
- internal abstract void ExecuteBackgroundRequest(BackgroundRequest req);
+ internal abstract void ExecuteBackgroundRequest(BackgroundRequest_DEPRECATED req);
/// If this returns true we can reuse a recent IntellisenseInfo if its available
internal abstract bool IsRecentScopeSufficientForBackgroundRequest(BackgroundRequestReason req);
@@ -230,7 +236,7 @@ internal virtual int UpdateLanguageContext(LanguageContextHint hint, IVsTextLine
return NativeMethods.E_FAIL;
}
- internal void HandleUpdateLanguageContextResponse(BackgroundRequest req)
+ internal void HandleUpdateLanguageContextResponse(BackgroundRequest_DEPRECATED req)
{
}
@@ -239,7 +245,7 @@ internal virtual ImageList GetImageList()
ImageList ilist = new ImageList();
ilist.ImageSize = new Size(16, 16);
ilist.TransparentColor = Color.FromArgb(255, 0, 255);
- Stream stream = typeof(LanguageService).Assembly.GetManifestResourceStream("Resources.completionset.bmp");
+ Stream stream = typeof(LanguageService_DEPRECATED).Assembly.GetManifestResourceStream("Resources.completionset.bmp");
ilist.Images.AddStrip(new Bitmap(stream));
return ilist;
}
@@ -298,7 +304,7 @@ internal void OpenDocument(string path)
internal string lastFileName;
internal IVsTextView lastActiveView;
// STATIC ROOT INTO PROJECT BUILD
- internal IntellisenseInfo recentFullTypeCheckResults = null;
+ internal IntellisenseInfo_DEPRECATED recentFullTypeCheckResults = null;
internal string recentFullTypeCheckFile = null;
///
@@ -313,7 +319,7 @@ internal IVsTextView LastActiveTextView
/// This is only relevant to the active text view and is cleared each time the text view is switched. If it
/// is null we must make a background request to the language service to get the recent full typecheck results.
/// If a file is dirty, an OnIdle call will kick in to refresh the recent results.
- internal IntellisenseInfo RecentFullTypeCheckResults
+ internal IntellisenseInfo_DEPRECATED RecentFullTypeCheckResults
{
get { return this.recentFullTypeCheckResults; }
set { this.recentFullTypeCheckResults = value; }
@@ -402,7 +408,7 @@ internal virtual void OnActiveViewChanged(IVsTextView textView)
}
internal virtual void OnActiveViewLostFocus(IVsTextView textView)
{
- FSharpSourceBase s = (FSharpSourceBase)this.GetSource(textView);
+ FSharpSourceBase_DEPRECATED s = (FSharpSourceBase_DEPRECATED)this.GetSource(textView);
if (s != null) s.HandleLostFocus();
}
internal virtual void OnCaretMoved(CodeWindowManager mgr, IVsTextView textView, int line, int col)
@@ -648,7 +654,7 @@ internal void ScrollToEnd(IVsTextView view)
NativeMethods.ThrowOnFailure(view.SetTopLine(top));
}
- internal BackgroundRequestAsyncResult BeginBackgroundRequest(BackgroundRequest request, BackgroundRequestResultHandler handler)
+ internal BackgroundRequestAsyncResult_DEPRECATED BeginBackgroundRequest(BackgroundRequest_DEPRECATED request, BackgroundRequestResultHandler handler)
{
EnsureBackgroundThreadStarted();
lock (this)
@@ -659,12 +665,12 @@ internal BackgroundRequestAsyncResult BeginBackgroundRequest(BackgroundRequest r
this.backgroundRequestPending.Set();
this.backgroundRequestDone.Reset();
// Return a capability to wait on the completion of the background request
- return new BackgroundRequestAsyncResult(request, this.backgroundRequestDone);
+ return new BackgroundRequestAsyncResult_DEPRECATED(request, this.backgroundRequestDone);
}
}
- internal BackgroundRequest CreateBackgroundRequest(FSharpSourceBase s, int line, int idx, TokenInfo info, string sourceText, ITextSnapshot snapshot, MethodTipMiscellany methodTipMiscellany, string fname, BackgroundRequestReason reason, IVsTextView view)
+ internal BackgroundRequest_DEPRECATED CreateBackgroundRequest(FSharpSourceBase_DEPRECATED s, int line, int idx, TokenInfo info, string sourceText, ITextSnapshot snapshot, MethodTipMiscellany_DEPRECATED methodTipMiscellany, string fname, BackgroundRequestReason reason, IVsTextView view)
{
// We set this to "false" because we are effectively abandoning any currently executing background request, e.g. an OnIdle request
this.isServingBackgroundRequest = false;
@@ -677,10 +683,10 @@ internal BackgroundRequest CreateBackgroundRequest(FSharpSourceBase s, int line,
}
// Implemented in FSharpLanguageService.fs
- internal abstract BackgroundRequest CreateBackgroundRequest(int line, int col, TokenInfo info, string sourceText, ITextSnapshot snapshot, MethodTipMiscellany methodTipMiscellany, string fname, BackgroundRequestReason reason, IVsTextView view,AuthoringSink sink, ISource source, int timestamp, bool synchronous);
+ internal abstract BackgroundRequest_DEPRECATED CreateBackgroundRequest(int line, int col, TokenInfo info, string sourceText, ITextSnapshot snapshot, MethodTipMiscellany_DEPRECATED methodTipMiscellany, string fname, BackgroundRequestReason reason, IVsTextView view,AuthoringSink sink, ISource source, int timestamp, bool synchronous);
// Implemented in FSharpLanguageService.fs
- internal abstract void OnParseFileOrCheckFileComplete(BackgroundRequest req);
+ internal abstract void OnParseFileOrCheckFileComplete(BackgroundRequest_DEPRECATED req);
internal void EnsureBackgroundThreadStarted()
{
@@ -698,7 +704,7 @@ internal void StopBackgroundThread()
{
if (this.backgroundThread != null)
{
- requests.Set(new BackgroundRequest(true));
+ requests.Set(new BackgroundRequest_DEPRECATED(true));
ManualResetEvent ptt = this.backgroundThreadTerminated;
this.backgroundRequestPending.Set();
if (!ptt.WaitOne(10, false))
@@ -732,7 +738,7 @@ internal bool IsServingBackgroundRequest
get { return this.isServingBackgroundRequest; }
}
- internal PendingRequests requests = new PendingRequests();
+ internal PendingRequests_DEPRECATED requests = new PendingRequests_DEPRECATED();
internal ManualResetEvent backgroundRequestPending;
internal ManualResetEvent backgroundThreadTerminated = new ManualResetEvent(false);
private ManualResetEvent backgroundRequestDone;
@@ -753,7 +759,7 @@ internal void BackgroundRequestThread()
{
break;
}
- BackgroundRequest req = null;
+ BackgroundRequest_DEPRECATED req = null;
lock (this)
{
req = this.requests.Dequeue();
@@ -927,12 +933,12 @@ int ILanguageServiceTestHelper.GetSemanticsVersion()
} // end class LanguageService
- internal class BackgroundRequestAsyncResult
+ internal class BackgroundRequestAsyncResult_DEPRECATED
{
ManualResetEvent globalRequestCompletedEvent;
- BackgroundRequest req;
+ BackgroundRequest_DEPRECATED req;
- internal BackgroundRequestAsyncResult(BackgroundRequest req, ManualResetEvent globalRequestCompletedEvent)
+ internal BackgroundRequestAsyncResult_DEPRECATED(BackgroundRequest_DEPRECATED req, ManualResetEvent globalRequestCompletedEvent)
{
this.globalRequestCompletedEvent = globalRequestCompletedEvent;
this.req = req;
@@ -944,9 +950,9 @@ internal bool TryWaitForBackgroundRequestCompletion(int millisecondsTimeout)
}
- internal delegate void BackgroundRequestResultHandler(BackgroundRequest request);
+ internal delegate void BackgroundRequestResultHandler(BackgroundRequest_DEPRECATED request);
- internal enum MethodTipMiscellany
+ internal enum MethodTipMiscellany_DEPRECATED
{
Typing, // OnCommand TYPECHAR nothing special refresh already-displayed tip
ExplicitlyInvokedViaCtrlShiftSpace, // ViewFilter PARAMINFO
@@ -956,7 +962,7 @@ internal enum MethodTipMiscellany
JustPressedCloseParen, // OnCommand TYPECHAR TokenTriggers ParamEnd
}
- internal class BackgroundRequest
+ internal class BackgroundRequest_DEPRECATED
{
int line, col;
ISource source;
@@ -969,7 +975,7 @@ internal class BackgroundRequest
bool terminate;
BackgroundRequestResultHandler callback;
AuthoringSink sink;
- IntellisenseInfo scope;
+ IntellisenseInfo_DEPRECATED scope;
bool isFreshFullTypeCheck;
int startTimeForOnIdleRequest;
string quickInfoText;
@@ -979,9 +985,9 @@ internal class BackgroundRequest
int resultTimestamp;
RequireFreshResults requireFreshResults;
bool isSynchronous;
- internal BackgroundRequestAsyncResult result;
+ internal BackgroundRequestAsyncResult_DEPRECATED result;
- internal MethodTipMiscellany MethodTipMiscellany { get; set; }
+ internal MethodTipMiscellany_DEPRECATED MethodTipMiscellany { get; set; }
internal RequireFreshResults RequireFreshResults
{
@@ -995,7 +1001,7 @@ internal bool IsSynchronous
set { isSynchronous = value; }
}
- internal BackgroundRequestAsyncResult Result
+ internal BackgroundRequestAsyncResult_DEPRECATED Result
{
get { return result; }
}
@@ -1066,7 +1072,7 @@ internal AuthoringSink ResultSink
set { this.sink = value; }
}
- internal IntellisenseInfo ResultIntellisenseInfo
+ internal IntellisenseInfo_DEPRECATED ResultIntellisenseInfo
{
get { return this.scope; }
set { this.scope = value; }
@@ -1116,7 +1122,7 @@ internal int ResultTimestamp
set { this.resultTimestamp = value; }
}
- internal BackgroundRequest(bool terminate)
+ internal BackgroundRequest_DEPRECATED(bool terminate)
{
this.Terminate = terminate;
}
@@ -1133,7 +1139,7 @@ internal ISource Source
internal bool IsAborted { get; set; }
- internal BackgroundRequest(int line, int col, TokenInfo info, string src, ITextSnapshot snapshot, MethodTipMiscellany methodTipMiscellany, string fname,
+ internal BackgroundRequest_DEPRECATED(int line, int col, TokenInfo info, string src, ITextSnapshot snapshot, MethodTipMiscellany_DEPRECATED methodTipMiscellany, string fname,
BackgroundRequestReason reason, IVsTextView view,
AuthoringSink sink, ISource source, int timestamp, bool synchronous)
{
@@ -1161,9 +1167,9 @@ internal BackgroundRequest(int line, int col, TokenInfo info, string src, ITextS
/// If Success = true, then Url\Span should be filled, ErrorDescription will be null
/// If Success = false - then only ErrorDescription will have value, Url and Span will have default values
///
- internal class GotoDefinitionResult
+ internal class GotoDefinitionResult_DEPRECATED
{
- private GotoDefinitionResult(bool success, string url, TextSpan span, string errorDescription)
+ private GotoDefinitionResult_DEPRECATED(bool success, string url, TextSpan span, string errorDescription)
{
Success = success;
Url = url;
@@ -1182,12 +1188,12 @@ private GotoDefinitionResult(bool success, string url, TextSpan span, string err
/// Path to source file
/// Location in source file
/// New instance of GotoDefinitionResult
- public static GotoDefinitionResult MakeSuccess(string url, TextSpan span)
+ public static GotoDefinitionResult_DEPRECATED MakeSuccess(string url, TextSpan span)
{
if (url == null)
throw new ArgumentNullException("url");
- return new GotoDefinitionResult(true, url, span, null);
+ return new GotoDefinitionResult_DEPRECATED(true, url, span, null);
}
///
@@ -1195,11 +1201,11 @@ public static GotoDefinitionResult MakeSuccess(string url, TextSpan span)
///
/// Error message
/// New instance of GotoDefinitionResult
- public static GotoDefinitionResult MakeError(string errorDescription)
+ public static GotoDefinitionResult_DEPRECATED MakeError(string errorDescription)
{
if (String.IsNullOrWhiteSpace(errorDescription))
throw new ArgumentNullException("errorDescription");
- return new GotoDefinitionResult(false, null, default(TextSpan), errorDescription);
+ return new GotoDefinitionResult_DEPRECATED(false, null, default(TextSpan), errorDescription);
}
}
@@ -1213,7 +1219,7 @@ public static GotoDefinitionResult MakeError(string errorDescription)
/// 5. if non-UI request is enqueued after UI request -> nothing happens and they will be dequeued subsequently
///
///
- internal class PendingRequests
+ internal class PendingRequests_DEPRECATED
{
private enum RequestType
{
@@ -1227,10 +1233,10 @@ private enum RequestType
// first == null && second == null => count == 0
// first != null && second == null => count == 1
// first != null && second != null => count == 2
- private BackgroundRequest first;
- private BackgroundRequest second;
+ private BackgroundRequest_DEPRECATED first;
+ private BackgroundRequest_DEPRECATED second;
- public void Enqueue(BackgroundRequest newRequest)
+ public void Enqueue(BackgroundRequest_DEPRECATED newRequest)
{
if (newRequest == null)
throw new ArgumentNullException("newRequest");
@@ -1289,7 +1295,7 @@ public void Enqueue(BackgroundRequest newRequest)
///
/// Checks if request queue contains request similar to the given one.
///
- public bool ContainsSimilarRequest(BackgroundRequest request)
+ public bool ContainsSimilarRequest(BackgroundRequest_DEPRECATED request)
{
var requestType = GetRequestType(request);
lock (syncRoot)
@@ -1316,7 +1322,7 @@ public bool ContainsSimilarRequest(BackgroundRequest request)
/// Gets request from queue
///
///
- public BackgroundRequest Dequeue()
+ public BackgroundRequest_DEPRECATED Dequeue()
{
lock (syncRoot)
{
@@ -1333,7 +1339,7 @@ public BackgroundRequest Dequeue()
///
/// Discards all requests added so far and enqueues specified request.
///
- public void Set(BackgroundRequest r)
+ public void Set(BackgroundRequest_DEPRECATED r)
{
lock (syncRoot)
{
@@ -1357,7 +1363,7 @@ internal int Count
}
}
- private static RequestType GetRequestType(BackgroundRequest r)
+ private static RequestType GetRequestType(BackgroundRequest_DEPRECATED r)
{
switch (r.Reason)
{
@@ -1370,22 +1376,22 @@ private static RequestType GetRequestType(BackgroundRequest r)
}
}
- internal abstract class IntellisenseInfo
+ internal abstract class IntellisenseInfo_DEPRECATED
{
internal abstract System.Tuple GetDataTipText(int line, int col);
- internal abstract Microsoft.FSharp.Control.FSharpAsync GetDeclarations(ITextSnapshot textSnapshot, int line, int col, BackgroundRequestReason reason);
+ internal abstract Microsoft.FSharp.Control.FSharpAsync GetDeclarations(ITextSnapshot textSnapshot, int line, int col, BackgroundRequestReason reason);
- internal abstract Microsoft.FSharp.Core.FSharpOption GetMethodListForAMethodTip();
+ internal abstract Microsoft.FSharp.Core.FSharpOption GetMethodListForAMethodTip();
- internal abstract GotoDefinitionResult Goto(IVsTextView textView, int line, int col);
+ internal abstract GotoDefinitionResult_DEPRECATED Goto(IVsTextView textView, int line, int col);
internal abstract void GetF1KeywordString(TextSpan span, IVsUserContext context);
}
// Note, this class is only implemented once in the F# Language Service implementation, in the F# code which implements the
// declaration set. It would be better if all the implementation details in this code were put in the F# code.
- internal abstract class Declarations
+ internal abstract class Declarations_DEPRECATED
{
internal abstract bool IsEmpty();
@@ -1420,8 +1426,15 @@ internal abstract class Declarations
//-------------------------------------------------------------------------------------
+ // Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+ //
+ // Note: Tests using this code should either be adjusted to test the corresponding feature in
+ // FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+ // functionality and thus have considerable value, they should ony be deleted if we are sure this
+ // is not the case.
+ //
// represents all the information necessary to display and navigate withing a method tip (e.g. param info, overloads, ability to move thru overloads and params)
- internal abstract class MethodListForAMethodTip
+ internal abstract class MethodListForAMethodTip_DEPRECATED
{
internal abstract string GetName(int index);
@@ -1482,13 +1495,13 @@ internal virtual string TypePostfix
}
}
- internal class BraceMatch
+ internal class BraceMatch_DEPRECATED
{
internal TextSpan a;
internal TextSpan b;
internal int priority;
- internal BraceMatch(TextSpan a, TextSpan b, int priority)
+ internal BraceMatch_DEPRECATED(TextSpan a, TextSpan b, int priority)
{
this.a = a;
this.b = b;
@@ -1497,7 +1510,7 @@ internal BraceMatch(TextSpan a, TextSpan b, int priority)
}
- internal class TripleMatch : BraceMatch
+ internal class TripleMatch : BraceMatch_DEPRECATED
{
internal TextSpan c;
@@ -1566,13 +1579,13 @@ internal bool FoundMatchingBrace
}
- private void AddBraces(BraceMatch b)
+ private void AddBraces(BraceMatch_DEPRECATED b)
{
this.foundMatchingBrace = true;
int i = 0;
for (int n = this.Braces.Count; i < n; i++)
{
- BraceMatch a = (BraceMatch)this.Braces[i];
+ BraceMatch_DEPRECATED a = (BraceMatch_DEPRECATED)this.Braces[i];
if (a.priority < b.priority)
break;
}
@@ -1615,7 +1628,7 @@ internal virtual void MatchPair(TextSpan span, TextSpan endContext, int priority
{
this.Spans.Add(span);
this.Spans.Add(endContext);
- AddBraces(new BraceMatch(span, endContext, priority));
+ AddBraces(new BraceMatch_DEPRECATED(span, endContext, priority));
}
}
}
diff --git a/vsintegration/src/FSharp.LanguageService.Base/Source.cs b/vsintegration/src/FSharp.LanguageService.Base/Source.cs
index 657fc8d67a1..858696e61b6 100644
--- a/vsintegration/src/FSharp.LanguageService.Base/Source.cs
+++ b/vsintegration/src/FSharp.LanguageService.Base/Source.cs
@@ -107,9 +107,9 @@ internal static class SourceConstants
/// Source represents one source file and manages the parsing and intellisense on this file
/// and keeping things like the drop down combos in sync with the source and so on.
///
- abstract internal class FSharpSourceBase : ISource, IVsTextLinesEvents, IVsHiddenTextClient, IVsUserDataEvents
+ abstract internal class FSharpSourceBase_DEPRECATED : ISource, IVsTextLinesEvents, IVsHiddenTextClient, IVsUserDataEvents
{
- private LanguageService service;
+ private LanguageService_DEPRECATED service;
private IVsTextLines textLines;
private Colorizer colorizer;
private Microsoft.VisualStudio.Shell.TaskProvider taskProvider;
@@ -122,7 +122,7 @@ abstract internal class FSharpSourceBase : ISource, IVsTextLinesEvents, IVsHidde
private NativeMethods.ConnectionPointCookie userDataEvents;
private IVsTextColorState colorState;
private IVsHiddenTextSession hiddenTextSession;
- private BackgroundRequest lastBraceMatchRequest = null;
+ private BackgroundRequest_DEPRECATED lastBraceMatchRequest = null;
private string originalFileName = null;
private bool doOutlining;
@@ -139,7 +139,7 @@ protected IVsEditorAdaptersFactoryService getEditorAdapter()
return componentModel.GetService();
}
- internal FSharpSourceBase(LanguageService service, IVsTextLines textLines, Colorizer colorizer)
+ internal FSharpSourceBase_DEPRECATED(LanguageService_DEPRECATED service, IVsTextLines textLines, Colorizer colorizer)
{
#if LANGTRACE
Tracing.TraceRef(textLines, "Source.textLines");
@@ -168,7 +168,7 @@ internal FSharpSourceBase(LanguageService service, IVsTextLines textLines, Color
this.openedTime = System.DateTime.Now;
}
- ~FSharpSourceBase()
+ ~FSharpSourceBase_DEPRECATED()
{
#if LANGTRACE
Trace.WriteLine("~Source");
@@ -186,7 +186,7 @@ public IVsTextColorState ColorState
set { this.colorState = value; }
}
- public LanguageService LanguageService
+ public LanguageService_DEPRECATED LanguageService
{
get { return this.service; }
}
@@ -253,7 +253,7 @@ internal virtual TaskReporter GetTaskReporter()
return taskReporter;
}
- public LanguageService Service { get { return this.service; } }
+ public LanguageService_DEPRECATED Service { get { return this.service; } }
public ExpansionProvider GetExpansionProvider()
@@ -1016,7 +1016,7 @@ public void OnIdle(bool periodic)
{
if (this.NeedsVisualRefresh && !this.service.IsServingBackgroundRequest)
{
- BackgroundRequest req = this.BeginBackgroundRequest(0, 0, new TokenInfo(), BackgroundRequestReason.FullTypeCheck, this.service.LastActiveTextView, RequireFreshResults.Yes, new BackgroundRequestResultHandler(this.HandleUntypedParseOrFullTypeCheckResponse));
+ BackgroundRequest_DEPRECATED req = this.BeginBackgroundRequest(0, 0, new TokenInfo(), BackgroundRequestReason.FullTypeCheck, this.service.LastActiveTextView, RequireFreshResults.Yes, new BackgroundRequestResultHandler(this.HandleUntypedParseOrFullTypeCheckResponse));
if (req != null) req.StartTimeForOnIdleRequest = Environment.TickCount;
}
}
@@ -1060,7 +1060,7 @@ public void OnCommand(IVsTextView textView, VsCommands2K command, char ch)
var matchBraces = false;
var methodTip = false;
- MethodTipMiscellany misc = 0;
+ MethodTipMiscellany_DEPRECATED misc = 0;
if ((triggerClass & TokenTriggers.MemberSelect) != 0 && (command == VsCommands2K.TYPECHAR))
{
@@ -1084,11 +1084,11 @@ public void OnCommand(IVsTextView textView, VsCommands2K command, char ch)
{
methodTip = true;
- misc = MethodTipMiscellany.JustPressedOpenParen;
+ misc = MethodTipMiscellany_DEPRECATED.JustPressedOpenParen;
if ((triggerClass & TokenTriggers.ParameterNext) != 0)
- misc = MethodTipMiscellany.JustPressedComma;
+ misc = MethodTipMiscellany_DEPRECATED.JustPressedComma;
if ((triggerClass & TokenTriggers.ParameterEnd) != 0)
- misc = MethodTipMiscellany.JustPressedCloseParen;
+ misc = MethodTipMiscellany_DEPRECATED.JustPressedCloseParen;
}
else if (this.methodData.IsDisplayed)
{
@@ -1096,11 +1096,11 @@ public void OnCommand(IVsTextView textView, VsCommands2K command, char ch)
{
// the may have just erased a paren or comma, need to re-parse
methodTip = true;
- misc = MethodTipMiscellany.JustPressedBackspace;
+ misc = MethodTipMiscellany_DEPRECATED.JustPressedBackspace;
}
else
{
- this.methodData.Refresh(MethodTipMiscellany.Typing);
+ this.methodData.Refresh(MethodTipMiscellany_DEPRECATED.Typing);
}
}
@@ -1152,7 +1152,7 @@ public bool GetWordExtent(int line, int idx, WORDEXTFLAGS flags, out int startId
// are doing intellisense in which case we want to match the entire value
// of quoted strings.
TokenType type = info.Type;
- if ((flags != FSharpSourceBase.WholeToken || type != TokenType.String) && (type == TokenType.Comment || type == TokenType.LineComment || type == TokenType.Text || type == TokenType.String || type == TokenType.Literal))
+ if ((flags != FSharpSourceBase_DEPRECATED.WholeToken || type != TokenType.String) && (type == TokenType.Comment || type == TokenType.LineComment || type == TokenType.Text || type == TokenType.String || type == TokenType.Literal))
return false;
//search for a token
switch (flags & WORDEXTFLAGS.WORDEXT_MOVETYPE_MASK)
@@ -1307,12 +1307,12 @@ internal static IWpfTextView GetWpfTextViewFromVsTextView(IVsTextView view)
return textViewHost.TextView;
}
- public void MethodTip(IVsTextView textView, int line, int index, TokenInfo info, MethodTipMiscellany methodTipMiscellany, RequireFreshResults requireFreshResults)
+ public void MethodTip(IVsTextView textView, int line, int index, TokenInfo info, MethodTipMiscellany_DEPRECATED methodTipMiscellany, RequireFreshResults requireFreshResults)
{
this.BeginBackgroundRequest(line, index, info, BackgroundRequestReason.MethodTip, textView, requireFreshResults, new BackgroundRequestResultHandler(this.HandleMethodTipResponse), methodTipMiscellany);
}
- private void HandleMethodTipResponse(BackgroundRequest req)
+ private void HandleMethodTipResponse(BackgroundRequest_DEPRECATED req)
{
try
{
@@ -1333,10 +1333,10 @@ private void HandleMethodTipResponse(BackgroundRequest req)
}
else
{
- Microsoft.FSharp.Core.FSharpOption methodsOpt = req.ResultIntellisenseInfo.GetMethodListForAMethodTip();
+ Microsoft.FSharp.Core.FSharpOption methodsOpt = req.ResultIntellisenseInfo.GetMethodListForAMethodTip();
if (methodsOpt != null)
{
- MethodListForAMethodTip methods = methodsOpt.Value;
+ MethodListForAMethodTip_DEPRECATED methods = methodsOpt.Value;
if (methods != null)
{
@@ -1349,7 +1349,7 @@ private void HandleMethodTipResponse(BackgroundRequest req)
}
}
- else if (req.MethodTipMiscellany == MethodTipMiscellany.JustPressedOpenParen && req.Timestamp != req.ResultTimestamp)
+ else if (req.MethodTipMiscellany == MethodTipMiscellany_DEPRECATED.JustPressedOpenParen && req.Timestamp != req.ResultTimestamp)
{
// Second-chance param info: we didn't get any result and the basis typecheck was stale. We need to retrigger the completion.
this.MethodTip(req.View, req.Line, req.Col, req.TokenInfo, req.MethodTipMiscellany, RequireFreshResults.Yes);
@@ -1372,7 +1372,7 @@ public void MatchBraces(IVsTextView textView, int line, int index, TokenInfo inf
this.BeginBackgroundRequest(line, index, info, BackgroundRequestReason.MatchBraces, textView, RequireFreshResults.No, new BackgroundRequestResultHandler(this.HandleMatchBracesResponse));
}
- public void MatchBracesAndMethodTip(IVsTextView textView, int line, int index, MethodTipMiscellany misc, TokenInfo info)
+ public void MatchBracesAndMethodTip(IVsTextView textView, int line, int index, MethodTipMiscellany_DEPRECATED misc, TokenInfo info)
{
this.BeginBackgroundRequest(line, index, info, BackgroundRequestReason.MatchBracesAndMethodTip, textView, RequireFreshResults.No,
req =>
@@ -1383,7 +1383,7 @@ public void MatchBracesAndMethodTip(IVsTextView textView, int line, int index, M
);
}
- public void HandleMatchBracesResponse(BackgroundRequest req)
+ public void HandleMatchBracesResponse(BackgroundRequest_DEPRECATED req)
{
try
{
@@ -1402,9 +1402,9 @@ public void HandleMatchBracesResponse(BackgroundRequest req)
NativeMethods.ThrowOnFailure(req.View.GetCaretPos(out line, out idx));
// Get all braces from language service and filter them
- List braces = new List();
- foreach (BraceMatch m in req.ResultSink.Braces) braces.Add(m);
- braces.RemoveAll(delegate(BraceMatch match)
+ List braces = new List();
+ foreach (BraceMatch_DEPRECATED m in req.ResultSink.Braces) braces.Add(m);
+ braces.RemoveAll(delegate(BraceMatch_DEPRECATED match)
{
if (match.a.iStartLine == line && match.a.iStartIndex == idx) return false;
if (match.b.iEndLine == line && match.b.iEndIndex == idx) return false;
@@ -1413,7 +1413,7 @@ public void HandleMatchBracesResponse(BackgroundRequest req)
// Transform collection of braces into an array of spans
List spans = new List();
- foreach (BraceMatch m in braces)
+ foreach (BraceMatch_DEPRECATED m in braces)
{
spans.Add(m.a); spans.Add(m.b);
}
@@ -1508,7 +1508,7 @@ private bool GetPairExtents(IVsTextView textView, int line, int col, out TextSpa
endBraceSpan = new TextSpan();
// Synchronously return the matching brace location.
- BackgroundRequest req = null;
+ BackgroundRequest_DEPRECATED req = null;
if (this.lastBraceMatchRequest != null && this.lastBraceMatchRequest.Timestamp == this.ChangeCount)
{
@@ -1542,7 +1542,7 @@ private bool GetPairExtents(IVsTextView textView, int line, int col, out TextSpa
int i = 0;
for (i = 0; i < matches; i++)
{
- BraceMatch m = (BraceMatch)req.ResultSink.Braces[i];
+ BraceMatch_DEPRECATED m = (BraceMatch_DEPRECATED)req.ResultSink.Braces[i];
TripleMatch t = m as TripleMatch;
if (TextSpanHelper.ContainsInclusive(m.a, line, col))
{
@@ -1578,7 +1578,7 @@ private bool GetPairExtents(IVsTextView textView, int line, int col, out TextSpa
return found;
}
- void HandleGetPairExtentResponse(BackgroundRequest request)
+ void HandleGetPairExtentResponse(BackgroundRequest_DEPRECATED request)
{
if (this.service == null)
{
@@ -1587,7 +1587,7 @@ void HandleGetPairExtentResponse(BackgroundRequest request)
this.lastBraceMatchRequest = request;
}
- public BackgroundRequest BeginBackgroundRequest(int line, int idx, TokenInfo info, BackgroundRequestReason reason, IVsTextView view, RequireFreshResults requireFreshResults, BackgroundRequestResultHandler callback, MethodTipMiscellany methodTipMiscellany = 0)
+ public BackgroundRequest_DEPRECATED BeginBackgroundRequest(int line, int idx, TokenInfo info, BackgroundRequestReason reason, IVsTextView view, RequireFreshResults requireFreshResults, BackgroundRequestResultHandler callback, MethodTipMiscellany_DEPRECATED methodTipMiscellany = 0)
{
var wpfTextView = GetWpfTextViewFromVsTextView(view);
var snapshot = wpfTextView.TextSnapshot;
@@ -1609,7 +1609,7 @@ public BackgroundRequest BeginBackgroundRequest(int line, int idx, TokenInfo inf
this.service.RecentFullTypeCheckFile.Equals(fname) &&
requireFreshResults != RequireFreshResults.Yes)
{
- BackgroundRequest request = this.service.CreateBackgroundRequest(this, line, idx, info, null, snapshot, methodTipMiscellany, fname, reason, view);
+ BackgroundRequest_DEPRECATED request = this.service.CreateBackgroundRequest(this, line, idx, info, null, snapshot, methodTipMiscellany, fname, reason, view);
request.ResultIntellisenseInfo = this.service.RecentFullTypeCheckResults;
request.ResultClearsDirtinessOfFile = false;
request.Timestamp = this.ChangeCount;
@@ -1621,7 +1621,7 @@ public BackgroundRequest BeginBackgroundRequest(int line, int idx, TokenInfo inf
{
string text = this.GetText(); // get all the text
- BackgroundRequest request = this.service.CreateBackgroundRequest(this, line, idx, info, text, snapshot, methodTipMiscellany, fname, reason, view);
+ BackgroundRequest_DEPRECATED request = this.service.CreateBackgroundRequest(this, line, idx, info, text, snapshot, methodTipMiscellany, fname, reason, view);
request.Timestamp = this.ChangeCount;
request.DirtySpan = this.dirtySpan;
request.RequireFreshResults = requireFreshResults;
@@ -1643,7 +1643,7 @@ public BackgroundRequest BeginBackgroundRequest(int line, int idx, TokenInfo inf
}
}
- public void HandleResponseHelper(BackgroundRequest req)
+ public void HandleResponseHelper(BackgroundRequest_DEPRECATED req)
{
try
{
@@ -1683,7 +1683,7 @@ public void HandleResponseHelper(BackgroundRequest req)
}
- public void HandleUntypedParseOrFullTypeCheckResponse(BackgroundRequest req)
+ public void HandleUntypedParseOrFullTypeCheckResponse(BackgroundRequest_DEPRECATED req)
{
if (this.service == null) return;
try
@@ -2136,7 +2136,7 @@ internal sealed class CompletionSet : IVsCompletionSet, IVsCompletionSetEx, IDis
char commitChar;
int commitIndex;
IVsTextView textView;
- Declarations decls;
+ Declarations_DEPRECATED decls;
string filterText;
ISource source;
bool isCommitted;
@@ -2175,7 +2175,7 @@ public string OnCommitText
}
}
- public void Init(IVsTextView textView, Declarations declarations, bool completeWord)
+ public void Init(IVsTextView textView, Declarations_DEPRECATED declarations, bool completeWord)
{
Close();
this.textView = textView;
@@ -2313,13 +2313,13 @@ public int GetInitialExtent(out int line, out int startIdx, out int endIdx)
int GetTokenExtent(int line, int idx, out int startIdx, out int endIdx)
{
int hr = Microsoft.VisualStudio.VSConstants.S_OK;
- bool rc = this.source.GetWordExtent(line, idx, FSharpSourceBase.WholeToken, out startIdx, out endIdx);
+ bool rc = this.source.GetWordExtent(line, idx, FSharpSourceBase_DEPRECATED.WholeToken, out startIdx, out endIdx);
// make sure the span is positive.
endIdx = Math.Max(startIdx, endIdx);
if (!rc && idx > 0)
{
- rc = this.source.GetWordExtent(line, idx - 1, FSharpSourceBase.WholeToken, out startIdx, out endIdx);
+ rc = this.source.GetWordExtent(line, idx - 1, FSharpSourceBase_DEPRECATED.WholeToken, out startIdx, out endIdx);
if (!rc)
{
// Must stop core text editor from looking at startIdx and endIdx since they are likely
@@ -2473,7 +2473,7 @@ internal sealed class MethodData : IVsMethodData, IDisposable
{
IServiceProvider provider;
IVsMethodTipWindow methodTipWindow;
- MethodListForAMethodTip methods;
+ MethodListForAMethodTip_DEPRECATED methods;
private NativeStringsCacheForOverloads nativeStringsCacheForOverloads;
int currentParameter;
int currentMethod;
@@ -2524,7 +2524,7 @@ public bool IsDisplayed
}
}
- private static bool MethodsSeemToDiffer(MethodListForAMethodTip a, MethodListForAMethodTip b)
+ private static bool MethodsSeemToDiffer(MethodListForAMethodTip_DEPRECATED a, MethodListForAMethodTip_DEPRECATED b)
{
// this is an approximate test, that is good enough in practice
return (a.GetName(0) != b.GetName(0))
@@ -2532,7 +2532,7 @@ private static bool MethodsSeemToDiffer(MethodListForAMethodTip a, MethodListFor
|| (!(a.GetNoteworthyParamInfoLocations()[0].Equals(b.GetNoteworthyParamInfoLocations()[0])));
}
- private static HashSet FormalParamNames(MethodListForAMethodTip m, int index)
+ private static HashSet FormalParamNames(MethodListForAMethodTip_DEPRECATED m, int index)
{
int numParams = m.GetParameterCount(index);
HashSet hs = new HashSet();
@@ -2545,10 +2545,10 @@ private static HashSet FormalParamNames(MethodListForAMethodTip m, int i
return hs;
}
- public void Refresh(IVsTextView textView, MethodListForAMethodTip methods, TextSpan context, MethodTipMiscellany methodTipMiscellany)
+ public void Refresh(IVsTextView textView, MethodListForAMethodTip_DEPRECATED methods, TextSpan context, MethodTipMiscellany_DEPRECATED methodTipMiscellany)
{
bool needToDismissNow = false;
- if (this.displayed && methodTipMiscellany == MethodTipMiscellany.JustPressedBackspace
+ if (this.displayed && methodTipMiscellany == MethodTipMiscellany_DEPRECATED.JustPressedBackspace
&& MethodsSeemToDiffer(this.methods, methods))
{
// We just hit backspace, and apparently the 'set of methods' changed. This most commonly happens in a case like
@@ -2574,24 +2574,24 @@ public void Refresh(IVsTextView textView, MethodListForAMethodTip methods, TextS
this.Refresh(methodTipMiscellany);
}
}
- public void Refresh(MethodTipMiscellany methodTipMiscellany)
+ public void Refresh(MethodTipMiscellany_DEPRECATED methodTipMiscellany)
{
- var wpfTextView = FSharpSourceBase.GetWpfTextViewFromVsTextView(textView);
+ var wpfTextView = FSharpSourceBase_DEPRECATED.GetWpfTextViewFromVsTextView(textView);
var ranges = methods.GetParameterRanges();
Debug.Assert(ranges != null && ranges.Length > 0);
// Don't do anything for open parens and commas that aren't intrinsic to a method call
- if (!this.displayed && methodTipMiscellany == MethodTipMiscellany.JustPressedCloseParen)
+ if (!this.displayed && methodTipMiscellany == MethodTipMiscellany_DEPRECATED.JustPressedCloseParen)
{
return; // close paren must never cause it to appear
}
- if (!this.displayed && methodTipMiscellany == MethodTipMiscellany.JustPressedOpenParen)
+ if (!this.displayed && methodTipMiscellany == MethodTipMiscellany_DEPRECATED.JustPressedOpenParen)
{
// the only good open paren is the start of the first param, don't want to cause a tip to be displayed $here$: foo(x, $($y+z), w)
if (!ranges[0].GetSpan(wpfTextView.TextSnapshot).Start.Equals(wpfTextView.Caret.Position.BufferPosition))
return;
}
- if (!this.displayed && methodTipMiscellany == MethodTipMiscellany.JustPressedComma)
+ if (!this.displayed && methodTipMiscellany == MethodTipMiscellany_DEPRECATED.JustPressedComma)
{
// the only good commas will be, interestingly, at the start of the following param span
// this by virtue of fact that we assume comma is one character after where the previous parameter range ends (and thus the first character of the next range)
@@ -2629,7 +2629,7 @@ public void Refresh(MethodTipMiscellany methodTipMiscellany)
{
// a bit of a kludge; if they just backspaced over the last comma and there's no close parenthesis, the caret is just to the right of all the param
// ranges, but we don't want to dismiss the tip. so look just left of the caret and see if that would be inside the final param
- if (methodTipMiscellany == MethodTipMiscellany.JustPressedBackspace
+ if (methodTipMiscellany == MethodTipMiscellany_DEPRECATED.JustPressedBackspace
&& ranges[ranges.Length - 1].GetSpan(wpfTextView.TextSnapshot).Contains(wpfTextView.Caret.Position.BufferPosition.Subtract(1)))
{
this.currentParameter = ranges.Length - 1;
@@ -2642,8 +2642,8 @@ public void Refresh(MethodTipMiscellany methodTipMiscellany)
}
}
// possibly select a method from overload list based on current num of params the user has
- if (methodTipMiscellany == MethodTipMiscellany.ExplicitlyInvokedViaCtrlShiftSpace
- || methodTipMiscellany == MethodTipMiscellany.JustPressedComma)
+ if (methodTipMiscellany == MethodTipMiscellany_DEPRECATED.ExplicitlyInvokedViaCtrlShiftSpace
+ || methodTipMiscellany == MethodTipMiscellany_DEPRECATED.JustPressedComma)
{
Debug.Assert(this.methods != null, "this can happen if we just called Dismiss() because we erroneously decided the caret moves outside the parens");
diff --git a/vsintegration/src/FSharp.LanguageService.Base/ViewFilter.cs b/vsintegration/src/FSharp.LanguageService.Base/ViewFilter.cs
index f89215c9cab..c94a1bd22d4 100644
--- a/vsintegration/src/FSharp.LanguageService.Base/ViewFilter.cs
+++ b/vsintegration/src/FSharp.LanguageService.Base/ViewFilter.cs
@@ -44,7 +44,7 @@ namespace Microsoft.VisualStudio.FSharp.LanguageService {
public class ViewFilter : IVsTextViewFilter, IVsTextViewEvents, IOleCommandTarget, IDisposable, IVsExpansionEvents {
private CodeWindowManager mgr;
private NativeMethods.ConnectionPointCookie textViewEvents;
- private LanguageService service;
+ private LanguageService_DEPRECATED service;
private IVsTextView textView;
private IOleCommandTarget nextTarget;
private TextTipData textTipData;
@@ -267,7 +267,7 @@ public virtual int GetDataTipText(TextSpan[] aspan, out string textValue) {
}
- internal void GetDataTipResponse(BackgroundRequest req)
+ internal void GetDataTipResponse(BackgroundRequest_DEPRECATED req)
{
if (req == null || req.Source == null || req.Source.IsClosed) return;
@@ -512,7 +512,7 @@ public virtual bool HandlePreExec(ref Guid guidCmdGroup, uint nCmdId, uint nCmde
return true;
case VsCommands2K.PARAMINFO:
- this.source.MethodTip(this.textView, line, col, this.source.GetTokenInfo(line, col), MethodTipMiscellany.ExplicitlyInvokedViaCtrlShiftSpace, RequireFreshResults.No);
+ this.source.MethodTip(this.textView, line, col, this.source.GetTokenInfo(line, col), MethodTipMiscellany_DEPRECATED.ExplicitlyInvokedViaCtrlShiftSpace, RequireFreshResults.No);
return true;
case VsCommands2K.QUICKINFO:
@@ -821,7 +821,7 @@ public virtual void HandleQuickInfo(int line, int col) {
new BackgroundRequestResultHandler(HandleQuickInfoResponse));
}
- void HandleQuickInfoResponse(BackgroundRequest req){
+ void HandleQuickInfoResponse(BackgroundRequest_DEPRECATED req){
if (req == null || req.Source == null || req.Source.IsClosed) return;
int line;
@@ -942,7 +942,7 @@ public virtual void HandleGoto(VsCommands cmd, int line, int col) {
new BackgroundRequestResultHandler(HandleGotoResponse));
}
- void HandleGotoResponse(BackgroundRequest req) {
+ void HandleGotoResponse(BackgroundRequest_DEPRECATED req) {
if (req == null || req.Source == null || req.Source.IsClosed) return;
// Make sure caret hasn't moved since we kicked this off.
@@ -954,7 +954,7 @@ void HandleGotoResponse(BackgroundRequest req) {
string url = null;
TextSpan span;
- IntellisenseInfo scope = req.ResultIntellisenseInfo;
+ IntellisenseInfo_DEPRECATED scope = req.ResultIntellisenseInfo;
if (scope != null && gotoCmd == Microsoft.VisualStudio.VSConstants.VSStd97CmdID.GotoDefn)
{
var gotoResult = scope.Goto(textView, line, col);
diff --git a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs
index 8d2cfce4b92..6fea005f3a2 100644
--- a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs
+++ b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+//------- DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS ---------------
+
namespace Microsoft.VisualStudio.FSharp.LanguageService
open System
@@ -12,20 +14,36 @@ open Microsoft.VisualStudio.Shell.Interop
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.SourceCodeServices
-type internal FSharpBackgroundRequestExtraData =
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpBackgroundRequestExtraData_DEPRECATED =
{ ProjectSite : IProjectSite
CheckOptions : FSharpProjectOptions
ProjectFileName : string
FSharpChecker : FSharpChecker
- Colorizer : Lazy }
-
-type internal FSharpBackgroundRequest
+ Colorizer : Lazy }
+
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpBackgroundRequest_DEPRECATED
(line, col, info, sourceText, snapshot : ITextSnapshot,
- methodTipMiscellany : MethodTipMiscellany, fileName, reason, view, sink,
+ methodTipMiscellany : MethodTipMiscellany_DEPRECATED, fileName, reason, view, sink,
source:ISource, timestamp:int, synchronous:bool,
- extraData : Lazy option) =
+ extraData : Lazy option) =
- inherit BackgroundRequest(line, col, info, sourceText, snapshot, methodTipMiscellany, fileName, reason, view, sink, source, timestamp, synchronous)
+ inherit BackgroundRequest_DEPRECATED(line, col, info, sourceText, snapshot, methodTipMiscellany, fileName, reason, view, sink, source, timestamp, synchronous)
member this.ExtraData = extraData
@@ -34,17 +52,23 @@ type internal FSharpBackgroundRequest
| None -> None
| Some data -> Some (data.Force().Colorizer.Force())
-/// The slice of the language service that looks after making requests to the FSharpChecker,
-/// It also keeps and maintains parsing results for navigation bar, regions and brekpoint validation.
-type internal FSharpLanguageServiceBackgroundRequests
- (getColorizer: IVsTextView -> FSharpColorizer,
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpLanguageServiceBackgroundRequests_DEPRECATED
+ (getColorizer: IVsTextView -> FSharpColorizer_DEPRECATED,
getInteractiveChecker: unit -> FSharpChecker,
getProjectSitesAndFiles : unit -> ProjectSitesAndFiles,
getServiceProvider: unit -> System.IServiceProvider,
- getDocumentationBuilder: unit -> IDocumentationBuilder) =
+ getDocumentationBuilder: unit -> IDocumentationBuilder_DEPRECATED) =
let mutable parseFileResults : FSharpParseFileResults option = None
- let mutable lastParseFileRequest : BackgroundRequest = null
+ let mutable lastParseFileRequest : BackgroundRequest_DEPRECATED = null
let outOfDateProjectFileNames = new System.Collections.Generic.HashSet()
@@ -53,7 +77,7 @@ type internal FSharpLanguageServiceBackgroundRequests
outOfDateProjectFileNames.Add(nm) |> ignore
// This method is executed on the UI thread
- member this.CreateBackgroundRequest(line: int, col: int, info: TokenInfo, sourceText: string, snapshot: ITextSnapshot, methodTipMiscellany: MethodTipMiscellany,
+ member this.CreateBackgroundRequest(line: int, col: int, info: TokenInfo, sourceText: string, snapshot: ITextSnapshot, methodTipMiscellany: MethodTipMiscellany_DEPRECATED,
fileName: string, reason: BackgroundRequestReason, view: IVsTextView,
sink: AuthoringSink, source: ISource, timestamp: int, synchronous: bool) =
let extraData =
@@ -82,7 +106,7 @@ type internal FSharpLanguageServiceBackgroundRequests
else
// This portion is executed on the UI thread.
let rdt = getServiceProvider().RunningDocumentTable
- let projectSite = getProjectSitesAndFiles().FindOwningProject(rdt,fileName)
+ let projectSite = getProjectSitesAndFiles().FindOwningProject_DEPRECATED(rdt,fileName)
let enableInMemoryCrossProjectReferences = true
let _, checkOptions = ProjectSitesAndFiles.GetProjectOptionsForProjectSite(enableInMemoryCrossProjectReferences, (fun _ -> None), projectSite, fileName, None, getServiceProvider(), false)
let projectFileName = projectSite.ProjectFileName()
@@ -94,12 +118,9 @@ type internal FSharpLanguageServiceBackgroundRequests
Colorizer = lazy getColorizer(view) }
Some (Lazy<_>.CreateFromValue data)
- new FSharpBackgroundRequest(line, col, info, sourceText, snapshot, methodTipMiscellany, fileName, reason, view, sink, source, timestamp, synchronous, extraData)
+ new FSharpBackgroundRequest_DEPRECATED(line, col, info, sourceText, snapshot, methodTipMiscellany, fileName, reason, view, sink, source, timestamp, synchronous, extraData)
- /// Handle an incoming request to analyze a file.
- ///
- /// Executed either on the UI thread (for req.IsSynchronous) or the background request thread.
- member this.ExecuteBackgroundRequest(req:FSharpBackgroundRequest, source:IFSharpSource) =
+ member this.ExecuteBackgroundRequest(req:FSharpBackgroundRequest_DEPRECATED, source:IFSharpSource_DEPRECATED) =
try
let data =
match req.ExtraData with
@@ -134,7 +155,7 @@ type internal FSharpLanguageServiceBackgroundRequests
| _ ->
let syncParseInfoOpt =
- if FSharpIntellisenseInfo.IsReasonRequiringSyncParse(req.Reason) then
+ if FSharpIntellisenseInfo_DEPRECATED.IsReasonRequiringSyncParse(req.Reason) then
let parseResults = interactiveChecker.ParseFileInProject(req.FileName,req.Text,checkOptions) |> Async.RunSynchronously
Some parseResults
else None
@@ -220,7 +241,7 @@ type internal FSharpLanguageServiceBackgroundRequests
let provideMethodList = (req.Reason = BackgroundRequestReason.MethodTip || req.Reason = BackgroundRequestReason.MatchBracesAndMethodTip)
- let scope = new FSharpIntellisenseInfo(parseResults, req.Line, req.Col, req.Snapshot, typedResults, projectSite, req.View, colorizer, getDocumentationBuilder(), provideMethodList)
+ let scope = new FSharpIntellisenseInfo_DEPRECATED(parseResults, req.Line, req.Col, req.Snapshot, typedResults, projectSite, req.View, colorizer, getDocumentationBuilder(), provideMethodList)
req.ResultIntellisenseInfo <- scope
req.ResultTimestamp <- resultTimestamp // This will be different from req.Timestamp when we're using stale results.
@@ -296,9 +317,9 @@ type internal FSharpLanguageServiceBackgroundRequests
// This is called on the UI thread after fresh full typecheck results are available
- member this.OnParseFileOrCheckFileComplete(req:BackgroundRequest) =
+ member this.OnParseFileOrCheckFileComplete(req:BackgroundRequest_DEPRECATED) =
match req.Source, req.ResultIntellisenseInfo, req.View with
- | (:? IFSharpSource as source), (:? FSharpIntellisenseInfo as scope), textView when textView <> null && not req.Source.IsClosed ->
+ | (:? IFSharpSource_DEPRECATED as source), (:? FSharpIntellisenseInfo_DEPRECATED as scope), textView when textView <> null && not req.Source.IsClosed ->
scope.OnParseFileOrCheckFileComplete(source)
diff --git a/vsintegration/src/FSharp.LanguageService/Colorize.fs b/vsintegration/src/FSharp.LanguageService/Colorize.fs
index c207636d204..254351dee46 100644
--- a/vsintegration/src/FSharp.LanguageService/Colorize.fs
+++ b/vsintegration/src/FSharp.LanguageService/Colorize.fs
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+//------- DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS ---------------
+
namespace Microsoft.VisualStudio.FSharp.LanguageService
open System.Collections.Generic
@@ -18,7 +20,15 @@ open Microsoft.FSharp.Compiler.SourceCodeServices
/// Maintain a two-way lookup of lexstate to colorstate
/// In practice this table will be quite small. All of F# only uses 38 distinct LexStates.
-module internal ColorStateLookup =
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+module internal ColorStateLookup_DEPRECATED =
type ColorStateTable() =
let mutable nextInt = 0
let toInt = Dictionary()
@@ -63,8 +73,16 @@ module internal ColorStateLookup =
//
// Notes:
// - SetLineText() is called one line at a time.
-// - An instance of FSharpScanner is associated with exactly one buffer (IVsTextLines).
-type internal FSharpScanner(makeLineTokenizer : string -> FSharpLineTokenizer) =
+// - An instance of FSharpScanner_DEPRECATED is associated with exactly one buffer (IVsTextLines).
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpScanner_DEPRECATED(makeLineTokenizer : string -> FSharpLineTokenizer) =
let mutable lineTokenizer = makeLineTokenizer ""
let mutable extraColorizations : IDictionary option = None
@@ -79,9 +97,9 @@ type internal FSharpScanner(makeLineTokenizer : string -> FSharpLineTokenizer) =
| FSharpTokenColorKind.Text -> TokenColor.Text
| FSharpTokenColorKind.UpperIdentifier -> TokenColor.Identifier
| FSharpTokenColorKind.Number -> TokenColor.Number
- | FSharpTokenColorKind.InactiveCode -> enum 6 // Custom index into colorable item array, 1-based index, see array of FSharpColorableItem in servicem.fs
- | FSharpTokenColorKind.PreprocessorKeyword -> enum 7 // Custom index into colorable item array, 1-based index, see array of FSharpColorableItem in servicem.fs
- | FSharpTokenColorKind.Operator -> enum 8 // Custom index into colorable item array, 1-based index, see array of FSharpColorableItem in servicem.fs
+ | FSharpTokenColorKind.InactiveCode -> enum 6 // Custom index into colorable item array, 1-based index, see array of FSharpColorableItem_DEPRECATED in servicem.fs
+ | FSharpTokenColorKind.PreprocessorKeyword -> enum 7 // Custom index into colorable item array, 1-based index, see array of FSharpColorableItem_DEPRECATED in servicem.fs
+ | FSharpTokenColorKind.Operator -> enum 8 // Custom index into colorable item array, 1-based index, see array of FSharpColorableItem_DEPRECATED in servicem.fs
| FSharpTokenColorKind.Default | _ -> TokenColor.Text
/// Decode compiler FSharpTokenColorKind into VS TokenType.
@@ -152,9 +170,18 @@ type internal FSharpScanner(makeLineTokenizer : string -> FSharpLineTokenizer) =
/// Implement the MPF Colorizer functionality.
/// onClose is a method to call when shutting down the colorizer.
-type internal FSharpColorizer(onClose:FSharpColorizer->unit,
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpColorizer_DEPRECATED
+ (onClose:FSharpColorizer_DEPRECATED->unit,
buffer:IVsTextLines,
- scanner:FSharpScanner) =
+ scanner:FSharpScanner_DEPRECATED) =
inherit Colorizer()
@@ -169,7 +196,7 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
/// Start state at the beginning of parsing a file.
override c.GetStartState(state) =
- state <- ColorStateLookup.ColorStateOfLexState(0L)
+ state <- ColorStateLookup_DEPRECATED.ColorStateOfLexState(0L)
VSConstants.S_OK
/// Colorize a line of text. Resulting per-character attributes are stored into attrs
@@ -178,13 +205,13 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
/// This is the core entry-point to all our colorization: VS calls this when it wants color information.
override c.ColorizeLine(line, _length, _ptrLineText, lastColorState, attrs) =
- let refState = ref (ColorStateLookup.LexStateOfColorState lastColorState)
+ let refState = ref (ColorStateLookup_DEPRECATED.LexStateOfColorState lastColorState)
let lineText = VsTextLines.LineText buffer line
let length = lineText.Length
let mutable linepos = 0
- //let newSnapshot = lazy (FSharpSourceBase.GetWpfTextViewFromVsTextView(scanner.TextView).TextSnapshot)
+ //let newSnapshot = lazy (FSharpSourceBase_DEPRECATED.GetWpfTextViewFromVsTextView(scanner.TextView).TextSnapshot)
try
scanner.SetLineText lineText
currentTokenInfo.EndIndex <- -1
@@ -218,14 +245,14 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
for i in linepos..(length-1) do
attrs.[i] <- uint32 TokenColor.Text
- ColorStateLookup.ColorStateOfLexState !refState
+ ColorStateLookup_DEPRECATED.ColorStateOfLexState !refState
///Get the state at the end of the given line.
override c.GetStateAtEndOfLine(line,length,ptr,state) = (c :> IVsColorizer).ColorizeLine(line, length, ptr, state, null)
member c.GetFullLineInfo(lineText,lastColorState) =
- let refState = ref (ColorStateLookup.LexStateOfColorState lastColorState)
+ let refState = ref (ColorStateLookup_DEPRECATED.LexStateOfColorState lastColorState)
scanner.SetLineText lineText
let rec tokens() =
seq { match scanner.ScanTokenWithDetails(refState) with
@@ -237,13 +264,13 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
[] // exceeds EndIndex
member private c.GetColorInfo(line,lineText,length,lastColorState) =
- let refState = ref (ColorStateLookup.LexStateOfColorState lastColorState)
+ let refState = ref (ColorStateLookup_DEPRECATED.LexStateOfColorState lastColorState)
scanner.SetLineText lineText
let cache = new ResizeArray()
let mutable tokenInfo = new TokenInfo(EndIndex = -1)
let mutable firstTime = true
- //let newSnapshot = lazy (FSharpSourceBase.GetWpfTextViewFromVsTextView(textView).TextSnapshot)
+ //let newSnapshot = lazy (FSharpSourceBase_DEPRECATED.GetWpfTextViewFromVsTextView(textView).TextSnapshot)
while scanner.ScanTokenAndProvideInfoAboutIt(line, tokenInfo, refState) do
if firstTime && tokenInfo.StartIndex > 1 then
cache.Add(new TokenInfo(0, tokenInfo.StartIndex - 1, TokenType.WhiteSpace))
@@ -257,7 +284,7 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
cache.Add (new TokenInfo(tokenInfo.EndIndex + 1, length - 1, TokenType.WhiteSpace))
cachedLineInfo <- cache.ToArray()
- ColorStateLookup.ColorStateOfLexState !refState
+ ColorStateLookup_DEPRECATED.ColorStateOfLexState !refState
/// Ultimately called by GetWordExtent in Source.cs in the C# code.
override c.GetLineInfo(buffer, line, colorState:IVsTextColorState) =
@@ -280,7 +307,7 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
/// Provide token information for the token at the given line and column
member c.GetTokenInfoAt(colorState,line,col) =
let state = VsTextColorState.GetColorStateAtStartOfLine colorState line
- let lexState = ref (ColorStateLookup.LexStateOfColorState state)
+ let lexState = ref (ColorStateLookup_DEPRECATED.LexStateOfColorState state)
let lineText = VsTextLines.LineText buffer line
let tokenInfo = new TokenInfo()
@@ -293,7 +320,7 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
/// Provide token information for the token at the given line and column (2nd variation - allows caller to get token info if an additional string were to be inserted)
member c.GetTokenInfoAt(colorState,line,col,trialString,trialStringInsertionCol) =
let state = VsTextColorState.GetColorStateAtStartOfLine colorState line
- let lexState = ref (ColorStateLookup.LexStateOfColorState state)
+ let lexState = ref (ColorStateLookup_DEPRECATED.LexStateOfColorState state)
let lineText = (VsTextLines.LineText buffer line).Insert(trialStringInsertionCol, trialString)
let tokenInfo = new TokenInfo()
@@ -306,7 +333,7 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
/// Provide token information for the token at the given line and column (3rd variation)
member c.GetTokenInformationAt(colorState,line,col) =
let state = VsTextColorState.GetColorStateAtStartOfLine colorState line
- let lexState = ref (ColorStateLookup.LexStateOfColorState state)
+ let lexState = ref (ColorStateLookup_DEPRECATED.LexStateOfColorState state)
let lineText = VsTextLines.LineText buffer line
scanner.SetLineText lineText
@@ -327,7 +354,15 @@ type internal FSharpColorizer(onClose:FSharpColorizer->unit,
/// Implements IVsColorableItem and IVsMergeableUIItem, for colored text items
-type internal FSharpColorableItem(canonicalName: string, displayName : Lazy, foreground, background) =
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpColorableItem_DEPRECATED(canonicalName: string, displayName : Lazy, foreground, background) =
interface IVsColorableItem with
diff --git a/vsintegration/src/FSharp.LanguageService/FSharpSource.fs b/vsintegration/src/FSharp.LanguageService/FSharpSource.fs
index 2faac7745bf..52955c9830d 100644
--- a/vsintegration/src/FSharp.LanguageService/FSharpSource.fs
+++ b/vsintegration/src/FSharp.LanguageService/FSharpSource.fs
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+//------- DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS ---------------
+
#nowarn "40"
namespace Microsoft.VisualStudio.FSharp.LanguageService
@@ -23,17 +25,29 @@ open Microsoft.FSharp.Compiler.SourceCodeServices
#nowarn "45" // This method will be made public in the underlying IL because it may implement an interface or override a method
-type internal IDependencyFileChangeNotify =
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal IDependencyFileChangeNotify_DEPRECATED =
- /// Invoked when a dependency file gets created or deleted
abstract DependencyFileCreated : IProjectSite -> unit
- /// Invoked when a dependency file changes
abstract DependencyFileChanged : string -> unit
-/// An interface implemented by both the unit-testable FSharpSourceTestable
-/// and the actual FSharpSource.
-type internal IFSharpSource =
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal IFSharpSource_DEPRECATED =
/// Request colorization of the whole source file
abstract RecolorizeWholeFile : unit -> unit
abstract RecolorizeLine : line:int -> unit
@@ -56,15 +70,21 @@ type internal IFSharpSource =
-/// The core implementation of IFSharpSource and IVsFileChangeEvents, delegating to the given
-/// functions to allow some unit testing. This implements IFSharpSource (used during unit-testing).
-type internal FSharpSourceTestable
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpSourceTestable_DEPRECATED
(recolorizeWholeFile:unit->unit,
recolorizeLine:int->unit,
currentFileName:unit -> string,
isClosed:unit->bool,
vsFileWatch:IVsFileChangeEx,
- depFileChange: IDependencyFileChangeNotify) =
+ depFileChange: IDependencyFileChangeNotify_DEPRECATED) =
let mutable projectSite : IProjectSite option = None
@@ -82,7 +102,7 @@ type internal FSharpSourceTestable
let IncrementWithWrap(v:int) =
if v = Int32.MaxValue then 0 else v + 1
- interface IFSharpSource with
+ interface IFSharpSource_DEPRECATED with
member source.RecolorizeWholeFile() = recolorizeWholeFile()
member source.RecolorizeLine line = recolorizeLine line
@@ -181,6 +201,14 @@ type internal FSharpSourceTestable
lastDependencies.Clear()
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
[]
type internal VSFontsAndColorsHelper private(fontFamily, pointSize, excludedCodeForegroundColorBrush, backgroundBrush) =
static let Compute(site:System.IServiceProvider) =
@@ -228,14 +256,22 @@ type internal VSFontsAndColorsHelper private(fontFamily, pointSize, excludedCode
}, &k) |> ignore
theInstance.Contents
-type internal FSharpIntelliSenseToAppearAdornment(view: IWpfTextView, cursorPoint: SnapshotPoint, site: System.IServiceProvider) as this =
+//
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpIntelliSenseToAppearAdornment_DEPRECATED(view: IWpfTextView, cursorPoint: SnapshotPoint, site: System.IServiceProvider) as this =
let fontFamily, pointSize, excludedCodeForegroundColorBrush, backgroundBrush = VSFontsAndColorsHelper.GetContents(site)
// TODO: We should really create our own adornment layer. It is possible (unlikely) that pre-existing layers may be re-ordered, or that
// code 'owning' the layer will choose to clear all adornments, for example. But creating a new adornment layer can only be done via MEF-export, and
// as of yet, we have not done any MEF-exporting in the language service. So for now, use the existing VisibleWhitespace layer, and incur some risk, just to
// unblock the feature.
let layer = view.GetAdornmentLayer("VisibleWhitespace")
- let tag = "FSharpIntelliSenseToAppearAdornment"
+ let tag = "FSharpIntelliSenseToAppearAdornment_DEPRECATED"
let pointSize = float pointSize * 96.0 / 72.0 // need to convert from pt to px
do
// draw it now
@@ -278,9 +314,9 @@ type internal FSharpIntelliSenseToAppearAdornment(view: IWpfTextView, cursorPoin
member this.RemoveSelf() =
layer.RemoveAdornmentsByTag(tag)
-/// Implements ISource, IVsTextLinesEvents, IVsHiddenTextClient, IVsUserDataEvents etc. via FSharpSourceBase by filling in the remaining functionality
-type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFileWatch:IVsFileChangeEx, depFileChange: IDependencyFileChangeNotify, getInteractiveChecker) as source =
- inherit FSharpSourceBase(service, textLines, colorizer)
+/// Implements ISource, IVsTextLinesEvents, IVsHiddenTextClient, IVsUserDataEvents etc. via FSharpSourceBase_DEPRECATED by filling in the remaining functionality
+type internal FSharpSource_DEPRECATED(service:LanguageService_DEPRECATED, textLines, colorizer, vsFileWatch:IVsFileChangeEx, depFileChange: IDependencyFileChangeNotify_DEPRECATED, getInteractiveChecker) as source =
+ inherit FSharpSourceBase_DEPRECATED(service, textLines, colorizer)
let mutable lastCommentSpan = new TextSpan()
let mutable vsFileWatch = vsFileWatch
@@ -296,7 +332,7 @@ type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFile
if source.ColorState<>null && textLines<>null && line >= 0 && line < source.GetLineCount() then // textlines is used by GetLineCount()
source.ColorState.ReColorizeLines(line, line) |> ignore
- let iSource = new FSharpSourceTestable(recolorizeWholeFile,recolorizeLine,(fun () -> VsTextLines.GetFilename textLines),(fun () -> source.IsClosed),vsFileWatch, depFileChange) :> IFSharpSource
+ let iSource = new FSharpSourceTestable_DEPRECATED(recolorizeWholeFile,recolorizeLine,(fun () -> VsTextLines.GetFilename textLines),(fun () -> source.IsClosed),vsFileWatch, depFileChange) :> IFSharpSource_DEPRECATED
override source.NormalizeErrorString(message) = ErrorLogger.NormalizeErrorString message
override source.NewlineifyErrorString(message) = ErrorLogger.NewlineifyErrorString message
@@ -359,18 +395,18 @@ type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFile
| _ -> base.GetTaskReporter()
| _ -> base.GetTaskReporter()
- member val FSharpIntelliSenseToAppearAdornment : FSharpIntelliSenseToAppearAdornment option = None with get, set
+ member val FSharpIntelliSenseToAppearAdornment_DEPRECATED : FSharpIntelliSenseToAppearAdornment_DEPRECATED option = None with get, set
member val CancellationTokenSource : CancellationTokenSource = null with get, set
member source.ResetFSharpIntelliSenseToAppearAdornment() =
UIThread.MustBeCalledFromUIThread()
if source.CancellationTokenSource <> null && not source.CancellationTokenSource.IsCancellationRequested then
source.CancellationTokenSource.Cancel()
- match source.FSharpIntelliSenseToAppearAdornment with
+ match source.FSharpIntelliSenseToAppearAdornment_DEPRECATED with
| None -> ()
| Some a ->
a.RemoveSelf()
- source.FSharpIntelliSenseToAppearAdornment <- None
+ source.FSharpIntelliSenseToAppearAdornment_DEPRECATED <- None
member source.AttachFSharpIntelliSenseToAppearAdornment(wpfTextView, cursorPoint, completionWasExplicitlyRequested) =
UIThread.MustBeCalledFromUIThread()
@@ -386,15 +422,15 @@ type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFile
async {
do! Async.Sleep(timeUntilPopup)
UIThread.MustBeCalledFromUIThread()
- if source.FSharpIntelliSenseToAppearAdornment.IsNone then
- source.FSharpIntelliSenseToAppearAdornment <- Some <| new FSharpIntelliSenseToAppearAdornment(wpfTextView, cursorPoint, service.Site)
+ if source.FSharpIntelliSenseToAppearAdornment_DEPRECATED.IsNone then
+ source.FSharpIntelliSenseToAppearAdornment_DEPRECATED <- Some <| new FSharpIntelliSenseToAppearAdornment_DEPRECATED(wpfTextView, cursorPoint, service.Site)
// reset if they move cursor, (ideally would only reset if moved out of 'applicative span', but for now, any movement cancels)
let rec caretSubscription : IDisposable = wpfTextView.Caret.PositionChanged.Subscribe(fun _ea -> source.ResetFSharpIntelliSenseToAppearAdornment(); caretSubscription.Dispose())
// if the user types new chars right before the caret, the editor does not fire a Caret.PositionChanged event, but LayoutChanged will fire, so also hook that
let rec layoutSubscription : IDisposable = wpfTextView.LayoutChanged.Subscribe(fun _ea -> source.ResetFSharpIntelliSenseToAppearAdornment(); layoutSubscription.Dispose())
()
else
- Debug.Assert(false, "why was FSharpIntelliSenseToAppearAdornment already set?")
+ Debug.Assert(false, "why was FSharpIntelliSenseToAppearAdornment_DEPRECATED already set?")
}
Async.StartImmediate(Async.TryCancelled(cancelableTask, ignore), source.CancellationTokenSource.Token)
@@ -408,7 +444,7 @@ type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFile
NativeMethods.ThrowOnFailure(textView.GetCaretPos(line, idx)) |> ignore
if requireFreshResults <> RequireFreshResults.Yes then
// if it was Yes, then we are in second-chance intellisense and we already started the task for the first-chance
- let wpfTextView = FSharpSourceBase.GetWpfTextViewFromVsTextView(textView)
+ let wpfTextView = FSharpSourceBase_DEPRECATED.GetWpfTextViewFromVsTextView(textView)
let ss = wpfTextView.TextSnapshot
let tsLine = ss.GetLineFromLineNumber(!line)
let lineLen = tsLine.End.Position - tsLine.Start.Position
@@ -541,8 +577,8 @@ type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFile
fileName <- newfileName
iSource.RecolorizeWholeFile()
- // Just forward to IFSharpSource
- interface IFSharpSource with
+ // Just forward to IFSharpSource_DEPRECATED
+ interface IFSharpSource_DEPRECATED with
member source.RecolorizeWholeFile() = iSource.RecolorizeWholeFile()
member source.RecolorizeLine line = iSource.RecolorizeLine line
member source.RecordChangeToView() = iSource.RecordChangeToView()
@@ -555,16 +591,16 @@ type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFile
member source.SetDependencyFiles(files) = iSource.SetDependencyFiles(files)
/// Hook file change events. It's not clear that this implementation is ever utilized, since
- /// the implementation on FSharpSourceTestable is used instead.
+ /// the implementation on FSharpSourceTestable_DEPRECATED is used instead.
interface IVsFileChangeEvents with
member changes.FilesChanged(_count : uint32, _files: string [], _changeFlags : uint32 []) = 0
member changes.DirectoryChanged(_directory: string) = 0
module internal Source =
/// This is the ideal implementation of the Source concept abstracted from MLS.
- let CreateSourceTestable (recolorizeWholeFile, recolorizeLine, filename, isClosed, vsFileWatch, depFileChangeNotify) =
- new FSharpSourceTestable(recolorizeWholeFile, recolorizeLine, filename, isClosed, vsFileWatch, depFileChangeNotify) :> IFSharpSource
+ let CreateSourceTestable_DEPRECATED (recolorizeWholeFile, recolorizeLine, filename, isClosed, vsFileWatch, depFileChangeNotify) =
+ new FSharpSourceTestable_DEPRECATED(recolorizeWholeFile, recolorizeLine, filename, isClosed, vsFileWatch, depFileChangeNotify) :> IFSharpSource_DEPRECATED
- let CreateSource(service, textLines, colorizer, vsFileWatch, depFileChangeNotify, getInteractiveChecker) =
- new FSharpSource(service, textLines, colorizer, vsFileWatch, depFileChangeNotify, getInteractiveChecker) :> IFSharpSource
+ let CreateSource_DEPRECATED(service, textLines, colorizer, vsFileWatch, depFileChangeNotify, getInteractiveChecker) =
+ new FSharpSource_DEPRECATED(service, textLines, colorizer, vsFileWatch, depFileChangeNotify, getInteractiveChecker) :> IFSharpSource_DEPRECATED
diff --git a/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs b/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs
index 9b58e936173..de08d212ab2 100644
--- a/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs
+++ b/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+//------- DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS ---------------
+
namespace Microsoft.VisualStudio.FSharp.LanguageService
open System
@@ -16,7 +18,7 @@ open Microsoft.FSharp.Compiler.SourceCodeServices
module internal OperatorToken =
- let asIdentifier (token : TokenInfo) =
+ let asIdentifier_DEPRECATED (token : TokenInfo) =
// Typechecker reports information about all values in the same fashion no matter whether it is named value (let binding) or operator
// here we piggyback on this fact and just pretend that we need data time for identifier
let tagOfIdentToken = Microsoft.FSharp.Compiler.Parser.tagOfToken(Microsoft.FSharp.Compiler.Parser.IDENT "")
@@ -25,7 +27,15 @@ module internal OperatorToken =
module internal GotoDefinition =
- let GotoDefinition (colourizer: FSharpColorizer, typedResults : FSharpCheckFileResults, textView : IVsTextView, line : int, col : int) : GotoDefinitionResult =
+ //
+ // Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+ //
+ // Note: Tests using this code should either be adjusted to test the corresponding feature in
+ // FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+ // functionality and thus have considerable value, they should ony be deleted if we are sure this
+ // is not the case.
+ //
+ let GotoDefinition_DEPRECATED (colourizer: FSharpColorizer_DEPRECATED, typedResults : FSharpCheckFileResults, textView : IVsTextView, line : int, col : int) : GotoDefinitionResult_DEPRECATED =
let ls = textView.GetBuffer() |> Com.ThrowOnFailure1
let len = ls.GetLengthOfLine line |> Com.ThrowOnFailure1
@@ -37,7 +47,7 @@ module internal GotoDefinition =
let token = colourizer.GetTokenInfoAt(VsTextLines.TextColorState(VsTextView.Buffer textView), line, col)
let identInfo, makeAnotherAttempt =
if token.Type = TokenType.Operator && not alwaysTreatTokenAsIdentifier then
- let tag, _, endCol = OperatorToken.asIdentifier token
+ let tag, _, endCol = OperatorToken.asIdentifier_DEPRECATED token
Some(endCol, tag, [""]), true
else
match QuickParse.GetCompleteIdentifierIsland true lineStr col with
@@ -56,17 +66,17 @@ module internal GotoDefinition =
match identInfo with
| None ->
Strings.Errors.GotoDefinitionFailed_NotIdentifier ()
- |> GotoDefinitionResult.MakeError
+ |> GotoDefinitionResult_DEPRECATED.MakeError
| Some(colIdent, tag, qualId) ->
if typedResults.HasFullTypeCheckInfo then
if Parser.tokenTagToTokenId tag <> Parser.TOKEN_IDENT then
Strings.Errors.GotoDefinitionFailed_NotIdentifier ()
- |> GotoDefinitionResult.MakeError
+ |> GotoDefinitionResult_DEPRECATED.MakeError
else
match typedResults.GetDeclarationLocation (line+1, colIdent, lineStr, qualId, false) |> Async.RunSynchronously with
| FSharpFindDeclResult.DeclFound m ->
let span = TextSpan (iStartLine = m.StartLine-1, iEndLine = m.StartLine-1, iStartIndex = m.StartColumn, iEndIndex = m.StartColumn)
- GotoDefinitionResult.MakeSuccess(m.FileName, span)
+ GotoDefinitionResult_DEPRECATED.MakeSuccess(m.FileName, span)
| FSharpFindDeclResult.DeclNotFound(reason) ->
if makeAnotherAttempt then gotoDefinition true
else
@@ -77,10 +87,10 @@ module internal GotoDefinition =
| FSharpFindDeclFailureReason.NoSourceCode -> Strings.Errors.GotoDefinitionFailed_NoSourceCode()
| FSharpFindDeclFailureReason.ProvidedType(typeName) -> Strings.Errors.GotoDefinitionFailed_ProvidedType(typeName)
| FSharpFindDeclFailureReason.ProvidedMember(name) -> Strings.Errors.GotoFailed_ProvidedMember(name)
- GotoDefinitionResult.MakeError text
+ GotoDefinitionResult_DEPRECATED.MakeError text
else
Trace.Write("LanguageService", "Goto definition: No 'TypeCheckInfo' available")
Strings.Errors.GotoDefinitionFailed_NoTypecheckInfo()
- |> GotoDefinitionResult.MakeError
+ |> GotoDefinitionResult_DEPRECATED.MakeError
gotoDefinition false
diff --git a/vsintegration/src/FSharp.LanguageService/Intellisense.fs b/vsintegration/src/FSharp.LanguageService/Intellisense.fs
index d2f28dd98d9..d54b2e64d1d 100644
--- a/vsintegration/src/FSharp.LanguageService/Intellisense.fs
+++ b/vsintegration/src/FSharp.LanguageService/Intellisense.fs
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+//------- DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS ---------------
+
namespace Microsoft.VisualStudio.FSharp.LanguageService
open System
@@ -17,16 +19,15 @@ open Microsoft.FSharp.Compiler.SourceCodeServices
module internal TaggedText =
let appendTo (sb: System.Text.StringBuilder) (t: Layout.TaggedText) = sb.Append t.Text |> ignore
-/// Represents all the information necessary to display and navigate
-/// within a method tip (e.g. param info, overloads, ability to move thru overloads and params)
-///
-/// Completes the base class "MethodListForAMethodTip" with F#-specific implementations.
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
//
-// Note, the MethodListForAMethodTip type inherited by this code is defined in the F# Project System C# code. This is the only implementation
-// in the codebase, hence we are free to change it and refactor things (e.g. bring more things into F# code)
-// if we wish.
-type internal FSharpMethodListForAMethodTip(documentationBuilder: IDocumentationBuilder, methodsName, methods: FSharpMethodGroupItem[], nwpl: FSharpNoteworthyParamInfoLocations, snapshot: ITextSnapshot, isThisAStaticArgumentsTip: bool) =
- inherit MethodListForAMethodTip()
+type internal FSharpMethodListForAMethodTip_DEPRECATED(documentationBuilder: IDocumentationBuilder_DEPRECATED, methodsName, methods: FSharpMethodGroupItem[], nwpl: FSharpNoteworthyParamInfoLocations, snapshot: ITextSnapshot, isThisAStaticArgumentsTip: bool) =
+ inherit MethodListForAMethodTip_DEPRECATED()
// Compute the tuple end points
let tupleEnds =
@@ -67,7 +68,7 @@ type internal FSharpMethodListForAMethodTip(documentationBuilder: IDocumentation
override x.GetDescription(methodIndex) = safe methodIndex "" (fun m ->
let buf = Text.StringBuilder()
- XmlDocumentation.BuildMethodOverloadTipText(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, m.StructuredDescription, true)
+ XmlDocumentation.BuildMethodOverloadTipText_DEPRECATED(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, m.StructuredDescription, true)
buf.ToString()
)
@@ -106,14 +107,16 @@ type internal ObsoleteGlyph =
| Record = 126
| DiscriminatedUnion = 132
-/// A collections of declarations as would be returned by a dot-completion request.
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
//
-// Note, the Declarations type inherited by this code is defined in the F# Project System C# code. This is the only implementation
-// in the codebase, hence we are free to change it and refactor things (e.g. bring more things into F# code)
-// if we wish.
-type internal FSharpDeclarations(documentationBuilder, declarations: FSharpDeclarationListItem[], reason: BackgroundRequestReason) =
+type internal FSharpDeclarations_DEPRECATED(documentationBuilder, declarations: FSharpDeclarationListItem[], reason: BackgroundRequestReason) =
- inherit Declarations()
+ inherit Declarations_DEPRECATED()
// Sort the declarations, NOTE: we used ORDINAL comparison here, this is "by design" from F# 2.0, partly because it puts lowercase last.
let declarations = declarations |> Array.sortWith (fun d1 d2 -> compare d1.Name d2.Name)
@@ -178,7 +181,7 @@ type internal FSharpDeclarations(documentationBuilder, declarations: FSharpDecla
let decls = trimmedDeclarations filterText
if (index >= 0 && index < decls.Length) then
let buf = Text.StringBuilder()
- XmlDocumentation.BuildDataTipText(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, decls.[index].StructuredDescriptionText)
+ XmlDocumentation.BuildDataTipText_DEPRECATED(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, decls.[index].StructuredDescriptionText)
buf.ToString()
else ""
@@ -279,11 +282,14 @@ type internal FSharpDeclarations(documentationBuilder, declarations: FSharpDecla
-/// Implements the remainder of the IntellisenseInfo base type from MPF.
-///
-/// The scope object is the result of computing a particular typecheck. It may be queried for things like
-/// data tip text, member completion and so forth.
-type internal FSharpIntellisenseInfo
+// Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+//
+// Note: Tests using this code should either be adjusted to test the corresponding feature in
+// FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+// functionality and thus have considerable value, they should ony be deleted if we are sure this
+// is not the case.
+//
+type internal FSharpIntellisenseInfo_DEPRECATED
(/// The recent result of parsing
untypedResults: FSharpParseFileResults,
/// Line/column/snapshot of BackgroundRequest that initiated creation of this scope
@@ -295,12 +301,12 @@ type internal FSharpIntellisenseInfo
/// The text view
view: IVsTextView,
/// The colorizer for this view (though why do we need to be lazy about creating this?)
- colorizer: Lazy,
+ colorizer: Lazy,
/// A service that will provide Xml Content
- documentationBuilder : IDocumentationBuilder,
+ documentationBuilder : IDocumentationBuilder_DEPRECATED,
provideMethodList : bool
) =
- inherit IntellisenseInfo()
+ inherit IntellisenseInfo_DEPRECATED()
let methodList =
if provideMethodList then
@@ -356,7 +362,7 @@ type internal FSharpIntellisenseInfo
(not isThisAStaticArgumentsTip && m.HasParameters) then // need to distinguish TP<...>(...) angle brackets tip from parens tip
yield m |]
if filteredMethods.Length <> 0 then
- Some (FSharpMethodListForAMethodTip(documentationBuilder, methods.MethodName, filteredMethods, nwpl, brSnapshot, isThisAStaticArgumentsTip) :> MethodListForAMethodTip)
+ Some (FSharpMethodListForAMethodTip_DEPRECATED(documentationBuilder, methods.MethodName, filteredMethods, nwpl, brSnapshot, isThisAStaticArgumentsTip) :> MethodListForAMethodTip_DEPRECATED)
else
None
| _ ->
@@ -421,7 +427,7 @@ type internal FSharpIntellisenseInfo
// Try the actual column first...
let tokenTag, col, possibleIdentifier, makeSecondAttempt =
if token.Type = TokenType.Operator && not alwaysTreatTokenAsIdentifier then
- let tag, startCol, endCol = OperatorToken.asIdentifier token
+ let tag, startCol, endCol = OperatorToken.asIdentifier_DEPRECATED token
let op = lineText.Substring(startCol, endCol - startCol)
tag, startCol, Some(op, endCol, false), true
else
@@ -451,7 +457,7 @@ type internal FSharpIntellisenseInfo
| FSharpStructuredToolTipText.FSharpToolTipText [] when makeSecondAttempt -> getDataTip true
| _ ->
let buf = Text.StringBuilder()
- XmlDocumentation.BuildDataTipText(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, dataTip)
+ XmlDocumentation.BuildDataTipText_DEPRECATED(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, dataTip)
// The data tip is located w.r.t. the start of the last identifier
let sizeFixup = if isQuotedIdentifier then 4 else 0
@@ -481,7 +487,7 @@ type internal FSharpIntellisenseInfo
/// Implements the corresponding abstract member from IntellisenseInfo in MPF.
override scope.GetDeclarations(textSnapshot, line, col, reason) =
- assert(FSharpIntellisenseInfo.IsReasonRequiringSyncParse(reason))
+ assert(FSharpIntellisenseInfo_DEPRECATED.IsReasonRequiringSyncParse(reason))
async {
try
let isInCommentOrString =
@@ -528,7 +534,7 @@ type internal FSharpIntellisenseInfo
hasTextChangedSinceLastTypecheck (textSnapshot, oldTextSnapshot, Range.Range.toZ range)
let! decls = typedResults.GetDeclarationListInfo(untypedParseInfoOpt, Range.Line.fromZ line, col, lineText, fst plid, snd plid, (fun() -> []), detectTextChange)
- return (new FSharpDeclarations(documentationBuilder, decls.Items, reason) :> Declarations)
+ return (new FSharpDeclarations_DEPRECATED(documentationBuilder, decls.Items, reason) :> Declarations_DEPRECATED)
else
// no TypeCheckInfo in ParseResult.
return null
@@ -608,13 +614,13 @@ type internal FSharpIntellisenseInfo
// for tests
member this.GotoDefinition (textView, line, column) =
- GotoDefinition.GotoDefinition (colorizer.Value, typedResults, textView, line, column)
+ GotoDefinition.GotoDefinition_DEPRECATED (colorizer.Value, typedResults, textView, line, column)
override this.Goto (textView, line, column) =
- GotoDefinition.GotoDefinition (colorizer.Value, typedResults, textView, line, column)
+ GotoDefinition.GotoDefinition_DEPRECATED (colorizer.Value, typedResults, textView, line, column)
// This is called on the UI thread after fresh full typecheck results are available
- member this.OnParseFileOrCheckFileComplete(source: IFSharpSource) =
+ member this.OnParseFileOrCheckFileComplete(source: IFSharpSource_DEPRECATED) =
for line in colorizer.Value.SetExtraColorizations(typedResults.GetSemanticClassification None) do
source.RecolorizeLine line
diff --git a/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs b/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs
index 8b9c8ad77d8..fa0ed57ddf5 100644
--- a/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs
+++ b/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs
@@ -1,6 +1,35 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-(* Project handling. *)
+// Project information handling.
+//
+// For the old F# project system, in a running Visual Studio, the **authoritative** view
+// of the project information is maintained by Project.fs in FSharp.ProjectSystem. This
+// information is conveyed to the rest of the implementation via an IProjectSite interface.
+//
+// For most purposes, an IProjectSite has to provide three main things
+// - the source files
+// - the compilation options
+// - the assembly references.
+// Project.fs collects the first two from MSBuild. For the third - assembly references - it looks
+// through the nodes of the hierarchy for the F# project. There seems to be an essentially duplicated
+// version of this code in this file.
+//
+// In our LanguageService.fs, FSharpProjectOptionsManager uses this IProjectSite information to incrementally maintain
+// a corresponding F# CompilerService FSharpProjectOptions value.
+//
+// In our LanguageService.fs, we also use this IProjectSite information to maintain a
+// corresponding Roslyn project in the workspace. This is done by SetupProjectFile and SyncProject
+// making various calls to add/remove methods such as
+// projectContext.AddSourceFile
+// projectContext.RemoveSourceFile
+// projectContext.AddMetadataReference
+// projectContext.RemoveMetadataReference
+// project.AddProjectReference
+//
+// The new F# project system supplies the project information using a Roslyn project in the workspace.
+// This means a lot of the stuff above is irrelevant in that case, apart from where FSharpProjectOptionsManager
+// incrementally maintains a corresponding F# CompilerService FSharpProjectOptions value.
+
namespace Microsoft.VisualStudio.FSharp.LanguageService
open System
@@ -73,7 +102,7 @@ type private ProjectSiteOfSingleFile(sourceFile) =
override this.AssemblyReferences() = [||]
/// Information about projects, open files and other active artifacts in visual studio.
-/// Keeps track of the relationship between IVsTextLines buffers, IFSharpSource objects, IProjectSite objects and FSharpProjectOptions
+/// Keeps track of the relationship between IVsTextLines buffers, IFSharpSource_DEPRECATED objects, IProjectSite objects and FSharpProjectOptions
[]
type internal ProjectSitesAndFiles() =
static let sourceUserDataGuid = new Guid("{55F834FD-B950-4C61-BBAA-0511ABAF4AE2}") // Guid for source user data on text buffer
@@ -165,16 +194,40 @@ type internal ProjectSitesAndFiles() =
new ProjectSiteOfSingleFile(filename) :> IProjectSite
- member art.SetSource(buffer:IVsTextLines, source:IFSharpSource) : unit =
+
+ static member GetReferencedProjectSites(projectSite:IProjectSite, serviceProvider:System.IServiceProvider) =
+ referencedProvideProjectSites (projectSite, serviceProvider)
+ |> Seq.map (fun (_, ps) -> ps.GetProjectSite())
+ |> Seq.toArray
+
+ /// Create project options for this project site.
+ static member GetProjectOptionsForProjectSite(enableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, projectSite:IProjectSite,filename,extraProjectInfo,serviceProvider:System.IServiceProvider, useUniqueStamp) =
+ match projectSite with
+ | :? IHaveCheckOptions as hco -> hco.OriginalCheckOptions()
+ | _ ->
+ getProjectOptionsForProjectSite(enableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, projectSite, filename, extraProjectInfo, serviceProvider, useUniqueStamp)
+
+ /// Create project site for these project options
+ static member CreateProjectSiteForScript (filename, referencedProjectFileNames, checkOptions) =
+ ProjectSiteOfScriptFile (filename, referencedProjectFileNames, checkOptions) :> IProjectSite
+
+
+
+ //
+ // Note: DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS.
+ //
+ // Note: Tests using this code should either be adjusted to test the corresponding feature in
+ // FSharp.Editor, or deleted. However, the tests may be exercising underlying F# Compiler
+ // functionality and thus have considerable value, they should ony be deleted if we are sure this
+ // is not the case.
+ //
+
+ member art.SetSource_DEPRECATED(buffer:IVsTextLines, source:IFSharpSource_DEPRECATED) : unit =
let mutable guid = sourceUserDataGuid
(buffer :?> IVsUserData).SetData(&guid, source) |> ErrorHandler.ThrowOnFailure |> ignore
- member art.UnsetSource(buffer:IVsTextLines) : unit =
- let mutable guid = sourceUserDataGuid
- (buffer :?> IVsUserData).SetData(&guid, null) |> ErrorHandler.ThrowOnFailure |> ignore
-
- /// Given a filename get the corresponding Source
- member art.TryGetSourceOfFile(rdt:IVsRunningDocumentTable, filename:string) : IFSharpSource option =
+
+ member art.TryGetSourceOfFile_DEPRECATED(rdt:IVsRunningDocumentTable, filename:string) : IFSharpSource_DEPRECATED option =
match VsRunningDocumentTable.FindDocumentWithoutLocking(rdt,filename) with
| Some(_hier, textLines) ->
match textLines with
@@ -185,12 +238,12 @@ type internal ProjectSitesAndFiles() =
(textLines :?> IVsUserData).GetData(&guid, &result) |> ignore
match result with
| null -> None
- | source -> Some(source :?> IFSharpSource)
+ | source -> Some(source :?> IFSharpSource_DEPRECATED)
| None -> None
- /// Get the list of Defines for a given buffer
- member art.GetDefinesForFile(rdt:IVsRunningDocumentTable, filename : string) =
+
+ member art.GetDefinesForFile_DEPRECATED(rdt:IVsRunningDocumentTable, filename : string) =
// The only caller of this function calls it each time it needs to colorize a line, so this call must execute very fast.
if SourceFile.MustBeSingleFileProject(filename) then
CompilerEnvironment.GetCompilationDefinesForEditing(filename,[])
@@ -207,7 +260,8 @@ type internal ProjectSitesAndFiles() =
CompilerEnvironment.GetCompilationDefinesForEditing(filename,site.CompilerFlags() |> Array.toList)
- member art.TryFindOwningProject(rdt:IVsRunningDocumentTable, filename) =
+
+ member art.TryFindOwningProject_DEPRECATED(rdt:IVsRunningDocumentTable, filename) =
if SourceFile.MustBeSingleFileProject(filename) then None
else
match VsRunningDocumentTable.FindDocumentWithoutLocking(rdt,filename) with
@@ -225,28 +279,8 @@ type internal ProjectSitesAndFiles() =
| None -> None
| None -> None
- /// Find the project that "owns" this filename. That is,
- /// - if the file is associated with an F# IVsHierarchy in the RDT, and
- /// - the .fsproj has this file in its list of items,
- /// then the project is considered the 'owner'. Otherwise a 'single file project' is returned.
- member art.FindOwningProject(rdt:IVsRunningDocumentTable, filename) =
- match art.TryFindOwningProject(rdt, filename) with
+
+ member art.FindOwningProject_DEPRECATED(rdt:IVsRunningDocumentTable, filename) =
+ match art.TryFindOwningProject_DEPRECATED(rdt, filename) with
| Some site -> site
| None -> ProjectSitesAndFiles.ProjectSiteOfSingleFile(filename)
-
- static member GetReferencedProjectSites(projectSite:IProjectSite, serviceProvider:System.IServiceProvider) =
- referencedProvideProjectSites (projectSite, serviceProvider)
- |> Seq.map (fun (_, ps) -> ps.GetProjectSite())
- |> Seq.toArray
-
- /// Create project options for this project site.
- static member GetProjectOptionsForProjectSite(enableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, projectSite:IProjectSite,filename,extraProjectInfo,serviceProvider:System.IServiceProvider, useUniqueStamp) =
- match projectSite with
- | :? IHaveCheckOptions as hco -> hco.OriginalCheckOptions()
- | _ ->
- getProjectOptionsForProjectSite(enableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, projectSite, filename, extraProjectInfo, serviceProvider, useUniqueStamp)
-
- /// Create project site for these project options
- static member CreateProjectSiteForScript (filename, referencedProjectFileNames, checkOptions) =
- ProjectSiteOfScriptFile (filename, referencedProjectFileNames, checkOptions) :> IProjectSite
-
diff --git a/vsintegration/src/FSharp.LanguageService/SourceFile.fs b/vsintegration/src/FSharp.LanguageService/SourceFile.fs
index 81220c3fc5b..5eb0adb9399 100644
--- a/vsintegration/src/FSharp.LanguageService/SourceFile.fs
+++ b/vsintegration/src/FSharp.LanguageService/SourceFile.fs
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+//------- DEPRECATED CODE ONLY ACTIVE IN UNIT TESTING VIA "UNROSLYNIZED" UNIT TESTS ---------------
+
namespace Microsoft.FSharp.Compiler.VsLanguageService
open System
open System.IO
diff --git a/vsintegration/src/FSharp.LanguageService/XmlDocumentation.fs b/vsintegration/src/FSharp.LanguageService/XmlDocumentation.fs
index c40b07a90cc..98b53f1ad32 100644
--- a/vsintegration/src/FSharp.LanguageService/XmlDocumentation.fs
+++ b/vsintegration/src/FSharp.LanguageService/XmlDocumentation.fs
@@ -6,24 +6,18 @@
namespace Microsoft.VisualStudio.FSharp.LanguageService
open System
-open System.Text
-open System.Collections.Generic
open System.Text.RegularExpressions
-open Internal.Utilities.Collections
-open EnvDTE
-open EnvDTE80
-open Microsoft.VisualStudio.Shell.Interop
open Microsoft.FSharp.Compiler.SourceCodeServices
open Microsoft.FSharp.Compiler.Layout
open Microsoft.FSharp.Compiler.Layout.TaggedTextOps
-type internal ITaggedTextCollector =
+type internal ITaggedTextCollector_DEPRECATED =
abstract Add: text: TaggedText -> unit
abstract EndsWithLineBreak: bool
abstract IsEmpty: bool
abstract StartXMLDoc: unit -> unit
-type internal TextSanitizingCollector(collector, ?lineLimit: int) =
+type internal TextSanitizingCollector_DEPRECATED(collector, ?lineLimit: int) =
let mutable isEmpty = true
let mutable endsWithLineBreak = false
let mutable count = 0
@@ -65,7 +59,7 @@ type internal TextSanitizingCollector(collector, ?lineLimit: int) =
addTaggedTextEntry Literals.lineBreak
addTaggedTextEntry Literals.lineBreak)
- interface ITaggedTextCollector with
+ interface ITaggedTextCollector_DEPRECATED with
member this.Add taggedText =
// TODO: bail out early if line limit is already hit
match taggedText.Tag with
@@ -78,13 +72,13 @@ type internal TextSanitizingCollector(collector, ?lineLimit: int) =
/// XmlDocumentation builder, using the VS interfaces to build documentation. An interface is used
/// to allow unit testing to give an alternative implementation which captures the documentation.
-type internal IDocumentationBuilder =
+type internal IDocumentationBuilder_DEPRECATED =
/// Append the given raw XML formatted into the string builder
- abstract AppendDocumentationFromProcessedXML : collector: ITaggedTextCollector * processedXml:string * showExceptions:bool * showParameters:bool * paramName:string option-> unit
+ abstract AppendDocumentationFromProcessedXML : collector: ITaggedTextCollector_DEPRECATED * processedXml:string * showExceptions:bool * showParameters:bool * paramName:string option-> unit
/// Appends text for the given filename and signature into the StringBuilder
- abstract AppendDocumentation : collector: ITaggedTextCollector * filename: string * signature: string * showExceptions: bool * showParameters: bool * paramName: string option-> unit
+ abstract AppendDocumentation : collector: ITaggedTextCollector_DEPRECATED * filename: string * signature: string * showExceptions: bool * showParameters: bool * paramName: string option-> unit
/// Documentation helpers.
module internal XmlDocumentation =
@@ -104,204 +98,20 @@ module internal XmlDocumentation =
"" + xml + ""
else xml
- let AppendHardLine(collector: ITaggedTextCollector) =
+ let AppendHardLine(collector: ITaggedTextCollector_DEPRECATED) =
collector.Add Literals.lineBreak
- let EnsureHardLine(collector: ITaggedTextCollector) =
+ let EnsureHardLine(collector: ITaggedTextCollector_DEPRECATED) =
if not collector.EndsWithLineBreak then AppendHardLine collector
- let AppendOnNewLine (collector: ITaggedTextCollector) (line:string) =
+ let AppendOnNewLine (collector: ITaggedTextCollector_DEPRECATED) (line:string) =
if line.Length > 0 then
EnsureHardLine collector
collector.Add(TaggedTextOps.tagText line)
- open System.Xml
- open System.Xml.Linq
-
- let rec private WriteElement (collector: ITaggedTextCollector) (n: XNode) =
- match n.NodeType with
- | XmlNodeType.Text ->
- WriteText collector (n :?> XText)
- | XmlNodeType.Element ->
- let el = n :?> XElement
- match el.Name.LocalName with
- | "see" | "seealso" ->
- for attr in el.Attributes() do
- WriteAttribute collector attr "cref" (WriteTypeName collector)
- | "paramref" | "typeref" ->
- for attr in el.Attributes() do
- WriteAttribute collector attr "name" (tagParameter >> collector.Add)
- | _ ->
- WriteNodes collector (el.Nodes())
- | _ -> ()
-
- and WriteNodes (collector: ITaggedTextCollector) (nodes: seq) =
- for n in nodes do
- WriteElement collector n
-
- and WriteText (collector: ITaggedTextCollector) (n: XText) =
- collector.Add(tagText n.Value)
-
- and WriteAttribute (collector: ITaggedTextCollector) (attr: XAttribute) (taggedName: string) tagger =
- if attr.Name.LocalName = taggedName then
- tagger attr.Value
- else
- collector.Add(tagText attr.Value)
-
- and WriteTypeName (collector: ITaggedTextCollector) (typeName: string) =
- let typeName = if typeName.StartsWith("T:") then typeName.Substring(2) else typeName
- let parts = typeName.Split([|'.'|])
- for i = 0 to parts.Length - 2 do
- collector.Add(tagNamespace parts.[i])
- collector.Add(Literals.dot)
- collector.Add(tagClass parts.[parts.Length - 1])
-
- type XmlDocReader private (doc: XElement) =
-
- let tryFindParameter name =
- doc.Descendants (XName.op_Implicit "param")
- |> Seq.tryFind (fun el ->
- match el.Attribute(XName.op_Implicit "name") with
- | null -> false
- | attr -> attr.Value = name)
-
- static member TryCreate (xml: string) =
- try Some (XmlDocReader(XElement.Parse(ProcessXml xml))) with _ -> None
-
- member __.CollectSummary(collector: ITaggedTextCollector) =
- match Seq.tryHead (doc.Descendants(XName.op_Implicit "summary")) with
- | None -> ()
- | Some el ->
- EnsureHardLine collector
- WriteElement collector el
-
- member this.CollectParameter(collector: ITaggedTextCollector, paramName: string) =
- match tryFindParameter paramName with
- | None -> ()
- | Some el ->
- EnsureHardLine collector
- WriteNodes collector (el.Nodes())
-
- member this.CollectParameters(collector: ITaggedTextCollector) =
- for p in doc.Descendants(XName.op_Implicit "param") do
- match p.Attribute(XName.op_Implicit "name") with
- | null -> ()
- | name ->
- EnsureHardLine collector
- collector.Add(tagParameter name.Value)
- collector.Add(Literals.colon)
- collector.Add(Literals.space)
- WriteNodes collector (p.Nodes())
-
- member this.CollectExceptions(collector: ITaggedTextCollector) =
- let mutable started = false;
- for p in doc.Descendants(XName.op_Implicit "exception") do
- match p.Attribute(XName.op_Implicit "cref") with
- | null -> ()
- | exnType ->
- if not started then
- started <- true
- AppendHardLine collector
- AppendHardLine collector
- AppendOnNewLine collector Strings.ExceptionsHeader
- EnsureHardLine collector
- collector.Add(tagSpace " ")
- WriteTypeName collector exnType.Value
- if not (Seq.isEmpty (p.Nodes())) then
- collector.Add Literals.space
- collector.Add Literals.minus
- collector.Add Literals.space
- WriteNodes collector (p.Nodes())
-
- type VsThreadToken() = class end
- let vsToken = VsThreadToken()
-
- /// Provide Xml Documentation
- type Provider(xmlIndexService:IVsXMLMemberIndexService, dte: DTE) =
- /// Index of assembly name to xml member index.
- let mutable xmlCache = new AgedLookup(10,areSimilar=(fun (x,y) -> x = y))
-
- let events = dte.Events :?> Events2
- let solutionEvents = events.SolutionEvents
- do solutionEvents.add_AfterClosing(fun () ->
- xmlCache.Clear(vsToken))
-
- let _AppendReturns (collector: ITaggedTextCollector) (memberData:IVsXMLMemberData3) =
- let ok,returnsText = memberData.GetReturnsText()
- if Com.Succeeded(ok) then
- if not collector.EndsWithLineBreak then
- AppendHardLine(collector)
- AppendHardLine(collector)
- AppendOnNewLine collector returnsText
-
- /// Retrieve the pre-existing xml index or None
- let GetMemberIndexOfAssembly(assemblyName) =
- match xmlCache.TryGet(vsToken, assemblyName) with
- | Some(memberIndex) -> Some(memberIndex)
- | None ->
- let ok,memberIndex = xmlIndexService.CreateXMLMemberIndex(assemblyName)
- if Com.Succeeded(ok) then
- let ok = memberIndex.BuildMemberIndex()
- if Com.Succeeded(ok) then
- xmlCache.Put(vsToken, assemblyName,memberIndex)
- Some(memberIndex)
- else None
- else None
-
- let AppendMemberData(collector: ITaggedTextCollector, xmlDocReader: XmlDocReader,showExceptions:bool,showParameters:bool) =
- AppendHardLine collector
- collector.StartXMLDoc()
- xmlDocReader.CollectSummary(collector)
-// AppendParameters appendTo memberData
-// AppendTypeParameters appendTo memberData
- if (showParameters) then
- xmlDocReader.CollectParameters collector
- // Not showing returns because there's no resource localization in language service to place the "returns:" text
- // AppendReturns appendTo memberData
- if (showExceptions) then
- xmlDocReader.CollectExceptions collector
-// AppendRemarks appendTo memberData
-
- interface IDocumentationBuilder with
- /// Append the given processed XML formatted into the string builder
- override this.AppendDocumentationFromProcessedXML(appendTo, processedXml, showExceptions, showParameters, paramName) =
- match XmlDocReader.TryCreate processedXml with
- | Some xmlDocReader ->
- match paramName with
- | Some paramName -> xmlDocReader.CollectParameter(appendTo, paramName)
- | None -> AppendMemberData(appendTo, xmlDocReader, showExceptions,showParameters)
- | None -> ()
-
- /// Append Xml documentation contents into the StringBuilder
- override this.AppendDocumentation
- ( /// ITaggedTextCollector to add to
- sink: ITaggedTextCollector,
- /// Name of the library file
- filename:string,
- /// Signature of the comment
- signature:string,
- /// Whether to show exceptions
- showExceptions:bool,
- /// Whether to show parameters and return
- showParameters:bool,
- /// Name of parameter
- paramName:string option
- ) =
- try
- match GetMemberIndexOfAssembly(filename) with
- | Some(index) ->
- let _,idx = index.ParseMemberSignature(signature)
- if idx <> 0u then
- let ok,xml = index.GetMemberXML(idx)
- if Com.Succeeded(ok) then
- (this:>IDocumentationBuilder).AppendDocumentationFromProcessedXML(sink, xml, showExceptions, showParameters, paramName)
- | None -> ()
- with e->
- Assert.Exception(e)
- reraise()
/// Append an XmlCommnet to the segment.
- let AppendXmlComment(documentationProvider:IDocumentationBuilder, sink: ITaggedTextCollector, xml, showExceptions, showParameters, paramName) =
+ let AppendXmlComment_DEPRECATED(documentationProvider:IDocumentationBuilder_DEPRECATED, sink: ITaggedTextCollector_DEPRECATED, xml, showExceptions, showParameters, paramName) =
match xml with
| FSharpXmlDoc.None -> ()
| FSharpXmlDoc.XmlDocFileSignature(filename,signature) ->
@@ -310,16 +120,16 @@ module internal XmlDocumentation =
let processedXml = ProcessXml(rawXml)
documentationProvider.AppendDocumentationFromProcessedXML(sink, processedXml, showExceptions, showParameters, paramName)
- let private AddSeparator (collector: ITaggedTextCollector) =
+ let private AddSeparator (collector: ITaggedTextCollector_DEPRECATED) =
if not collector.IsEmpty then
EnsureHardLine collector
collector.Add (tagText "-------------")
AppendHardLine collector
/// Build a data tip text string with xml comments injected.
- let BuildTipText(documentationProvider:IDocumentationBuilder, dataTipText: FSharpStructuredToolTipElement list, textCollector, xmlCollector, showText, showExceptions, showParameters) =
- let textCollector: ITaggedTextCollector = TextSanitizingCollector(textCollector, lineLimit = 45) :> _
- let xmlCollector: ITaggedTextCollector = TextSanitizingCollector(xmlCollector, lineLimit = 45) :> _
+ let BuildTipText_DEPRECATED(documentationProvider:IDocumentationBuilder_DEPRECATED, dataTipText: FSharpStructuredToolTipElement list, textCollector, xmlCollector, showText, showExceptions, showParameters) =
+ let textCollector: ITaggedTextCollector_DEPRECATED = TextSanitizingCollector_DEPRECATED(textCollector, lineLimit = 45) :> _
+ let xmlCollector: ITaggedTextCollector_DEPRECATED = TextSanitizingCollector_DEPRECATED(xmlCollector, lineLimit = 45) :> _
let addSeparatorIfNecessary add =
if add then
@@ -357,7 +167,7 @@ module internal XmlDocumentation =
textCollector.Add Literals.lineBreak
renderL (taggedTextListR textCollector.Add) r |> ignore)
- AppendXmlComment(documentationProvider, xmlCollector, item0.XmlDoc, showExceptions, showParameters, item0.ParamName)
+ AppendXmlComment_DEPRECATED(documentationProvider, xmlCollector, item0.XmlDoc, showExceptions, showParameters, item0.ParamName)
true
else
@@ -369,15 +179,10 @@ module internal XmlDocumentation =
List.fold Process false dataTipText |> ignore
- let BuildDataTipText(documentationProvider, textCollector, xmlCollector, FSharpToolTipText(dataTipText)) =
- BuildTipText(documentationProvider, dataTipText, textCollector, xmlCollector, true, true, false)
+ let BuildDataTipText_DEPRECATED(documentationProvider, textCollector, xmlCollector, FSharpToolTipText(dataTipText)) =
+ BuildTipText_DEPRECATED(documentationProvider, dataTipText, textCollector, xmlCollector, true, true, false)
- let BuildMethodOverloadTipText(documentationProvider, textCollector, xmlCollector, FSharpToolTipText(dataTipText), showParams) =
- BuildTipText(documentationProvider, dataTipText, textCollector, xmlCollector, false, false, showParams)
+ let BuildMethodOverloadTipText_DEPRECATED(documentationProvider, textCollector, xmlCollector, FSharpToolTipText(dataTipText), showParams) =
+ BuildTipText_DEPRECATED(documentationProvider, dataTipText, textCollector, xmlCollector, false, false, showParams)
- let BuildMethodParamText(documentationProvider, xmlCollector, xml, paramName) =
- AppendXmlComment(documentationProvider, TextSanitizingCollector(xmlCollector), xml, false, true, Some paramName)
- let documentationBuilderCache = System.Runtime.CompilerServices.ConditionalWeakTable()
- let CreateDocumentationBuilder(xmlIndexService: IVsXMLMemberIndexService, dte: DTE) =
- documentationBuilderCache.GetValue(xmlIndexService,(fun _ -> Provider(xmlIndexService, dte) :> IDocumentationBuilder))
\ No newline at end of file
diff --git a/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs b/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs
index f0d61ee20fb..720a433f64b 100644
--- a/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs
+++ b/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs
@@ -25,8 +25,8 @@ type internal FSharpLanguageServiceTestable() as this =
let mutable artifacts : ProjectSitesAndFiles option = None
let mutable serviceProvider : System.IServiceProvider option = None
let mutable preferences : LanguagePreferences option = None
- let mutable documentationBuilder : Microsoft.VisualStudio.FSharp.LanguageService.IDocumentationBuilder option = None
- let mutable sourceFactory : (IVsTextLines -> IFSharpSource) option = None
+ let mutable documentationBuilder : Microsoft.VisualStudio.FSharp.LanguageService.IDocumentationBuilder_DEPRECATED option = None
+ let mutable sourceFactory : (IVsTextLines -> IFSharpSource_DEPRECATED) option = None
let mutable dirtyForTypeCheckFiles : Set = Set.empty
let mutable isInitialized = false
let mutable unhooked = false
@@ -34,7 +34,7 @@ type internal FSharpLanguageServiceTestable() as this =
let buffer = Com.ThrowOnFailure1(view.GetBuffer())
this.GetColorizer(buffer)
- let bgRequests = new FSharpLanguageServiceBackgroundRequests(getColorizer,(fun () -> this.FSharpChecker),(fun () -> this.ProjectSitesAndFiles),(fun () -> this.ServiceProvider),(fun () -> this.DocumentationBuilder))
+ let bgRequests = new FSharpLanguageServiceBackgroundRequests_DEPRECATED(getColorizer,(fun () -> this.FSharpChecker),(fun () -> this.ProjectSitesAndFiles),(fun () -> this.ServiceProvider),(fun () -> this.DocumentationBuilder))
member this.FSharpChecker =
if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState
@@ -118,7 +118,7 @@ type internal FSharpLanguageServiceTestable() as this =
bgRequests.AddOutOfDateProjectFileName(site.ProjectFileName())
for filename in site.SourceFilesOnDisk() do
let rdt = this.ServiceProvider.RunningDocumentTable
- match this.ProjectSitesAndFiles.TryGetSourceOfFile(rdt,filename) with
+ match this.ProjectSitesAndFiles.TryGetSourceOfFile_DEPRECATED(rdt,filename) with
| Some source ->
source.RecolorizeWholeFile()
source.RecordChangeToView()
@@ -135,8 +135,8 @@ type internal FSharpLanguageServiceTestable() as this =
member this.BackgroundRequests = bgRequests
- /// Unittestable complement to LanguageServce.CreateSource
- member this.CreateSource(buffer:IVsTextLines) : IFSharpSource =
+ /// Unittestable complement to LanguageServce.CreateSource_DEPRECATED
+ member this.CreateSource_DEPRECATED(buffer:IVsTextLines) : IFSharpSource_DEPRECATED =
// Each time a source is created, also verify that the IProjectSite has been initialized to listen to changes to the project.
// We can't listen to OnProjectLoaded because the language service is not guaranteed to be loaded when this is called.
@@ -162,11 +162,11 @@ type internal FSharpLanguageServiceTestable() as this =
// Create the source and register file change callbacks there.
let source = this.SourceFactory(buffer)
- this.ProjectSitesAndFiles.SetSource(buffer, source)
+ this.ProjectSitesAndFiles.SetSource_DEPRECATED(buffer, source)
source
// For each change in dependency files, notify the language service of the change and propagate the update
- interface IDependencyFileChangeNotify with
+ interface IDependencyFileChangeNotify_DEPRECATED with
member this.DependencyFileCreated projectSite =
let enableInMemoryCrossProjectReferences = true
// Invalidate the configuration if we notice any add for any DependencyFiles
@@ -182,20 +182,20 @@ type internal FSharpLanguageServiceTestable() as this =
member this.OnIdle() =
for file in dirtyForTypeCheckFiles do
let rdt = this.ServiceProvider.RunningDocumentTable
- match this.ProjectSitesAndFiles.TryGetSourceOfFile(rdt, file) with
+ match this.ProjectSitesAndFiles.TryGetSourceOfFile_DEPRECATED(rdt, file) with
| Some source -> source.RecordChangeToView()
| None -> ()
dirtyForTypeCheckFiles <- Set.empty
/// Remove a colorizer.
- member this.CloseColorizer(colorizer:FSharpColorizer) =
+ member this.CloseColorizer(colorizer:FSharpColorizer_DEPRECATED) =
let buffer = colorizer.Buffer
let mutable guid = colorizerGuid
(buffer :?> IVsUserData).SetData(&guid, null) |> ErrorHandler.ThrowOnFailure |> ignore
/// Get a colorizer for a particular buffer.
- member this.GetColorizer(buffer:IVsTextLines) : FSharpColorizer =
+ member this.GetColorizer(buffer:IVsTextLines) : FSharpColorizer_DEPRECATED =
let mutable guid = colorizerGuid
let mutable colorizerObj = null
@@ -203,21 +203,21 @@ type internal FSharpLanguageServiceTestable() as this =
match colorizerObj with
| null ->
let scanner =
- new FSharpScanner(fun source ->
+ new FSharpScanner_DEPRECATED(fun source ->
// Note: in theory, the next few lines do not need to be recomputed every line. Instead we could just cache the tokenizer
// and only update it when e.g. the project system notifies us there is an important change (e.g. a file rename, etc).
// In practice we have been there, and always screwed up some non-unit-tested/testable corner-cases.
// So this is not ideal from a perf perspective, but it is easy to reason about the correctness.
let filename = VsTextLines.GetFilename buffer
let rdt = this.ServiceProvider.RunningDocumentTable
- let defines = this.ProjectSitesAndFiles.GetDefinesForFile(rdt, filename)
+ let defines = this.ProjectSitesAndFiles.GetDefinesForFile_DEPRECATED(rdt, filename)
let sourceTokenizer = FSharpSourceTokenizer(defines,Some(filename))
sourceTokenizer.CreateLineTokenizer(source))
- let colorizer = new FSharpColorizer(this.CloseColorizer, buffer, scanner)
+ let colorizer = new FSharpColorizer_DEPRECATED(this.CloseColorizer, buffer, scanner)
(buffer :?> IVsUserData).SetData(&guid, colorizer) |> ErrorHandler.ThrowOnFailure |> ignore
colorizer
- | _ -> colorizerObj :?> FSharpColorizer
+ | _ -> colorizerObj :?> FSharpColorizer_DEPRECATED
/// Block until the background compile finishes.
//
diff --git a/vsintegration/tests/Salsa/SalsaUtils.fsi b/vsintegration/tests/Salsa/SalsaUtils.fsi
index 904f1bdca93..8bdb2391549 100644
--- a/vsintegration/tests/Salsa/SalsaUtils.fsi
+++ b/vsintegration/tests/Salsa/SalsaUtils.fsi
@@ -82,7 +82,7 @@ module internal VsOpsUtils =
val GetQuickInfoAndSpanAtCursor : OpenFile -> string*TextSpan
val GetNameOfOpenFile : OpenFile -> string
val GetProjectOptionsOfScript : OpenFile -> FSharpProjectOptions
- val GetParameterInfoAtCursor : OpenFile -> MethodListForAMethodTip option
+ val GetParameterInfoAtCursor : OpenFile -> MethodListForAMethodTip_DEPRECATED option
val GetTokenTypeAtCursor : OpenFile -> Salsa.Salsa.TokenType
val GetIdentifierAtCursor : OpenFile -> (string * int) option
val GetF1KeywordAtCursor : OpenFile -> string option
diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs
index f83780f5a5f..44a43bb0040 100644
--- a/vsintegration/tests/Salsa/salsa.fs
+++ b/vsintegration/tests/Salsa/salsa.fs
@@ -454,7 +454,7 @@ module internal Salsa =
abstract CleanInvisibleProject : unit -> unit
and TextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan
- and GotoDefnResult = Microsoft.VisualStudio.FSharp.LanguageService.GotoDefinitionResult
+ and GotoDefnResult = Microsoft.VisualStudio.FSharp.LanguageService.GotoDefinitionResult_DEPRECATED
// Result of querying the completion list
@@ -526,7 +526,7 @@ module internal Salsa =
abstract GetMatchingBracesForPositionAtCursor: OpenFile -> (TextSpan * TextSpan)[]
abstract GetNameOfOpenFile: OpenFile -> string
abstract GetProjectOptionsOfScript: OpenFile -> FSharpProjectOptions
- abstract GetParameterInfoAtCursor: OpenFile -> MethodListForAMethodTip option
+ abstract GetParameterInfoAtCursor: OpenFile -> MethodListForAMethodTip_DEPRECATED option
abstract GetTokenTypeAtCursor: OpenFile -> TokenType
abstract GetIdentifierAtCursor: OpenFile -> (string * int) option
abstract GetF1KeywordAtCursor: OpenFile -> string option
@@ -542,7 +542,7 @@ module internal Salsa =
[]
module GotoDefnResultExtensions =
- type Microsoft.VisualStudio.FSharp.LanguageService.GotoDefinitionResult with
+ type Microsoft.VisualStudio.FSharp.LanguageService.GotoDefinitionResult_DEPRECATED with
member this.ToOption() = if this.Success then Some(this.Span, this.Url) else None
@@ -588,14 +588,14 @@ module internal Salsa =
{line = returnLine; col = returnCol}
/// Colorize a single line of text.
- let ColorizeLine (colorizer:FSharpColorizer) lineNumber lineText oldState attrs =
+ let ColorizeLine (colorizer:FSharpColorizer_DEPRECATED) lineNumber lineText oldState attrs =
let marshaled = Marshal.StringToCoTaskMemUni(lineText)
let newState = colorizer.ColorizeLine(lineNumber, lineText.Length, marshaled, oldState, attrs)
Marshal.FreeCoTaskMem(marshaled)
newState
/// Recolorize a set of lines
- let RecolorizeLines (view:IVsTextView) (getColorizer:IVsTextView->FSharpColorizer) (lines:string[]) (linestarts:int[]) (top:int) (bottom:int) =
+ let RecolorizeLines (view:IVsTextView) (getColorizer:IVsTextView->FSharpColorizer_DEPRECATED) (lines:string[]) (linestarts:int[]) (top:int) (bottom:int) =
let colorizer = getColorizer(view)
for i in top..bottom do
// let attrs = Array.create fileline.Length 0u
@@ -739,7 +739,7 @@ module internal Salsa =
let mutable focusFile : SimpleOpenFile option = None
let mutable solution : SimpleOpenSolution option = None
let mutable prevSolutions : Map = Map.empty
- let mutable bufferToSource = new Dictionary()
+ let mutable bufferToSource = new Dictionary()
let mutable invisibleSolution : SimpleOpenSolution option = None
let mutable invisibleProjectFolder : string = null
let mutable invisibleProject : SimpleOpenProject option = None
@@ -813,7 +813,7 @@ module internal Salsa =
solution <- None
| None -> failwith "there is no open solution"
- member vs.AddSourceForBuffer(buffer:IVsTextBuffer,source:IFSharpSource) =
+ member vs.AddSourceForBuffer(buffer:IVsTextBuffer,source:IFSharpSource_DEPRECATED) =
bufferToSource.Add(buffer,source)
member vs.GetSourceForBuffer(buffer:IVsTextBuffer) =
@@ -1068,10 +1068,10 @@ module internal Salsa =
// Create the 'Source'
let file = SimpleOpenFile(project,filename,lines,view,linestarts,rdtId)
- let source = Source.CreateSourceTestable(file.RecolorizeWholeFile,file.RecolorizeLine,(fun () -> filename),file.IsClosed,project.Solution.Vs.FileChangeEx, solution.Vs.LanguageService :> IDependencyFileChangeNotify)
+ let source = Source.CreateSourceTestable_DEPRECATED(file.RecolorizeWholeFile,file.RecolorizeLine,(fun () -> filename),file.IsClosed,project.Solution.Vs.FileChangeEx, solution.Vs.LanguageService :> IDependencyFileChangeNotify_DEPRECATED)
let _,buf = view.GetBuffer()
solution.Vs.AddSourceForBuffer(buf,source)
- let source = solution.Vs.LanguageService.CreateSource(buf)
+ let source = solution.Vs.LanguageService.CreateSource_DEPRECATED(buf)
// Scan all lines with the colorizer
let tcs:IVsTextColorState = downcast box(buf)
@@ -1121,7 +1121,7 @@ module internal Salsa =
if combinedLines = null then
combinedLines<-String.Join("\n",lines)
combinedLines
- member file.Source : IFSharpSource =
+ member file.Source : IFSharpSource_DEPRECATED =
let _,buf = view.GetBuffer()
project.Solution.Vs.GetSourceForBuffer(buf)
@@ -1155,7 +1155,7 @@ module internal Salsa =
// Full check.
let sink = new AuthoringSink(BackgroundRequestReason.FullTypeCheck, 0, 0, maxErrors)
let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot
- let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(0,0,new TokenInfo(),file.CombinedLines, snapshot, MethodTipMiscellany.Typing, System.IO.Path.GetFullPath(file.Filename), BackgroundRequestReason.FullTypeCheck, view,sink,null,file.Source.ChangeCount,false)
+ let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(0,0,new TokenInfo(),file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath(file.Filename), BackgroundRequestReason.FullTypeCheck, view,sink,null,file.Source.ChangeCount,false)
pr.ResultSink.add_OnErrorAdded(
OnErrorAddedHandler(fun path subcategory msg context severity ->
project.Errors <- new Error(path, subcategory, msg, context, severity) :: project.Errors))
@@ -1183,7 +1183,7 @@ module internal Salsa =
let sink = new AuthoringSink(parseReason, cursor.line-1, cursor.col-1, maxErrors)
let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot
let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(
- cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany.Typing,
+ cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing,
System.IO.Path.GetFullPath(file.Filename),
parseReason, view, sink, null, file.Source.ChangeCount, false)
@@ -1237,7 +1237,7 @@ module internal Salsa =
let sink = new AuthoringSink(BackgroundRequestReason.MatchBraces, cursor.line-1, cursor.col-1, maxErrors)
let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot
let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(
- cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany.Typing,
+ cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing,
System.IO.Path.GetFullPath(file.Filename),
BackgroundRequestReason.MatchBraces, view, sink, null, file.Source.ChangeCount, false)
@@ -1247,7 +1247,7 @@ module internal Salsa =
[|
for o in sink.Braces do
match o with
- | (:? Microsoft.VisualStudio.FSharp.LanguageService.BraceMatch as m) ->
+ | (:? Microsoft.VisualStudio.FSharp.LanguageService.BraceMatch_DEPRECATED as m) ->
yield (m.a, m.b)
| x -> failwithf "Microsoft.VisualStudio.FSharp.LanguageService.BraceMatch expected, but got %A" (if box x = null then "null" else (x.GetType()).FullName)
|]
@@ -1263,7 +1263,7 @@ module internal Salsa =
let sink = new AuthoringSink(BackgroundRequestReason.MethodTip, cursor.line-1, cursor.col-1, maxErrors)
let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot
let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(
- cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany.ExplicitlyInvokedViaCtrlShiftSpace,
+ cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.ExplicitlyInvokedViaCtrlShiftSpace,
System.IO.Path.GetFullPath(file.Filename),
BackgroundRequestReason.MethodTip, view, sink, null, file.Source.ChangeCount, false)
@@ -1354,9 +1354,9 @@ module internal Salsa =
let ti = new TokenInfo ()
let sink = new AuthoringSink (BackgroundRequestReason.Goto, row, col, maxErrors)
let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot
- let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(row, col, ti, file.CombinedLines, snapshot, MethodTipMiscellany.Typing, System.IO.Path.GetFullPath file.Filename, BackgroundRequestReason.Goto, view, sink, null, file.Source.ChangeCount, false)
+ let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(row, col, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath file.Filename, BackgroundRequestReason.Goto, view, sink, null, file.Source.ChangeCount, false)
file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=true)
- (currentAuthoringScope :?> FSharpIntellisenseInfo).GotoDefinition (view, row, col)
+ (currentAuthoringScope :?> FSharpIntellisenseInfo_DEPRECATED).GotoDefinition (view, row, col)
member file.GetF1KeywordAtCursor() =
file.EnsureInitiallyFocusedInVs()
@@ -1366,7 +1366,7 @@ module internal Salsa =
let ti = new TokenInfo ()
let sink = new AuthoringSink (BackgroundRequestReason.Goto, row, col, maxErrors)
let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot
- let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(row, col, ti, file.CombinedLines, snapshot, MethodTipMiscellany.Typing, System.IO.Path.GetFullPath file.Filename, BackgroundRequestReason.QuickInfo, view, sink, null, file.Source.ChangeCount, false)
+ let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(row, col, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath file.Filename, BackgroundRequestReason.QuickInfo, view, sink, null, file.Source.ChangeCount, false)
file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=true)
let keyword = ref None
let span = new Microsoft.VisualStudio.TextManager.Interop.TextSpan(iStartIndex=col,iStartLine=row,iEndIndex=col,iEndLine=row)
@@ -1445,7 +1445,7 @@ module internal Salsa =
let rdt = box (VsMocks.createRdt())
let tm = box (VsMocks.createTextManager())
let documentationProvider =
- { new IDocumentationBuilder with
+ { new IDocumentationBuilder_DEPRECATED with
override doc.AppendDocumentationFromProcessedXML(appendTo,processedXml:string,showExceptions, showReturns, paramName) =
appendTo.Add(Microsoft.FSharp.Compiler.Layout.TaggedTextOps.tagText processedXml)
appendTo.Add(Microsoft.FSharp.Compiler.Layout.TaggedTextOps.Literals.lineBreak)
diff --git a/vsintegration/tests/unittests/Tests.LanguageService.General.fs b/vsintegration/tests/unittests/Tests.LanguageService.General.fs
index 06e8a30fe66..68ceac18ce0 100644
--- a/vsintegration/tests/unittests/Tests.LanguageService.General.fs
+++ b/vsintegration/tests/unittests/Tests.LanguageService.General.fs
@@ -19,7 +19,7 @@ open UnitTests.TestLib.LanguageService
open UnitTests.TestLib.ProjectSystem
[][]
-module IFSharpSource =
+module IFSharpSource_DEPRECATED =
[]
let MultipleSourceIsDirtyCallsChangeTimestamps() =
@@ -27,10 +27,10 @@ module IFSharpSource =
let recolorizeLine (_line:int) = ()
let isClosed() = false
let depFileChangeNotify =
- { new IDependencyFileChangeNotify with
+ { new IDependencyFileChangeNotify_DEPRECATED with
member this.DependencyFileCreated _projectSite = ()
member this.DependencyFileChanged _filename = () }
- let source = Source.CreateSourceTestable(recolorizeWholeFile, recolorizeLine, (fun () -> "dummy.fs"), isClosed, VsMocks.VsFileChangeEx(),depFileChangeNotify)
+ let source = Source.CreateSourceTestable_DEPRECATED(recolorizeWholeFile, recolorizeLine, (fun () -> "dummy.fs"), isClosed, VsMocks.VsFileChangeEx(),depFileChangeNotify)
let originalChangeCount = source.ChangeCount
let originalDirtyTime = source.DirtyTime
@@ -101,60 +101,6 @@ type UsingMSBuild() =
n
) 0
- []
- member public this.``PendingRequests``() =
- let makeRequest (reason : BackgroundRequestReason) = new BackgroundRequest(false, Reason = reason)
-
- let requests = Microsoft.VisualStudio.FSharp.LanguageService.PendingRequests()
-
- let verify r =
- let dequeued = requests.Dequeue()
- Assert.AreEqual(r, dequeued.Reason)
-
- // Ui1 + Ui2 = Ui2
- // should have only last
- requests.Enqueue(makeRequest BackgroundRequestReason.MemberSelect)
- requests.Enqueue(makeRequest BackgroundRequestReason.Goto)
- verify BackgroundRequestReason.Goto
- Assert.AreEqual(0, requests.Count)
-
- // n-Ui1 + Ui2 = Ui2
- // should have only last
- requests.Enqueue(makeRequest BackgroundRequestReason.FullTypeCheck)
- requests.Enqueue(makeRequest BackgroundRequestReason.MemberSelect)
- verify BackgroundRequestReason.MemberSelect
- Assert.AreEqual(0, requests.Count)
-
- // n-Ui1 + n-Ui2 = n-Ui2
- requests.Enqueue(makeRequest BackgroundRequestReason.FullTypeCheck)
- requests.Enqueue(makeRequest BackgroundRequestReason.ParseFile)
- verify BackgroundRequestReason.ParseFile
- Assert.AreEqual(0, requests.Count)
-
- // Ui1 + n-Ui2 = Ui1 + n-Ui2
- requests.Enqueue(makeRequest BackgroundRequestReason.MemberSelect)
- requests.Enqueue(makeRequest BackgroundRequestReason.ParseFile)
- verify BackgroundRequestReason.MemberSelect
- Assert.AreEqual(1, requests.Count)
- verify BackgroundRequestReason.ParseFile
- Assert.AreEqual(0, requests.Count)
-
- // (Ui1 + n-Ui2) + Ui3 = Ui3
- requests.Enqueue(makeRequest BackgroundRequestReason.MemberSelect)
- requests.Enqueue(makeRequest BackgroundRequestReason.ParseFile)
- requests.Enqueue(makeRequest BackgroundRequestReason.MemberSelect)
- verify BackgroundRequestReason.MemberSelect
- Assert.AreEqual(0, requests.Count)
-
- // (Ui1 + n-Ui2) + n-Ui3 = Ui1 + n-Ui3
- requests.Enqueue(makeRequest BackgroundRequestReason.MemberSelect)
- requests.Enqueue(makeRequest BackgroundRequestReason.ParseFile)
- requests.Enqueue(makeRequest BackgroundRequestReason.FullTypeCheck)
- verify BackgroundRequestReason.MemberSelect
- Assert.AreEqual(1, requests.Count)
- verify BackgroundRequestReason.FullTypeCheck
- Assert.AreEqual(0, requests.Count)
-
[]
member public this.``PublicSurfaceArea.DotNetReflection``() =
@@ -199,7 +145,7 @@ type UsingMSBuild() =
[]
member public this.``Lexer.CommentsLexing.Bug1548``() =
- let scan = new FSharpScanner(fun source ->
+ let scan = new FSharpScanner_DEPRECATED(fun source ->
let filename = "test.fs"
let defines = [ "COMPILED"; "EDITING" ]
@@ -249,7 +195,7 @@ type UsingMSBuild() =
let currentTokenInfo = new Microsoft.VisualStudio.FSharp.LanguageService.TokenInfo()
let lastColorState = 0 // First line of code, so no previous state
currentTokenInfo.EndIndex <- -1
- let refState = ref (ColorStateLookup.LexStateOfColorState lastColorState)
+ let refState = ref (ColorStateLookup_DEPRECATED.LexStateOfColorState lastColorState)
// Lex the line and add all lexed tokens to a dictionary
let lexed = new System.Collections.Generic.Dictionary<_, _>()
diff --git a/vsintegration/tests/unittests/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/unittests/Tests.LanguageService.ParameterInfo.fs
index 6d07bc886c4..4d8807549d5 100644
--- a/vsintegration/tests/unittests/Tests.LanguageService.ParameterInfo.fs
+++ b/vsintegration/tests/unittests/Tests.LanguageService.ParameterInfo.fs
@@ -21,23 +21,23 @@ module ParamInfoStandardSettings =
type UsingMSBuild() =
inherit LanguageServiceBaseTests()
- let GetParamDisplays(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip) =
+ let GetParamDisplays(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED) =
[ for i = 0 to methods.GetCount() - 1 do
yield [ for j = 0 to methods.GetParameterCount(i) - 1 do
let (name,display,description) = methods.GetParameterInfo(i,j)
yield display ] ]
- let AssertEmptyMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip option) =
+ let AssertEmptyMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option) =
Assert.IsTrue(resultMethodGroup.IsNone, "Expected an empty method group")
- let AssertMethodGroupDesciptionsDoNotContain(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip, expectNotToBeThere) =
+ let AssertMethodGroupDesciptionsDoNotContain(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED, expectNotToBeThere) =
for i = 0 to methods.GetCount() - 1 do
let description = methods.GetDescription(i)
if (description.Contains(expectNotToBeThere)) then
Console.WriteLine("Expected description {0} to not contain {1}", description, expectNotToBeThere)
AssertNotContains(description,expectNotToBeThere)
- let AssertMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip option, expectedParamNamesSet:string list list) =
+ let AssertMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNamesSet:string list list) =
Assert.IsTrue(resultMethodGroup.IsSome, "Expected a method group")
let resultMethodGroup = resultMethodGroup.Value
Assert.AreEqual(expectedParamNamesSet.Length, resultMethodGroup.GetCount())
@@ -49,7 +49,7 @@ type UsingMSBuild() =
(expectedParamNames,paramDisplays) ||> List.forall2 (fun expectedParamName paramDisplay ->
paramDisplay.Contains(expectedParamName)))))
- let AssertMethodGroupContain(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip option, expectedParamNames:string list) =
+ let AssertMethodGroupContain(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNames:string list) =
Assert.IsTrue(resultMethodGroup.IsSome, "Expected a method group")
let resultMethodGroup = resultMethodGroup.Value
Assert.IsTrue(resultMethodGroup