Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.33k stars 118 forks source link

Make module tracking lazy #1978

Closed vinistock closed 2 weeks ago

vinistock commented 3 weeks ago

Motivation

This is a small optimization to how we're tracking included and prepended modules. There's no need to eagerly create the arrays to store them, since there might be many modules that don't include or prepend anything.

Implementation

Made the modules initialization lazy, so that the arrays are only created if we actually found an include or prepend.