-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add range to MarkdownParagraph and MarkdownSpan #411
Conversation
It looks like you're storing the range exactly how I'd want in the datastructures, and passing around the codebase how I'd expect. Although: I hope you store range information solely with a character offset into the file. It feels like line/col information is derived from that. I suspect that a lot of book-keeping will be easier if the primary data structure is character-offsets. It's also how Roslyn does it :). (There'd probably be an additional datastructure generated during parsing which is the "character offset at which each line in the file starts", for an easy Presumably you're planning to add full range information next, i.e file-offset of both the start and end of each construct? I guess you'd have to start by abandoning It's a change that has lots of tendrils everywhere, isn't it?! |
@ljw1004 thanks about the comment I'm doing it as a thanks to your great job in Roslyn |
if starts |> Seq.exists (text.StartsWith) then Some() else None | ||
/// Matches when a string starts with the specified sub-string | ||
let (|StartsWith|_|) (start:string) (text:string) = | ||
let (|StartsWithS|_|) (start:string) (text:string) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the S
suffix on the active patterns is not very idiomatic. Could we instead have two modules, say String
and StringPosition
so that the patterns that work on string with position are all in StringPosition
module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry for the long delay - I finally had a look at this.
|
I don't have further technical comments, Avi, but just want to say how awesome it is that you're doing this. |
@tpetricek @ljw1004 Hi thanks for reviewing the code |
@@ -24,7 +24,7 @@ can be called to format snippets repeatedly: | |||
*) | |||
|
|||
let fsharpCompiler = Assembly.Load("FSharp.Compiler") | |||
let formattingAgent = CodeFormat.CreateAgent(fsharpCompiler) | |||
let formattingAgent = CodeFormat.CreateAgent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, is this a needed change for some reason? (Happy to delete the parameter if it's not needed, but then we should probably delete the whole line 26.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didnt removed the parameter from the method declaration when I looked at all scrpts to see if I need to change something I saw error on this line so I change it
@AviAvni Thanks very much for the revised version, it is a fantastic work! It's great to see how this is turning into a great F# Formatting improvement. I think we are almost there - I made a few more small suggestions, but I think this is now almost at a stage where we can merge the PR. I added a few nitpicking comments about the naming (because that's the bit which we cannot change once we merge the PR), but aside from that, there are really just smaller things. Thanks a lot for putting all the effort into this - it is a fairly big change, so I'm sorry it is taking that long, but once it's in, it will be an amazing improvement :) ❤️ |
+1 |
@tpetricek @ljw1004 thanks for the review I made the changes you asked The the issue of adding helper functions for manipulating MarkdownRange and ParsingContext any way I thought that after finish with this I'll try to implement the parser with parser combinator library then handling the ranges will lbe more simple so to me it doesn't matter thanks for helping and letting me do the implementation it's a great library |
This is now released as version @AviAvni Thank you very much for working on this (and for patience with me :-)) @ljw1004 It would be great if you could try the beta version and let us know if everything works as expected. The new version also has named fields on discriminated union cases, which might make the VS interop nicer. |
this is adding only the line to the range please review before adding more information
issue: #410
@tpetricek