Closed
Description
As discussed in microsoft/tolerant-php-parser#36 (comment), key benefits include:
- graceful error handling
- performance + memory usage
- fully-representative tree
I'm currently working with Felix to put together a functional prototype. This would be a pretty major change, there may be some temporary regressions, and we will certainly need to make some improvements to the parser before it's ready for primetime.
This issue acts as a catch-all to track progress on that work.
Current status:
Working branch:
- Language server: master...mousetraps:tolerant
- Parser: microsoft/tolerant-php-parser@master...mousetraps:lang-server
Features
- error diagnostics
- find all symbols
- find all symbols in workspace
- [not impacted] format code
- go to definition
- find all references
- hover
- completion
Known regressions
- Error diagnostics produced by the parser are not currently "strict" because we parse things more loosely in order to provide error tolerance, so we won't get diagnostics for everything until we add relevant post-parse checks (this will happen on the parser side).
- The new parser has higher granularity when it comes to Node position info, which results in slightly different (but still correct) position locations in some cases (for instance for a function call
hello(/*cursor*/)
, go-to-definition at the denoted cursor position will not yield a result (but will yield a result if the function call name is selected) - The new parser does not have pretty-printing yet, so the definition lines produced are exactly what the user has typed in (including whitespace), rather than a pretty-printed version.
- Magic constants are treated like normal constants and will therefore appear in "find all references" results. Their fqsen will be resolved to their namespace value if one is defined (even though this is not actually legal).
- true, false, and null are not included in find all references results (which is probably the expected behavior anyways)
- variables used within template strings are not currently included in find all references results
- TODO
Related parser issues
Parser work for this next milestone is tracked here. Any additional issues that should be prioritized?