提交 8516358a 编写于 作者: D David Wedelich 提交者: Will Smith

only ParseAndCheckDocument once in the CompletionProvider (#4123)

上级 19f18530
......@@ -97,14 +97,10 @@ type internal FSharpCompletionProvider
static member ProvideCompletionsAsyncAux(checker: FSharpChecker, sourceText: SourceText, caretPosition: int, options: FSharpProjectOptions, filePath: string,
textVersionHash: int, getAllSymbols: unit -> AssemblySymbol list) =
textVersionHash: int, getAllSymbols: FSharpCheckFileResults -> AssemblySymbol list) =
asyncMaybe {
let! parseResults, _, checkFileResults = checker.ParseAndCheckDocument(filePath, textVersionHash, sourceText.ToString(), options, allowStaleResults = true, userOpName = userOpName)
//#if DEBUG
//Logging.Logging.logInfof "AST:\n%+A" parsedInput
//#endif
let textLines = sourceText.Lines
let caretLinePos = textLines.GetLinePosition(caretPosition)
let caretLine = textLines.GetLineFromPosition(caretPosition)
......@@ -113,7 +109,7 @@ type internal FSharpCompletionProvider
let partialName = QuickParse.GetPartialLongNameEx(caretLine.ToString(), caretLineColumn - 1)
let getAllSymbols() =
getAllSymbols()
getAllSymbols checkFileResults
|> List.filter (fun entity -> entity.FullName.Contains "." && not (PrettyNaming.IsOperatorName entity.Symbol.DisplayName))
let! declarations = checkFileResults.GetDeclarationListInfo(Some(parseResults), fcsCaretLineNumber, caretLine.ToString(),
......@@ -222,8 +218,7 @@ type internal FSharpCompletionProvider
do! Option.guard (CompletionUtils.shouldProvideCompletion(document.Id, document.FilePath, defines, sourceText, context.Position))
let! _parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document)
let! textVersion = context.Document.GetTextVersionAsync(context.CancellationToken)
let! _, _, fileCheckResults = checker.ParseAndCheckDocument(document, projectOptions, true, userOpName=userOpName)
let getAllSymbols() =
let getAllSymbols(fileCheckResults: FSharpCheckFileResults) =
if Settings.IntelliSense.ShowAllSymbols
then assemblyContentProvider.GetAllEntitiesInProjectAndReferencedAssemblies(fileCheckResults)
else []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册