diff --git a/src/Ionide.ProjInfo/Library.fs b/src/Ionide.ProjInfo/Library.fs index bf609f8..9c2efb3 100644 --- a/src/Ionide.ProjInfo/Library.fs +++ b/src/Ionide.ProjInfo/Library.fs @@ -742,6 +742,10 @@ module ProjectLoader = Name = name FullPath = fullPath Link = link + Metadata = + p.Metadata + |> Seq.map (fun pm -> pm.Name, pm.EvaluatedValue) + |> Map.ofSeq } ) @@ -1587,7 +1591,7 @@ module ProjectViewer = sources |> List.choose ( function - | ProjectItem.Compile(name, fullPath) -> Some(name, fullPath) + | ProjectItem.Compile(name, fullPath, _) -> Some(name, fullPath) ) |> List.filter (fun (_, p) -> includeSourceFile p) diff --git a/src/Ionide.ProjInfo/Types.fs b/src/Ionide.ProjInfo/Types.fs index ec1af26..7c92a04 100644 --- a/src/Ionide.ProjInfo/Types.fs +++ b/src/Ionide.ProjInfo/Types.fs @@ -48,7 +48,7 @@ module Types = | Exe | Custom of string - type ProjectItem = Compile of name: string * fullpath: string + type ProjectItem = Compile of name: string * fullpath: string * metadata: Map option type ProjectOptions = { ProjectId: string option @@ -75,10 +75,37 @@ module Types = member x.ResolvedTargetPath = defaultArg x.TargetRefPath x.TargetPath + /// Represents a `` node within an fsproj file. type CompileItem = { + /// The `Compile` node's Include contents, after MSBuild has finished evaluation. + /// For example: + /// * `` would have this set to "Foo.fs"; + /// * `` would have `"Bar/Baz.fs"`; + /// * (contrived): `` might have `true.fs` or `false.fs`, for example. Name: string + /// Full path on disk to the F# file this `Compile` node is telling MsBuild to compile. FullPath: string + /// Value of the `` sub-node, if one exists. + /// For example, `../bar.fshello` sets the metadata key "Something" to the value "hello". + /// * `` fails at project load time. + /// * `` sets the metadata key "Blah" to the empty string. + /// * `` sets the metadata key "Blah" to the string "". + /// + /// This map includes the `Link` value, if it exists, which was also extracted for convenience into the `Link` field + /// of this CompileItem. + /// + /// If you specify the same metadata key multiple times, the last value wins. (This is MsBuild's decision, not ours.) + Metadata: Map } type ToolsPath = ToolsPath of string diff --git a/src/Ionide.ProjInfo/VisualTree.fs b/src/Ionide.ProjInfo/VisualTree.fs index d3c9aab..f5fa517 100644 --- a/src/Ionide.ProjInfo/VisualTree.fs +++ b/src/Ionide.ProjInfo/VisualTree.fs @@ -75,11 +75,11 @@ module VisualTree = projPath |> getVisualPath None (Some sourceFile) sourceFile - ProjectItem.Compile(name, fullpath) + ProjectItem.Compile(name, fullpath, None) | Some p -> let (name, fullpath) = projPath |> getVisualPath p.Link (Some p.FullPath) p.Name - ProjectItem.Compile(name, fullpath) + ProjectItem.Compile(name, fullpath, Some p.Metadata)