Skip to content

Commit

Permalink
Update vs typeprovider tests (#10627)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom authored Dec 7, 2020
1 parent 43efdf2 commit 4f11099
Show file tree
Hide file tree
Showing 6 changed files with 14,870 additions and 3,333 deletions.
10 changes: 3 additions & 7 deletions vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,19 @@ type internal FSharpCompletionProvider

static member ProvideCompletionsAsyncAux(checker: FSharpChecker, sourceText: SourceText, caretPosition: int, options: FSharpProjectOptions, filePath: string,
textVersionHash: int, getAllSymbols: FSharpCheckFileResults -> AssemblySymbol list, languageServicePerformanceOptions: LanguageServicePerformanceOptions, intellisenseOptions: IntelliSenseOptions) =

asyncMaybe {
let! parseResults, _, checkFileResults = checker.ParseAndCheckDocument(filePath, textVersionHash, sourceText, options, languageServicePerformanceOptions, userOpName = userOpName)

let textLines = sourceText.Lines
let caretLinePos = textLines.GetLinePosition(caretPosition)
let caretLine = textLines.GetLineFromPosition(caretPosition)
let fcsCaretLineNumber = Line.fromZ caretLinePos.Line // Roslyn line numbers are zero-based, FSharp.Compiler.Service line numbers are 1-based
let caretLineColumn = caretLinePos.Character
let partialName = QuickParse.GetPartialLongNameEx(caretLine.ToString(), caretLineColumn - 1)

let getAllSymbols() =
getAllSymbols checkFileResults
|> List.filter (fun assemblySymbol ->
|> List.filter (fun assemblySymbol ->
assemblySymbol.FullName.Contains "." && not (PrettyNaming.IsOperatorName assemblySymbol.Symbol.DisplayName))

let declarations = checkFileResults.GetDeclarationListInfo(Some(parseResults), fcsCaretLineNumber, caretLine.ToString(),
partialName, getAllSymbols)
let results = List<Completion.CompletionItem>()
Expand Down Expand Up @@ -223,7 +221,6 @@ type internal FSharpCompletionProvider
override _.ProvideCompletionsAsync(context: Completion.CompletionContext) =
asyncMaybe {
use _logBlock = Logger.LogBlockMessage context.Document.Name LogEditorFunctionId.Completion_ProvideCompletionsAsync

let document = context.Document
let! sourceText = context.Document.GetTextAsync(context.CancellationToken)
let defines = projectInfoManager.GetCompilationDefinesForEditingDocument(document)
Expand All @@ -237,10 +234,9 @@ type internal FSharpCompletionProvider
let! results =
FSharpCompletionProvider.ProvideCompletionsAsyncAux(checker, sourceText, context.Position, projectOptions, document.FilePath,
textVersion.GetHashCode(), getAllSymbols, settings.LanguageServicePerformance, settings.IntelliSense)

context.AddItems(results)
} |> Async.Ignore |> RoslynHelpers.StartAsyncUnitAsTask context.CancellationToken

override _.GetDescriptionAsync(document: Document, completionItem: Completion.CompletionItem, cancellationToken: CancellationToken): Task<CompletionDescription> =
async {
use _logBlock = Logger.LogBlockMessage document.Name LogEditorFunctionId.Completion_GetDescriptionAsync
Expand Down
Loading

0 comments on commit 4f11099

Please sign in to comment.