Skip to content

Provide FSharpParameter with its correct list of FSharpAttributes #15925

@baronfel

Description

@baronfel

Is your feature request related to a problem? Please describe.

I was implementing nested-language support in FSAC by checking if parameters of methods are decorated with System.Diagnostics.CodeAnalysis.StringSyntaxAttribute, and I was doing this by

  • getting the ident for the method being called
  • getting the symbol use for that ident
  • getting the member, function, or value for that symbol use
  • investigating the parameter list for that MFV
  • checking the attributes on the parameter in the correct position

However, FSharpParameter seems to always have an empty .Attributes member, as shown in

// INCOMPLETENESS: Attribs is empty here, so we can't look at attributes for
// either .NET or F# parameters
let argInfo: ArgReprInfo = { Name=nmOpt; Attribs=[]; OtherRange=None }
and a few lines below.

Describe the solution you'd like

I'd like .Attributes to have the list of attributes for that parameter, or have a method that could be called to lazily-calculate the list if that would increase memory usage too much.

Describe alternatives you've considered

Some horrific hacking to use reflection-only loads to try and load and investigate the matching parameter.

Additional context

Here's the tracking issue in Ionide for adding this nested-language feature: ionide/ionide-vscode-fsharp#1912

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions