Make analysis server/IDEs show the distinction between fields and getters accurately and consistently #55956
Labels
analyzer-lsp
Issues with analysis server's support of Language Server Protocol
analyzer-server
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
In Dart-Code/Dart-Code#5011 it was highlighted that in some places in VS Code (via LSP) we are inconsistent about when we map things to a "Property" kind vs a "Field" kind. In some places (for example code completion) we use "Field" where the static type has an implicit getter that just points at a field, but in others (like semantic tokens) we do not.
We feel the right thing to do here is to follow the language accurately, so when something is a reference to a getter, we should always show it as such (a "Property" in LSP) even if in the static type it's just a field. Showing something as a Field is inconsistent with the spec and could lead to incorrect assumptions (since it could actually be an overridden getter at runtime).
For LSP, this means we should only map to the "Field" kinds for actual references to fields (like constructor initializers, field formals, and the field declaration in something like document outline) and other places (semantic tokens, hovers, code completion) should use "Property".
(@jwren I suspect all changes here are either LSP-specific, or in base server functionality that will be updated in order to fix this for LSP, but FYI just in case there might be things in the IntelliJ plugin that might need reviewing).
(fyi @bwilkerson @stereotype441)
The text was updated successfully, but these errors were encountered: