Skip to content

Commit 4abe294

Browse files
committed
Fix PM (#18435)
1 parent 5c1bce8 commit 4abe294

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/Compiler/Driver/ScriptClosure.fs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,13 @@ module ScriptPreprocessClosure =
331331
for kv in tcConfig.packageManagerLines do
332332
let packageManagerKey, packageManagerLines = kv.Key, kv.Value
333333

334-
match packageManagerLines |> List.filter (not << isEditorCursorInPackageLines) with
334+
let packageManagerLines =
335+
packageManagerLines |> List.filter (not << isEditorCursorInPackageLines)
336+
337+
match packageManagerLines with
335338
| [] -> ()
336339
| packageManagerLine :: _ ->
337340
let m = packageManagerLine.Range
338-
let packageManagerLines = packageManagerLines
339341
yield! processPackageManagerLines m packageManagerLines scriptName packageManagerKey
340342
]
341343

vsintegration/src/FSharp.Editor/Common/Extensions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ type Document with
145145
| hr, _, _, docData, _ when ErrorHandler.Succeeded(hr) && docData <> IntPtr.Zero ->
146146
match Marshal.GetObjectForIUnknown docData with
147147
| :? IVsTextBuffer as ivsTextBuffer ->
148-
match textManager.GetActiveView(1, ivsTextBuffer) with
148+
match textManager.GetActiveView(0, ivsTextBuffer) with
149149
| hr, vsTextView when ErrorHandler.Succeeded(hr) -> Some vsTextView
150150
| _ -> None
151151
| _ -> None

vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,16 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
193193
let rec tryComputeOptionsBySingleScriptOrFile (document: Document) (ct: CancellationToken) userOpName =
194194
async {
195195
let! fileStamp = document.GetTextVersionAsync(ct) |> Async.AwaitTask
196+
let textViewAndCaret () : (IVsTextView * Position) option = document.TryGetTextViewAndCaretPos()
196197

197198
match singleFileCache.TryGetValue(document.Id) with
198199
| false, _ ->
199200
let! sourceText = document.GetTextAsync(ct) |> Async.AwaitTask
200201

201202
let getProjectOptionsFromScript textViewAndCaret =
202-
match textViewAndCaret with
203+
let caret = textViewAndCaret ()
204+
205+
match caret with
203206
| None ->
204207
checker.GetProjectOptionsFromScript(
205208
document.FilePath,
@@ -219,7 +222,6 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
219222
userOpName = userOpName
220223
)
221224

222-
let textViewAndCaret = document.TryGetTextViewAndCaretPos()
223225
let! scriptProjectOptions, _ = getProjectOptionsFromScript textViewAndCaret
224226
let project = document.Project
225227

@@ -259,7 +261,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
259261

260262
let updateProjectOptions () =
261263
async {
262-
let! scriptProjectOptions, _ = getProjectOptionsFromScript None
264+
let! scriptProjectOptions, _ = getProjectOptionsFromScript textViewAndCaret
263265

264266
checker.NotifyFileChanged(document.FilePath, scriptProjectOptions)
265267
|> Async.Start
@@ -274,7 +276,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
274276
match value with
275277
| projectId, fileStamp, parsingOptions, projectOptions, _ ->
276278
let subscription =
277-
match textViewAndCaret with
279+
match textViewAndCaret () with
278280
| Some(textView, _) ->
279281
subscribeToTextViewEvents (textView, (Some onChangeCaretHandler), (Some onKillFocus), (Some onSetFocus))
280282
| None -> None

0 commit comments

Comments
 (0)