Shopify / ruby-lsp

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

Always expand indexables' full paths #1977

Closed st0012 closed 2 weeks ago

st0012 commented 3 weeks ago

Motivation

Depends on the included_pattern's value, Dir.glob may return relative paths as its default base is the current working directory. For example, if the included_pattern is **/*.rb, the Dir.glob will return relative paths like lib/foo.rb instead of the full path like /path/to/project/lib/foo.rb.

Fixes #1971

Implementation

This commit ensures that the full paths are always expanded by using File.expand_path on the paths returned by Dir.glob.

Automated Tests

Manual Tests