Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
* Parser: fix pattern range for idents with trivia ([PR #16824](https://github.com/dotnet/fsharp/pull/16824))
* Fix broken code completion after a record type declaration ([PR #16813](https://github.com/dotnet/fsharp/pull/16813))
* Enforce AttributeTargets on enums ([PR #16887](https://github.com/dotnet/fsharp/pull/16887))
* Completion: fix for unfinished record field decl ([PR #16893](https://github.com/dotnet/fsharp/pull/16893))
* Enforce AttributeTargets on delegates ([PR #16891](https://github.com/dotnet/fsharp/pull/16891))


### Added

* The stackguard depth for ILPdbWriter.unshadowScopes can be modified via the environment variable `FSHARP_ILPdb_UnshadowScopes_StackGuardDepth`([PR #16583](https://github.com/dotnet/fsharp/pull/16583))
Expand Down
7 changes: 4 additions & 3 deletions src/Compiler/Service/ServiceParsedInputOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1646,11 +1646,12 @@ module ParsedInput =

member _.VisitRecordDefn(_, fields, range) =
fields
|> List.tryPick (fun (SynField(idOpt = idOpt; range = fieldRange)) ->
match idOpt with
| Some id when rangeContainsPos id.idRange pos ->
|> List.tryPick (fun (SynField(idOpt = idOpt; range = fieldRange; fieldType = fieldType)) ->
match idOpt, fieldType with
| Some id, _ when rangeContainsPos id.idRange pos ->
Some(CompletionContext.RecordField(RecordContext.Declaration true))
| _ when rangeContainsPos fieldRange pos -> Some(CompletionContext.RecordField(RecordContext.Declaration false))
| _, SynType.FromParseError _ -> Some(CompletionContext.RecordField(RecordContext.Declaration false))
| _ -> None)
// No completions in a record outside of all fields, except in attributes, which is established earlier in VisitAttributeApplication
|> Option.orElseWith (fun _ ->
Expand Down
9 changes: 8 additions & 1 deletion tests/service/CompletionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ let ``Underscore dot lambda - method completion`` () =
let myFancyFunc (x:string) =
x
|> _.ToL"""
assertHasItemWithNames ["ToLower"] info
assertHasItemWithNames ["ToLower"] info

[<Test>]
let ``Type decl - Record - Field type 01`` () =
let info = getCompletionInfo "type Record = { Field: }" (2, 23) """
type Record = { Field: }
"""
assertHasItemWithNames ["string"] info