You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normally these are just headers, but in principle, one can include any files at all.
Together, these would make Go to Definition from the #include to the included file work.
We should avoid emitting redundant definitions for the same file.
It's not super clear what the source location for the definition should be. I can't recall if there is a way to encode a reference to a file instead of a specific source range in the file.
If the former is possible, we should do that.
If a specific source range is needed, that makes it trickier; I can't think of a way to pick a non-empty range off the top of my head that works reliably and gives intuitive results. Picking an empty range is an option.
Note that you can't get a Code Intel popover with Find References for a file if we don't pick a source range (or use an empty range); you'd have to do a text search like #include .*MyFile\.myext, which is a little unfortunate. As an approximate solution, perhaps we should use the first line if it is blank or a comment?
Supporting Go to Definition from #include directives was flagged as a customer issue. They didn't flag Find References specifically.
For context, we do support this functionality for imports in Go today.
.
Go has explicit package declarations, which nicely resolves the issue of Find References.
We should emit:
#includedirectives.Normally these are just headers, but in principle, one can include any files at all.
Together, these would make Go to Definition from the
#includeto the included file work.Note that you can't get a Code Intel popover with Find References for a file if we don't pick a source range (or use an empty range); you'd have to do a text search like
#include .*MyFile\.myext, which is a little unfortunate. As an approximate solution, perhaps we should use the first line if it is blank or a comment?Supporting Go to Definition from
#includedirectives was flagged as a customer issue. They didn't flag Find References specifically.For context, we do support this functionality for imports in Go today.
Go has explicit
packagedeclarations, which nicely resolves the issue of Find References.