Skip to content

Conversation

@cartermp
Copy link
Contributor

I'm not sure if this is a good solution, but this does fix #2473. I can now do a full Suave app by using codefixes with this change:

ops-lightbulbs

@smoothdeveloper
Copy link
Contributor

Pretty cool :)

@smoothdeveloper
Copy link
Contributor

Did you intend to change System.ValueTuple.dll in this PR?

@cartermp
Copy link
Contributor Author

@smoothdeveloper No...hmmm. Maybe that's because I ran build vs prior to making the PR?

@cartermp
Copy link
Contributor Author

Rebased that change away. I think I used git commit -am and it got pulled in.


let quilifySymbolFixes =
candidates
|> Seq.filter (fun (entity,_) -> not(entity.FullRelativeName.Contains("op_"))) // Don't include fully-qualified operator names. The resultant suggestion makes the code not compile.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe StartsWith? Is there another way we can verify this is an actual operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified. I'm not aware of another way (although I imagine there's something in the language service which we could use).

openNamespaceFix context ctx name ns multipleNames)
|> Seq.toList

let quilifySymbolFixes =
Copy link
Contributor

Choose a reason for hiding this comment

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

time to fix that typo :)

openNamespaceFix context ctx name ns multipleNames)
|> Seq.toList

let quilifySymbolFixes =
Copy link
Contributor

Choose a reason for hiding this comment

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

time to fix that typo :)

@cartermp
Copy link
Contributor Author

omg I'm bad at git and comitted the freaking binary again

let quilifySymbolFixes =
let qualifiedSymbolFixes =
candidates
|> Seq.filter (fun (entity,_) -> not(entity.FullRelativeName.StartsWith("op_"))) // Don't include qualified operator names. The resultant codefix won't compile because it won't be an infix operator anymore.
Copy link
Contributor

Choose a reason for hiding this comment

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

FullRelativeName can be "M.N.op_xxx", so this filtering won't work for those.

Copy link
Contributor

Choose a reason for hiding this comment

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

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@cartermp cartermp Feb 23, 2017

Choose a reason for hiding this comment

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

👍, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we somehow say StartsWith "op_" || Contains ".op_"?

I'm not at ease with idea of removing the quick fix for members containing op_ to not work.

Right now in VS2015:

image

If there is a way to figure that out without string, that would be best but I guess for now we can have that enhanced condition.

@cartermp
Copy link
Contributor Author

It works perfectly thanks to @vasily-kirichenko's commit. Ready for merge!

@cartermp
Copy link
Contributor Author

My cat isn't letting me GitHub efficiently
kitty

@KevinRansom KevinRansom merged commit bac94be into dotnet:master Feb 23, 2017
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
* Trigger add open for FS0043

* Contains -> StartsWith

* fixed: AddOpenCodeFixProvider may suggest name qualifying for operators
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.

Add Open Codefix does not work for operators

5 participants