Index an open document's global constants - #419
Draft
Firehed wants to merge 2 commits into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #419 +/- ##
=========================================
Coverage 98.61% 98.61%
- Complexity 1805 1806 +1
=========================================
Files 128 128
Lines 4534 4540 +6
=========================================
+ Hits 4471 4477 +6
Misses 63 63 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three of the four symbol backends can enumerate the constants in a namespace; the open-document one could not, because nothing ever put a constant into the index it reads. That is the same lookup-versus-enumeration split that made a
function_exists-guarded polyfill resolve on hover while being invisible to completion (SC.5) and dropped aclass_exists-guarded class out of open-document lookup (SC.9), on the one symbol namespace where it was still standing. S3.8b adds constant lookup next, so closing it now is what stops that landing on an enumeration with a hole in it.Slice SC.16. Plan step: 0002 Step 3b. RFC 1 §4.2, §5.1.
What changed
SymbolExtractoremitsSymbolKind::Constantfor the constantsDeclarationScannerreports. Nine lines, because SC.3 already moved this class onto the scanner — the constants were being scanned and discarded.Reading them from the scanner rather than matching
Stmt\Const_here is what makes the set agree with the on-disk backends:define()with a literal name, several declarators in oneconststatement, and a declaration nested in a function body all count, while a computed name does not.Behaviour
No user-visible change.
NamespaceCandidatesstill drops every catalog symbol that is not a class-like, so nothing surfaces these yet — S3.8b owns that, along with lookup.Tests
SymbolExtractorTestgains a namespaced-constant case pinning name, FQN and location, and a case asserting the constants extracted equal the onesDeclarationScannerreports for the same AST, so this class cannot grow a second opinion about what declares a constant.SymbolCoverageGridTestloses itsOpenDocumentBackend|Constant|childrenOfnot-applicable entry. The grid fails a registration on a cell that answers, so the removal is the proof the cell now answers rather than a claim about it.AutoloadFiles/helpers.phpandAutoloadFiles/globals.phpfixtures; no new ones.Checklist
constand literaldefine()declarations reach the symbol indexDeclarationScanner's for the same ASTCandidate closes (pending review verification): none.