Skip to content
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

Better lexer symbol #2056

Merged
merged 5 commits into from
Dec 20, 2016
Merged

Conversation

vasily-kirichenko
Copy link
Contributor

This code is (partially) ported from VFPT and it's main goal is to find proper range of a symbol at position. The previous implementation was buggy, it returned wrong ranges for operators and type parameters.

/// Gets the value associated with the option or the supplied default value.
let inline getOrElse v = function
| Some x -> x | None -> v

/// Gets the option if Some x, otherwise try to get another value
let inline orTry f =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are in the FSharp.Core now, right? (just as possible optimization)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No they are not. I could not compile without these helpers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird. thanks for checking

@KevinRansom
Copy link
Member

@dotnet-bot test this please

@KevinRansom
Copy link
Member

The options module has some additions, the names are a bit different from the ones you used:

I think getOrElse becomes defaultValue :

https://github.com/Microsoft/visualfsharp/blob/master/src/fsharp/FSharp.Core/option.fs#L19

I think orTry looks like orElseWith

https://github.com/Microsoft/visualfsharp/blob/master/src/fsharp/FSharp.Core/option.fs#L28

Hope this helps

Kevin

remove Pervasive.fs
@vasily-kirichenko
Copy link
Contributor Author

Done.

@KevinRansom
Copy link
Member

Thanks for taking care of this

Kevin

@KevinRansom KevinRansom merged commit c33411b into dotnet:master Dec 20, 2016
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
* port lexer symbol lookup logic from VFPT and use it in DocumentHighlightsService

* QuickInfoProvider uses lexer symbol

* remove tryClassifyAtPosition

* do not show quick info if FCS return a list of single FSharpTooltipElement.None

* use standard Option combinators

remove Pervasive.fs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants