Add support for F# package reference + Fix CommentPreproc detection #631
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
Disclaimer: I am new to Go, so I am unsure if what I did is all that is needed
This PR adds support for package reference syntax
#r "nuget: PacakgeName"
.https://docs.microsoft.com/en-us/dotnet/fsharp/tools/fsharp-interactive/#referencing-packages-in-f-interactive
In order, to have the package reference syntax working I had to move the
CommentPreproc
rule before theOperator
.I believe this is because inside of the
Operator
there is a match for#
char which was preventing theCommentPreproc
rule to handle it.I also needed to no greedly capture the whole line to end otherwise it was capture the whole line as
CommentPreproc
instead of a mix ofCommentPreproc
andLiteralString
for example.instead of
Because, I found it to be a dangerous change I decided to add "complex" F# code to serves as a base reference to check that I didn't break anything by mistakes.
The "complex" F# code has been added inside the file
lexers\testdata\fsharp\fsharp.actual
. That file is a copy coming from https://github.com/ionide/ionide-fsgrammar/blob/master/sample-code/SimpleTypes.fs which is a really robust reference as it is used since 5+ years as a base for the VSCode grammar testing.If you look at this commit a3b894e you can see that my changes only impacted the wrongly highlighted
CommentPreproc
.It changes from an invalid
Operator
detection to aCommentPreproc
.