Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 6b45dc5

Browse files
authored
Move ParseFile calls to ParseDocument (dotnet#11337)
1 parent 1a68b45 commit 6b45dc5

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

CodeFix/ChangeRefCellDerefToNotExpression.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type internal FSharpChangeRefCellDerefToNotExpressionCodeFixProvider
2727
let document = context.Document
2828
let! parsingOptions, _ = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document, context.CancellationToken, userOpName)
2929
let! sourceText = context.Document.GetTextAsync(context.CancellationToken)
30-
let! parseResults = checkerProvider.Checker.ParseFile(document.FilePath, sourceText.ToFSharpSourceText(), parsingOptions, userOpName=userOpName) |> liftAsync
30+
let! parseResults = checkerProvider.Checker.ParseDocument(document, parsingOptions, userOpName=userOpName)
3131

3232
let errorRange = RoslynHelpers.TextSpanToFSharpRange(document.FilePath, context.Span, sourceText)
3333
let! derefRange = parseResults.TryRangeOfRefCellDereferenceContainingPos errorRange.Start

CodeFix/RemoveUnusedBinding.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ type internal FSharpRemoveUnusedBindingCodeFixProvider
5050
inherit CodeFixProvider()
5151
static let userOpName = "RemoveUnusedBinding"
5252
let fixableDiagnosticIds = set ["FS1182"]
53-
let checker = checkerProvider.Checker
5453

5554
override _.FixableDiagnosticIds = Seq.toImmutableArray fixableDiagnosticIds
5655

@@ -63,7 +62,7 @@ type internal FSharpRemoveUnusedBindingCodeFixProvider
6362
let! sourceText = document.GetTextAsync(context.CancellationToken)
6463

6564
let! parsingOptions, _ = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document, context.CancellationToken, userOpName)
66-
let! parseResults = checker.ParseFile(document.FilePath, sourceText.ToFSharpSourceText(), parsingOptions, userOpName = userOpName) |> liftAsync
65+
let! parseResults = checkerProvider.Checker.ParseDocument(document, parsingOptions, userOpName=userOpName)
6766

6867
let diagnostics =
6968
context.Diagnostics

Refactor/ChangeDerefToValueRefactoring.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type internal FSharpChangeDerefToValueRefactoring
3232
let document = context.Document
3333
let! parsingOptions, _ = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document, context.CancellationToken, userOpName)
3434
let! sourceText = context.Document.GetTextAsync(context.CancellationToken)
35-
let! parseResults = checkerProvider.Checker.ParseFile(document.FilePath, sourceText.ToFSharpSourceText(), parsingOptions, userOpName=userOpName) |> liftAsync
35+
let! parseResults = checkerProvider.Checker.ParseDocument(document, parsingOptions, userOpName=userOpName)
3636

3737
let selectionRange = RoslynHelpers.TextSpanToFSharpRange(document.FilePath, context.Span, sourceText)
3838
let! derefRange = parseResults.TryRangeOfRefCellDereferenceContainingPos selectionRange.Start

0 commit comments

Comments
 (0)