WinMerge / winmerge

WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
https://winmerge.org/
GNU General Public License v2.0
6.07k stars 775 forks source link

Improved F# parsing, support for multi-line comments #2301

Closed Thorium closed 2 months ago

Thorium commented 2 months ago

Effort to improve current initial F# parsing, support for multi-line comments. ParseLineCJava was used as base for ParseLineFSharp.

sdottaka commented 2 months ago

Thank you for the PR. However, block comments were not colored correctly, so I fixed it in commit 131a7e2. Also, as shown in the image below, it seems that there are improvements to be made, such as not supporting F#'s raw string literal, so I would appreciate it if you could fix it when you have time.

image

Thorium commented 2 months ago

I'm often using WinMerge to compare F# code files, IMO WinMerge does the 2-way comparison better than e.g. KDiff. I think this kind of basic F# syntax highlighting is very nice addition already.

But I think it's not worth of implementing full F# parser independently: Lot of F# development relies on tooltips (check e.g. here), the compiler telling you the types. That is typically done in editors by referencing F# compiler service which parses the F# for you. As general IDE, I don't think WinMerge will want this dependency, people will probably not use WinMerge as primary F# editor anyway.

Rather than creating all parsers separately, in general one possible better long-term future addition for WinMerge could be supporting tree-sitter. That would make it easier to parse any programming language and having big community effort behind (and there is also tree-sitter for F#).

Thorium commented 2 months ago

I tried to add raw string literal support https://github.com/Thorium/winmerge/commit/1cf5458d6fe19c9f4cd81408a8b50b0fec9eae59 but it's not working... I have to say my C++ is a little bit rotten as I've not used it in last 25 years.