Skip to content

Add inferred type hint stage #1

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

Closed
wants to merge 111 commits into from

Conversation

saul
Copy link
Owner

@saul saul commented Apr 2, 2020

image

@vasily-kirichenko
Copy link

Cool!

What about using the main editor font for type hints? See how Scala plugin do it (note that it uses the small non-monospaced font for parameter names):

image

It looks much better because it does not look like alien additions, but as natural code, just like if it were written by hand (but gray).

@vasily-kirichenko
Copy link

Also, Scala plugin "folds" long type hints. When you click on the "...", it expands one level, when you go to some other code, it automatically fold it again:

1

@saul
Copy link
Owner Author

saul commented Apr 3, 2020

Unfortunately Rider doesn’t (yet) support rich text hints or click interactivity, so the style must stay as it is now.

Copy link

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

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

@saul It looks really great, thank you!

| :? ILocalBinding as localBinding when localBinding.ReturnTypeInfo <> null -> ()
| _ ->

match localRefPat.Identifier.As<FSharpIdentifierToken>() with

Choose a reason for hiding this comment

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

This is fine and is used in some places already, though, I'm trying to shape up some API for easier getting the identifier. Something like the following could work well too.
NameIdentifier may be compound here, like for active patterns or type parameters.

if isNull localRefPat.NameIdentifier.IdentifierToken then () else

| null -> ()
| symbolUse ->

let symbolUse = symbolUse :?> FSharpSymbolUse

Choose a reason for hiding this comment

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

I think I should really add an overload taking a properly typed outref parameter here. :)

saul and others added 19 commits April 29, 2020 09:50
* Update InferredTypeCodeVisionProvider.fs

* Split into PipeChainCodeVisionProvider

* Create Multi line.fs.gold

* Hook into the tooltip for the |> operator

* Update Multi line.fs.gold

* Add TypeHintsAdornmentProvider

* Update TypeHintsAdornmentProvider.fs

* Update TypeHintsAdornmentProvider.fs

* Markups

* Update TypeHintsAdornmentProvider.fs

* Add more tests

* Add new lines

* Add setting

* Update TypeHintAdornmentStage.fs

* Add option to 'Hide when |> is on same line as argument'

* Invalidate highlighting on type hint setting change

* Update TypeHintAdornmentStage.fs

* Update TypeHintAdornmentStage.fs

* Use {HideSameLine:All} in tests

* Reorganisation

* Delete ReSharper.FSharp.sln.DotSettings.user

* Code style

* More code style changes

* Markups
…pat-hints

# Conflicts:
#	ReSharper.FSharp/src/FSharp.Common/src/Settings/FSharpOptions.fs
#	ReSharper.FSharp/src/FSharp.Psi.Features/FSharp.Psi.Features.fsproj
#	ReSharper.FSharp/test/src/FSharp.Tests/FSharp.Tests.fsproj
…ref-pat-hints"

This reverts commit f26344d, reversing
changes made to 008009b.
The initial name comes from Ast.SynExpr used in FCS for syntax tree
expressions nodes. F# PSI expressions were initially made to have an
identical structure to the FCS ones and having similar names helped too.
Over the time F# PSI expression nodes have changed and no longer
correspond to the FCS expression structure closely.
Having names similar to ReSharper ones seems to be better at this point.
* Change grammar rules for enum declaration

* Add alignment rules

For match clauses, union cases, enum cases and seq expressions

* Add rule for binary expr alignment

* Add tests for alignment rules

* Add tests for ToRecursive actions

* Add more tests for seq expr

* Add indenting rules for match expressions

* Mark union case list, add indenting rule for cases in union representation

* Add alignment rule for union representation node

* Remove unnecessary check for modifier
* StaticSeverityHighlighting
* RegisterHighlighterGroup
* RegisterHighlighter
* JetBrains.Application.UI.Icons.Images.TiImage -> JetBrains.Util.Icons.TiImage
* CodeFormatterBase
* FormatterInfoProviderWithFluentApi
* IHighlightingsCleanupItem
auduchinok and others added 28 commits June 2, 2020 17:05
* Listen to PSI changes instead of project model
* Mark modules to invalidate dirty, don't process during the change
* Store references to module to invalidate when creating FCS project
* Rename FSharpProjectOptionsProvider -> FcsProjectProvider
* Rename FSharpProjectOptionsBuilder -> FcsProjectBuilder
* Move element factory to FSharp.Psi
* Cleanup utils
Splitting back to separate parameters would be great,
but it also needs support for abstract members and accessors
* WIP improve reactor monitor

* Add trace scenario, add busy delay registry setting

* Oops

* Remove unused type

* Markups

* Fix dodgy rebase

* Monitor more operations
* Cover SynType.Paren
* Fix indexer arg range
@saul saul closed this Jun 11, 2020
@Stephan-C
Copy link

Stephan-C commented Nov 23, 2021

I see this PR is now here: JetBrains#118

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.

7 participants