Skip to content

Conversation

@vasily-kirichenko
Copy link
Contributor

This partially fixes #3937

image

Copy link
Contributor

@saul saul left a comment

Choose a reason for hiding this comment

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

Looks great. Any chance we could add a test for this?

@vasily-kirichenko
Copy link
Contributor Author

@dotnet-bot test Windows_NT Release_ci_part1 Build please

@vasily-kirichenko vasily-kirichenko changed the title [WIP] Better completion Better completion Nov 15, 2017
@vasily-kirichenko
Copy link
Contributor Author

It's ready.

@cartermp
Copy link
Contributor

Interestingly, I get a value suggested as the type when I first type the parameter type name, but if I go back, it's not there (testing on a .NET Core console app):

stringy

@vasily-kirichenko
Copy link
Contributor Author

There is no ast until you close the paren. This is the same problem as with attributes completion - it suggests full type name until you close >]

@cartermp
Copy link
Contributor

cartermp commented Nov 16, 2017

Yeah, just debugged this and noticed it 😄 . I suppose we can file that as a future problem to tackle. This looks good!

@vasily-kirichenko
Copy link
Contributor Author

I’m not sure we can solve this problem without improving the parser. And i’m not sure it could be improved :)

| AttributeApplication
| OpenDeclaration
/// completing pattern type (e.g. foo (x: |))
| PatternType
Copy link
Contributor

@cartermp cartermp Nov 16, 2017

Choose a reason for hiding this comment

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

Should this be named ParameterTypeAnnotation or TypeAnnotation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like TypeAnnotation would be the better candidate of my two suggestions since it is also hit here:

let foo (s: string): ^

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, this is for xx: type at any place, not just for parameters. And this thing is called pattern I think.

Copy link
Contributor

@cartermp cartermp Nov 16, 2017

Choose a reason for hiding this comment

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

Hmm, I think what you're referring to is the patterns that have type annotations, so PatternWithTypeAnnotation would be the name I'd think of here. That may have been what you meant, but when I read PatternType I thought it was referring to a completion context which constituted a pattern of any kind.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe Pattern refers to the bound pattern (when deconstructing a DU, a tuple, a record, etc.) and Type to the type annotation.

let foo ((Some s): string option) = ...

parameter can be a simple symbol but also can be a pattern.

@vasily-kirichenko
Copy link
Contributor Author

Ooookey, it's ready.

Copy link
Contributor

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

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

Thank you for this.

@KevinRansom KevinRansom merged commit 39d8459 into dotnet:master Nov 19, 2017
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.

Completion should filter non-type items when a type is expected

5 participants