haskell-language-server-2.11.0.0: LSP server for GHC
Safe HaskellNone
LanguageGHC2021

Ide.Plugin.Cabal.Definition

Synopsis

Documentation

gotoDefinition :: PluginMethodHandler IdeState 'Method_TextDocumentDefinition Source #

Handler for going to definitions.

Provides a handler for going to the definition in a cabal file, gathering all possible definitions by calling subfunctions.

gotoCommonSectionDefinition Source #

Arguments

:: Uri

Cabal file URI

-> [Field Position]

Found common sections

-> Position

Cursor position

-> [Field Position]

Trimmed cabal AST on a cursor

-> Maybe Definition 

Definitions for Sections.

Provides a Definition if cursor is pointed at an identifier, otherwise gives Nothing. The definition is found by traversing the sections and comparing their name to the clicked identifier.

gotoModulesDefinition Source #

Arguments

:: NormalizedFilePath

Normalized FilePath to the cabal file

-> GenericPackageDescription 
-> Position

Cursor position

-> [Field Position]

Trimmed cabal AST on a cursor

-> IO (Maybe Definition) 

Definitions for Modules.

Provides a Definition if cursor is pointed at a exposed-module or other-module field, otherwise gives Nothing

Definition is found by looking for a module name, the cursor is pointing to and looking for it in BuildInfos. Note that since a trimmed ast is provided, a Definition to a module with the same name as the target one, but in another build target can't be given.

See resolving Config module in tests.

lookupBuildTargetPackageDescription :: PackageDescription -> Maybe Text -> [BuildInfo] Source #

Gives all buildInfos given a target name.

`Maybe buildTargetName` is provided, and if it's Nothing we assume, that it's a main library. Otherwise looks for the provided name.

toHaskellFile :: Text -> FilePath Source #

Converts a name of a module to a FilePath. Is needed to guess the relative path to a file using the name of the module. We assume, that correct module naming is guaranteed.

Warning: Generally not advised to use, if there are better ways to get the path.

Examples: (output is system dependent) >>> toHaskellFile My.Module.Lib "MyModuleLib.hs" >>> toHaskellFile Main "Main.hs"