snuup / FSharp-File-Structure-for-Visual-Studio

Visual Studio Extension for VS 2019 that provides a File Structure Toolwindow for F#
22 stars 3 forks source link

Incomplete file structure when using string interpolation #3

Closed OkkeHendriks closed 3 years ago

OkkeHendriks commented 3 years ago

Using string interpolation breaks the shown structure, all 'entries' after the first string interpolation are omitted.

Before:

(*--------------------------------------------------------------------------------------------------------------------*)
module FileStructureExample

type typeA = string

let functionA argumentA = printfn argumentA

type typeB = string

let functionB argumentB = printfn argumentB

Correctly shows: image

Adding let breakit = $"" after functionA (or somewhere else) breaks it:

module FileStructureExample

type typeA = string

let functionA argumentA = printfn argumentA

let breakit = $""

type typeB = string

let functionB argumentB = printfn argumentB

Notice the missing typeB and functionB: image

snuup commented 3 years ago

thank you for the detailed report. if anyone wants to contribute and takes care of this I would assist how to do it.

OkkeHendriks commented 3 years ago

Hi! I am willing to have a look.

I noticed that you do not depend on the FSharp.Compiler.Services NuGet package, but you perform the manual step described in the readme. However, other extensions seem not to do this (example).

They do include the VSIXSignTool NuGet, I assume they use this to sign the vsix file before publishing as described here?

a day later...

I had a look and simply tried to use NuGet packages and updated FSharp.Compiler.Services to 40.0.0 and FSharp.Core to 5.0.2 and fixed it up so it would compile again, see my fork. Immediately the bug mentioned in this issue seems to be solved...

What I do not totally understand though is the isMarkedAsInterface function. When is it supposed to mark something as being an interface module/member/etc.? In case is a manual xmldoc comment added?

I could add a an alternative which checks if there are only abstract members defined, see https://github.com/OkkeHendriks/FSharp-File-Structure-for-Visual-Studio/commit/2045cda446a5dabd44b5279b7e6277cf62f4a4be. But this seems a bit fragile, and I am not sure if i caught all cases here.

thulka commented 3 years ago

Hi @OkkeHendriks

thank you for your fruitful efforts, you hit very good points. i will be happy to merge your work as pull request, and would also add you as a contributor in this repo if you accept,

about the "ismarkedinterface" case: you hit an easter egg ;) as far as i remember it started out with the idea that i want to highlight interfaces inside the toolwindow. i soon switched the idea and just use the second case of the condition where the comment string is tested for "". this allows to highlight an item by setting a comment starting with "". its really flashy orange then. this helps me quickly identifying the function i work on. the name of this function is unlucky, it should be called "ishighligted". and this should be documented, so others can use it and contributors don't wonder about.

OkkeHendriks commented 3 years ago

No problem 😄 I created a PR. As I mention there also, there is still the 'issue' of signing it.

thulka commented 3 years ago

well if no better solution can be found i would to it as before, with ildasm and self signing. at the moment i am busy not sure when I can take a look into it.