Branch: refs/heads/main
Revision: 29ce7205d039288bf973cf58b3a1b8188595023b
Author: DanilaFe
Link: CLS: suppress obvious type/param inlays by DanilaFe · Pull Request #28660 · chapel-lang/chapel · GitHub
Log Message:
CLS: suppress obvious type/param inlays (#28660)
Ran copilot in the background while doing other things to get this PR.
The changes look solid. Closes #28581.
When a type variable's init expression a "type literal" (e.g. type t = int(64)) or a param variable's init expression is a literal matching
its value (e.g. param x = 1, param b = true), the inlay hints are
redundant and are now suppressed.
I suggested that the best approach would be to hide inlays precisely
when they match the RHS. So, type T = int(64) doesn't get an inlay
(since it would match exactly), but an inlay for type T = int does
show up, since a user might not know the default integer width is 64.
I've implemented this including type constructors (see tests; type A = list(int, /* parSafe */ false) doesn't get an inlay).
@jabraham17 said, however, that their original frustration was
specifically with cases where type T = int got inlays. So, behind an
additional flag, I added support for furthermore hiding inlays that
correspond to default instantiations (e.g., type T = range and type T = int).
Reviewed by @jabraham17 -- thanks!
Testing
- CLS tests
Diff:
M doc/rst/tools/chpl-language-server/chpl-language-server.rst
M tools/chapel-py/src/method-tables/type-methods.h
M tools/chapel-py/src/method-tables/uast-methods.h
M tools/chapel-py/src/resolution.cpp
M tools/chapel-py/src/resolution.h
M tools/chpl-language-server/src/chpl-language-server.py
M tools/chpl-language-server/src/lsp_util.py
M tools/chpl-language-server/test/param_inlays.py
M tools/chpl-language-server/test/type_inlays.py
https://github.com/chapel-lang/chapel/pull/28660.diff