Is there a method to get multiple source roots for...
# development
w
Is there a method to get multiple source roots for a file? It's a strange ask, but like, for a given file - can we enumerate all of the source roots from that file down to repo root?
The only thing I've really come upon is
SourceRootsRequest
where I would populate each folder path for a file, all the way to root - which feels... blah
h
Not really. A file only has one source root, which is the innermost matching dir.
👍 1
So I think ascending the filesystem is the way to go
what's the use-case?
w
I've run into this a few times before, and just left the problem until later. The current use case is back to the C++ backend, using dependency inference to locate headers, when they don't match the source file usage. I'm also using it to enumerate include directories for gcc
However, I ran across a case where it might come in handy in some Javascript thing that I would have to look at again - not sure what that exact use case was at the moment.