Skip to content

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Mar 12, 2018

Attempts to fix #4488, and documents the code a bit more. However this doesn't address the issue fsharp/fsharp-compiler-docs#830, which is "hard".

Things fixed:

  1. This use of Seq.cache was faulty, since it was returned at the end of a property, meaning the cache was never actually effective

Thing improved:

  1. Use a hash instead of an array for the sub-contents of an opened thing
  2. cleanup

I can't test this properly until #4496 is fixed.

@dsyme
Copy link
Contributor Author

dsyme commented Mar 12, 2018

I have manually checked this using F5 from VisualFSharp.sln and the performance is ok.

  • Editing in IlxGen.fs gives red-squiggly updates in a couple of seconds, which is as good as it gets

So this is ready once green (I need to make sure it continues to pass @vasily-kirichenko's original unussed-open tests)

@dsyme
Copy link
Contributor Author

dsyme commented Mar 12, 2018

OK, this is ready

@dsyme
Copy link
Contributor Author

dsyme commented Mar 12, 2018

@auduchinok Could you review please?

// extension members should be taken into account even though they have a prefix (as they do most of the time)
// Extension members should be taken into account even though they have a prefix (as they do most of the time)
true
| _ ->
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to filter out more symbol uses here? All local values, parameters and type parameters could be filtered out before calling QuickParse methods and getting document line strings. Symbol bindings could also be filtered but there're several known cases where a symbol use is considered as binding even though it's from a usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, absolutely, good feedback , thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

let filterOpenStatements symbolUses openStatements =
async {
let! results = filterOpenStatementsIncremental symbolUses openStatements [] []
return results |> List.map (fun os -> os.Range)
Copy link
Member

@auduchinok auduchinok Mar 12, 2018

Choose a reason for hiding this comment

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

This comment isn't about the PR itself but is about ranges this feature deals with.
I'd in favour of having SynMemberDefn.Open tree nodes here (and other similar cases where a range is returned to a client) instead of lid ranges if these nodes had ranges of the whole expressions instead of its long identifiers. Furthermore, it'd be great if other declarations (namespace, type, etc) ranges included starting keywords (or even pointed to a token pos) so the range was the actual range of the declaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense (but yes, is orthogonal)

Copy link
Contributor

Choose a reason for hiding this comment

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

This #4106 is related. We should have discussions about that in there.

Also, SynMemberDefn.Open doesn't seem to be used anywhere that I can find in VisualFSharp.

Copy link
Member

Choose a reason for hiding this comment

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

@TIHan we use it in Rider along with other types from AST.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correction, I don't see SymMemberDefn.Open being constructed in VisualFsharp.

Copy link
Member

Choose a reason for hiding this comment

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

@TIHan it looks I copied the wrong type name in the first message. It should have been SynModuleDecl.Open, thank you.

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

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

Giving "experience check" approval. I think we should take this instead of #4494

@dsyme
Copy link
Contributor Author

dsyme commented Mar 14, 2018

OK, then this is ready to merge into master (and then will get merged into dev15.7 as normal)

@cartermp
Copy link
Contributor

@TIHan can you give this a review? We definitely want to get this into the 15.7 branch and line it up for Preview 3

@cartermp cartermp requested a review from TIHan March 14, 2018 18:00
@KevinRansom KevinRansom merged commit 179f3c4 into dotnet:master Mar 17, 2018
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.

Unused Opens Diagnostic analyser is very slow in large files

5 participants