Skip to content

ParsedSource (especially module name source span) not available from Source Plugin

As discovered in https://github.com/google/haskell-indexer/pull/89#discussion_r248081268, the TcGblEnv received by a Source Plugin doesn't seem to have a way of accessing the SrcSpan of the module name.

When having access to the ParsedModule, it contains ParsedSource, which is Located (HsModule GhcPs), whose inner datatype contains Maybe (Located ModuleName), with the location's span pointing to the module name span.

From TcGblEnv one can access the ModSummary, which has a Maybe HsParsedModule, but seems to be Nothing practically.

I know this is a minor nit, but all other declarations are accessible by the source plugin so far, just this bit seems missing. Without this, haskell-indexer has to resort to source-code heuristics to get the module name span.

Trac metadata
Trac field Value
Version 8.6.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component GHC API
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information