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

Commit 104d906

Browse files
committed
Fix hash completion span
1 parent cda7f5e commit 104d906

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

vsintegration/src/FSharp.Editor/Completion/CompletionService.fs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ type internal FSharpCompletionService
5151
.WithDismissIfLastCharacterDeleted(true)
5252
.WithDefaultEnterKeyRule(enterKeyRule)
5353

54-
///// Indicates the text span to be replaced by a committed completion list item.
55-
//override _.GetDefaultCompletionListSpan(sourceText, caretIndex) =
56-
// let documentId = workspace.GetDocumentIdInCurrentContext(sourceText.Container)
57-
// let document = workspace.CurrentSolution.GetDocument(documentId)
58-
// let defines = projectInfoManager.GetCompilationDefinesForEditingDocument(document)
59-
// CompletionUtils.getDefaultCompletionListSpan(sourceText, caretIndex, documentId, document.FilePath, defines)
54+
/// Indicates the text span to be replaced by a committed completion list item.
55+
override _.GetDefaultCompletionListSpan(sourceText, caretIndex) =
56+
let documentId = workspace.GetDocumentIdInCurrentContext(sourceText.Container)
57+
let document = workspace.CurrentSolution.GetDocument(documentId)
58+
let defines = projectInfoManager.GetCompilationDefinesForEditingDocument(document)
59+
let itemSpan = CompletionUtils.getCompletionItemSpan sourceText caretIndex
60+
TextSpan.FromBounds(itemSpan.Start, itemSpan.End)
6061

6162
type internal FSharpCompletionSource
6263
(textView: ITextView, checkerProvider: FSharpCheckerProvider, projectInfoManager: FSharpProjectOptionsManager, assemblyContentProvider: AssemblyContentProvider) =

vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ module internal CompletionUtils =
3535
// identifier-start-character:
3636
// letter-character
3737
// _ (the underscore character U+005F)
38-
39-
if ch < 'a' then // '\u0061'
38+
if ch = '#' then
39+
true
40+
elif ch < 'a' then // '\u0061'
4041
if ch < 'A' then // '\u0041'
4142
false
4243
else ch <= 'Z' // '\u005A'

vsintegration/src/FSharp.Editor/VSMac/InteractivePad.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,9 @@ type InteractiveCommand(command) =
423423

424424
override x.Run() =
425425
FSharpInteractivePad.Fsi
426-
|> Option.iter (fun fsi -> command fsi
427-
FSharpInteractivePad.BringToFront(false))
426+
|> Option.iter (fun fsi ->
427+
FSharpInteractivePad.BringToFront(false)
428+
command fsi)
428429

429430
type FSharpFileInteractiveCommand(command) =
430431
inherit InteractiveCommand(command)

0 commit comments

Comments
 (0)