Alignment! 22
Alignment! 22
Alignment! 22
Alignment! 22
Alignment! start end 22
Alignment! start end 22
Alignment! start end Find smallest encapsulating object that formats region between start and end 22
Alignment! start end Find smallest encapsulating object that formats region between start and end 22
Alignment! clk : in std_logic := ‘X’; 23
Alignment! clk : in std_logic := ‘X’; start end 23
Alignment! clk : in std_logic := ‘X’; start end end.getSemanticElement() PortList PortDeclaration PortDeclaration name direction type value 23
Alignment! x + 4 clk : in std_logic := ‘X’; start end offset x end.getSemanticElement() PortList PortDeclaration PortDeclaration name direction type value 23
Alignment! Format smallest encapsulating object val rule = portDecl.getParserRule() val oldAccess = createTextRegionAccess(rule, portDecl.text) val formatted = portDecl.format() 24
Alignment! Format smallest encapsulating object val rule = portDecl.getParserRule() val oldAccess = createTextRegionAccess(rule, portDecl.text) val formatted = portDecl.format() Map unformatted string to formatted string val newAccess = createTextRegionAccess(rule, formatted.text) val oldIndices = oldAccess.getIndices(start, end) val length = newAccess.countBetween(oldIndices) 24
Align on first parameter? → return ( →→ foo((5, →→ ·····6), →→ ····3)); 25
Align on first parameter? → return ( →→ foo((5, →→ ·····6), →→ ····3)); 25
Align on first parameter? → return ( →→ foo((5, →→ ·····6), →→ ····3)); → return (5, → ········foo((5, → ·············6), → ············3)); 25
Align on first parameter? → return ( →→ foo((5, →→ ·····6), →→ ····3)); → return (5, → ········foo((5, → ·············6), → ············3)); 25
Align on first parameter? → return ( → return foo((5, →→ foo((5, → ············6), →→ ·····6), → ···········3)); →→ ····3)); → return (5, → ········foo((5, → ·············6), → ············3)); 25
Align on first parameter? → return ( → return foo((5, →→ foo((5, → ············6), →→ ·····6), → ···········3)); →→ ····3)); → return (5, → ········foo((5, → ·············6), → ············3)); 25
Align on first parameter? → return ( → return foo((5, →→ foo((5, → ············6), →→ ·····6), → ···········3)); →→ ····3)); → return foo( → return (5, →→ (5, → ········foo((5, →→ ·6), → ·············6), →→ 3)); → ············3)); 25
Align on first parameter? → return ( → return foo((5, →→ foo((5, → ············6), →→ ·····6), → ···········3)); →→ ····3)); → return foo( → return (5, →→ (5, → ········foo((5, →→ ·6), → ·············6), →→ 3)); → ············3)); 25
Align on first parameter? → return ( → return foo((5, →→ foo((5, → ············6), →→ ·····6), → ···········3)); →→ ····3)); Find largest encapsulating element on same line → return foo( → return (5, →→ (5, → ········foo((5, →→ ·6), → ·············6), →→ 3)); → ············3)); 25
Actual timeline 6. Feature parity & extend formatter with new features Correct indentation 26
Actual timeline 6. Feature parity & extend formatter with new features Correct indentation val replacements = formatter.format(request) 26
Actual timeline 6. Feature parity & extend formatter with new features Correct indentation val replacements = formatter.format(request) replacements .filter[ r| ] 26
Actual timeline 6. Feature parity & extend formatter with new features Correct indentation val replacements = formatter.format(request) replacements .filter[ r| r.lineCount > 1 ] 26
Actual timeline 6. Feature parity & extend formatter with new features Correct indentation val replacements = formatter.format(request) replacements .filter[ r| r.lineCount > 1 && r.replacementText.newlines + 1 == r.lineCount ] 26
Actual timeline 6. Feature parity & extend formatter with new features Formatter tags 27
Actual timeline 6. Feature parity & extend formatter with new features Formatter tags -- @formatter:off Turns formatter off -- @formatter:on Turns formatter on 27
Actual timeline 6. Feature parity & extend formatter with new features Formatter tags -- @formatter:off Turns formatter off -- @formatter:on Turns formatter on val originalRegions = request.getRegions() ?: document.region 27
Actual timeline 6. Feature parity & extend formatter with new features Formatter tags -- @formatter:off Turns formatter off -- @formatter:on Turns formatter on val originalRegions = request.getRegions() ?: document.region val betweenRegions = document.findRegionsBetween(off, on) 27
Actual timeline 6. Feature parity & extend formatter with new features Formatter tags -- @formatter:off Turns formatter off -- @formatter:on Turns formatter on val originalRegions = request.getRegions() ?: document.region val betweenRegions = document.findRegionsBetween(off, on) .addAll(document.findRegionsBetween(off, EOF)) 27
Actual timeline 6. Feature parity & extend formatter with new features Formatter tags -- @formatter:off Turns formatter off -- @formatter:on Turns formatter on val originalRegions = request.getRegions() ?: document.region val betweenRegions = document.findRegionsBetween(off, on) .addAll(document.findRegionsBetween(off, EOF)) val newRegions = originalRegions.removeRegions(betweenRegions) 27
Actual timeline 6. Feature parity & extend formatter with new features Formatter tags -- @formatter:off Turns formatter off -- @formatter:on Turns formatter on val originalRegions = request.getRegions() ?: document.region val betweenRegions = document.findRegionsBetween(off, on) .addAll(document.findRegionsBetween(off, EOF)) val newRegions = originalRegions.removeRegions(betweenRegions) request.setRegions(newRegions) 27
Performance 7. Performance tweaking to same or better level than old 28
Performance 7. Performance tweaking to same or better level than old ● Cache ITextRegionAccess in subformats 28
Performance 7. Performance tweaking to same or better level than old ● Cache ITextRegionAccess in subformats ● Cache IParser.createAllRules(Grammar) 28
Performance 7. Performance tweaking to same or better level than old ● Cache ITextRegionAccess in subformats ● Cache IParser.createAllRules(Grammar) ● Merge all replacements into one big replacement 28
Performance 7. Performance tweaking to same or better level than old emacs/xtend > 25m 29
Performance 7. Performance tweaking to same or better level than old emacs/xtend > 25m 30
Biggest problems in hindsight 31
Recommend
More recommend