Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light up method tupled parameters #1140

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 12 additions & 8 deletions src/FsAutoComplete.Core/InlayHints.fs
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,9 @@ let provideHints
parameterHints.Add hint

| :? FSharpMemberOrFunctionOrValue as methodOrConstructor when
hintConfig.ShowParameterHints && methodOrConstructor.IsConstructor
-> // TODO: support methods when this API comes into FCS
hintConfig.ShowParameterHints
&& (methodOrConstructor.IsMethod || methodOrConstructor.IsConstructor)
->
let endPosForMethod = symbolUse.Range.End
let line, _ = Position.toZ endPosForMethod

Expand All @@ -995,13 +996,17 @@ let provideHints
methodOrConstructor.CurriedParameterGroups |> Seq.concat |> Array.ofSeq // TODO: need ArgumentLocations to be surfaced

for idx = 0 to parameters.Length - 1 do
// let paramLocationInfo = tupledParamInfos.ArgumentLocations.[idx]
let paramLocationInfo = tupledParamInfos.ArgumentLocations.[idx]
let param = parameters.[idx]
let paramName = param.DisplayName

// if shouldCreateHint param && paramLocationInfo.IsNamedArgument then
// let hint = { Text = paramName + " ="; Pos = paramLocationInfo.ArgumentRange.Start; Kind = Parameter }
// parameterHints.Add(hint)
if
ShouldCreate.paramHint methodOrConstructor param paramName
&& paramLocationInfo.IsNamedArgument
then
let hint = createParamHint paramLocationInfo.ArgumentRange paramName
parameterHints.Add(hint)

()

// This will only happen for curried methods defined in F#.
Expand All @@ -1018,8 +1023,7 @@ let provideHints
Some(definitionArgs.[i], v)
else
None)
|> Array.filter Option.isSome
|> Array.map Option.get
|> Array.choose id

for (definitionArg, appliedArgRange) in parms do
let! appliedArgText = text[appliedArgRange]
Expand Down
Loading