Skip to content

Commit 961d714

Browse files
committed
add comments
1 parent 51763bb commit 961d714

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Completion/Types.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,19 @@ type PkgVersion = T.Text
186186

187187
data SimpleDependency = Dependency PkgName PkgVersion
188188

189+
-- | Represents some element that has an associated position in a file
189190
data Positioned a = Positioned Syntax.Position a
190191

191192
data DependencyInstances = DependencyInstances
192193
{ installPlan :: [DependencyInstance] }
193194
deriving Show
194195

196+
-- | Represents a concrete dependency entry in plan.json
195197
data DependencyInstance = DependencyInstance
196198
{ _pkgName :: PkgName
197199
, _pkgVersion :: PkgVersion
198-
}
200+
, _componentName :: T.Text
201+
} -- missing some unneeded fields
199202
deriving (Show, Generic)
200203

201204
instance NFData DependencyInstance
@@ -204,7 +207,8 @@ instance A.FromJSON DependencyInstance where
204207
parseJSON = A.withObject "InstallPlan" $ \obj -> do
205208
pkgName <- obj .: "pkg-name"
206209
pkgVersion <- obj .: "pkg-version"
207-
return $ DependencyInstance pkgName pkgVersion
210+
cmpName <- obj .: "component-name"
211+
return $ DependencyInstance pkgName pkgVersion cmpName
208212

209213
instance A.FromJSON DependencyInstances where
210214
parseJSON = A.withObject "PlanJson" $ \obj -> do

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Dependencies.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ parseDeps _ = []
3030

3131
-- | Matches valid Cabal dependency names
3232
packageRegex :: T.Text
33-
packageRegex = "[a-zA-Z0-9_-]+"
33+
packageRegex = "[a-zA-Z0-9_-]+" -- not sure if this is correct
3434

3535
-- | Parses a single FieldLine of Cabal dependencies. Returns a list since a single line may
3636
-- contain multiple dependencies.

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Parse.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ readCabalFields file contents = do
3737
$ "Failed to parse cabal file: " <> T.pack (show parseError)
3838
Right (fields, _warnings) -> do
3939
-- we don't want to double report diagnostics, all diagnostics are produced by 'ParseCabalFile'.
40-
Right fields
40+
Right fields

0 commit comments

Comments
 (0)