Skip to content

Commit de6092e

Browse files
dawedawenojaf
authored andcommitted
Use GetText() to get original attributes from impl file.
1 parent 9713991 commit de6092e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

ReSharper.FSharp/src/FSharp.Psi.Services/src/Generate/GenerateSignatureProvider.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ type FSharpGenerateSignatureBuilder() =
177177
if isNotNull symbolUse then
178178
let mfv = symbolUse.Symbol :?> FSharpMemberOrFunctionOrValue
179179

180-
mfv.Attributes
181-
|> Seq.iter (fun a -> sb.Append($"{a.Format(symbolUse.DisplayContext)}{lineEnding}") |> ignore)
180+
binding.Attributes
181+
|> Seq.iter (fun a -> sb.Append($"[<{a.GetText()}>]{lineEnding}") |> ignore)
182182

183183
sb.Append("val ") |> ignore
184184
sb.Append(binding.HeadPattern.GetText()) |> ignore

ReSharper.FSharp/test/data/features/generate/signatureFiles/Module structure 02.fs

+4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ let c = Math.PI
77
let d = 23
88
let e = "bar"
99
let f x y = x * y
10+
[<BAttribute(MyEnum.A)>]
1011
[<System.Obsolete "foo">]
1112
[<System.NonSerialized>]
1213
let g x = x
14+
let [<Literal>] Hello = "Hello"
15+
[<CompiledName(Hello)>]
16+
let hello = 1
1317
{caret}

ReSharper.FSharp/test/data/features/generate/signatureFiles/Module structure 02.fs.gold

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ val c: float
88
val d: int
99
val e: string
1010
val f: int -> int -> int
11-
[<Obsolete ("foo")>]
12-
[<NonSerialized>]
13-
val g: 'a -> 'a
11+
[<BAttribute(MyEnum.A)>]
12+
[<System.Obsolete "foo">]
13+
[<System.NonSerialized>]
14+
val g: 'a -> 'a
15+
[<Literal>]
16+
val Hello: string
17+
[<CompiledName(Hello)>]
18+
val hello: int

0 commit comments

Comments
 (0)