1
- {-# LANGUAGE CPP #-}
2
- {-# LANGUAGE DataKinds #-}
1
+ {-# LANGUAGE CPP #-}
2
+ {-# LANGUAGE DataKinds #-}
3
3
{-# LANGUAGE DuplicateRecordFields #-}
4
- {-# LANGUAGE GADTs #-}
5
- {-# LANGUAGE OverloadedStrings #-}
6
- {-# LANGUAGE RecordWildCards #-}
7
- {-# LANGUAGE ViewPatterns #-}
4
+ {-# LANGUAGE GADTs #-}
5
+ {-# LANGUAGE OverloadedStrings #-}
6
+ {-# LANGUAGE RecordWildCards #-}
7
+ {-# LANGUAGE ViewPatterns #-}
8
8
9
9
module Ide.Plugin.Cabal.Outline
10
10
( moduleOutline ,
11
11
)
12
12
where
13
13
14
- import Control.Monad.IO.Class
15
- import Data.Maybe
16
- import Data.Text qualified as T
17
- import Data.Text.Encoding (decodeUtf8 )
18
- import Development.IDE.Core.Rules
19
- import Development.IDE.Core.Shake (IdeState (shakeExtras ), runIdeAction , useWithStaleFast )
20
- import Development.IDE.Types.Location ( toNormalizedFilePath' )
21
- import Distribution.Fields.Field
22
- ( Field ( Field , Section ),
23
- FieldLine ( FieldLine ),
24
- Name (Name ),
25
- SectionArg (SecArgName , SecArgOther , SecArgStr ),
26
- )
27
- import Distribution.Parsec.Position ( Position ( Position ))
28
- import Ide.Plugin.Cabal.Completion.Types ( ParseCabalFields ( .. ), cabalPositionToLSPPosition )
29
- import Ide.Plugin.Cabal.Orphans ()
30
- import Ide.Types (PluginMethodHandler )
31
- import Language.LSP.Protocol.Message qualified as LSP
32
- import Language.LSP.Protocol.Types qualified as LSP
14
+ import Control.Monad.IO.Class
15
+ import Data.Maybe
16
+ import qualified Data.Text as T
17
+ import Data.Text.Encoding (decodeUtf8 )
18
+ import Development.IDE.Core.Rules
19
+ import Development.IDE.Core.Shake (IdeState (shakeExtras ),
20
+ runIdeAction ,
21
+ useWithStaleFast )
22
+ import Development.IDE.Types.Location ( toNormalizedFilePath' )
23
+ import Distribution.Fields.Field ( Field ( Field , Section ),
24
+ Name (Name ),
25
+ SectionArg (SecArgName , SecArgOther , SecArgStr ))
26
+ import Distribution.Parsec.Position ( Position )
27
+ import Ide.Plugin.Cabal.Completion.Types ( ParseCabalFields ( .. ),
28
+ cabalPositionToLSPPosition )
29
+ import Ide.Plugin.Cabal.Orphans ()
30
+ import Ide.Types (PluginMethodHandler )
31
+ import qualified Language.LSP.Protocol.Message as LSP
32
+ import qualified Language.LSP.Protocol.Types as LSP
33
33
34
34
moduleOutline :: PluginMethodHandler IdeState LSP. Method_TextDocumentDocumentSymbol
35
35
moduleOutline ideState _ LSP. DocumentSymbolParams {_textDocument = LSP. TextDocumentIdentifier uri} =
@@ -75,9 +75,9 @@ joinedNameForSectionArgs sectionArgs = joinedName
75
75
joinedName = T. unwords $ map getName sectionArgs
76
76
77
77
getName :: SectionArg Position -> T. Text
78
- getName (SecArgName _ identifier) = decodeUtf8 identifier
78
+ getName (SecArgName _ identifier) = decodeUtf8 identifier
79
79
getName (SecArgStr _ quotedString) = decodeUtf8 quotedString
80
- getName (SecArgOther _ string) = decodeUtf8 string
80
+ getName (SecArgOther _ string) = decodeUtf8 string
81
81
82
82
-- | Creates a single point LSP range
83
83
-- using cabal position
@@ -102,4 +102,4 @@ defDocumentSymbol range = LSP.DocumentSymbol {..}
102
102
_range = range
103
103
_selectionRange = range
104
104
_children = Nothing
105
- _tags = Nothing
105
+ _tags = Nothing
0 commit comments