Summary
Fix off-by-two position errors when reporting literal expressions in the outline parser.
Background
The outline parser currently reports literal expression positions that are 2 characters earlier than expected, compared to the ANTLR parser. This affects 3 test failures in apex-dev-tools/apex-ls#434.
Example from failing tests:
"public class Dummy { Object a = 12345678901; }"
// Literal "12345678901" is at character positions 32-42
// ANTLR expects: "line 1 at 32-43"
// Outline parser: "line 1 at 30-41" (both start and end are 2 positions too early)
Test failures:
LiteralTypeTest - "Oversize Decimal": expected 32-83, got 30-81
LiteralTypeTest - "Oversize Integer": expected 32-43, got 30-41
LiteralTypeTest - "Oversize Long": expected 32-53, got 30-51
Investigation Needed
The exact cause needs to be identified, but likely locations include:
-
Literal token capture in OutlineParser.scala
- Check how numeric literals are being tokenized
- Verify position tracking during literal consumption
-
Expression/literal CST construction
- Could be in apex-ls's integration code when constructing expressions from outline parser tokens
- Or in outline-parser's literal handling
-
Position offset calculations
- The consistent off-by-2 suggests a systematic offset error
- May be related to how byte offsets vs character offsets are calculated
Success Criteria
After the fix:
- Run apex-ls test:
sbt apexlsJVM/testOnly *LiteralTypeTest
- All 3 literal position tests should pass
- Positions should match ANTLR parser output exactly
Related Issues
Notes
This issue is independent of #19 (modifier/annotation locations) and can be worked on in parallel once the root cause is identified.
Summary
Fix off-by-two position errors when reporting literal expressions in the outline parser.
Background
The outline parser currently reports literal expression positions that are 2 characters earlier than expected, compared to the ANTLR parser. This affects 3 test failures in apex-dev-tools/apex-ls#434.
Example from failing tests:
Test failures:
LiteralTypeTest- "Oversize Decimal": expected32-83, got30-81LiteralTypeTest- "Oversize Integer": expected32-43, got30-41LiteralTypeTest- "Oversize Long": expected32-53, got30-51Investigation Needed
The exact cause needs to be identified, but likely locations include:
Literal token capture in OutlineParser.scala
Expression/literal CST construction
Position offset calculations
Success Criteria
After the fix:
sbt apexlsJVM/testOnly *LiteralTypeTestRelated Issues
Notes
This issue is independent of #19 (modifier/annotation locations) and can be worked on in parallel once the root cause is identified.