File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -186,16 +186,19 @@ type PkgVersion = T.Text
186
186
187
187
data SimpleDependency = Dependency PkgName PkgVersion
188
188
189
+ -- | Represents some element that has an associated position in a file
189
190
data Positioned a = Positioned Syntax. Position a
190
191
191
192
data DependencyInstances = DependencyInstances
192
193
{ installPlan :: [DependencyInstance ] }
193
194
deriving Show
194
195
196
+ -- | Represents a concrete dependency entry in plan.json
195
197
data DependencyInstance = DependencyInstance
196
198
{ _pkgName :: PkgName
197
199
, _pkgVersion :: PkgVersion
198
- }
200
+ , _componentName :: T. Text
201
+ } -- missing some unneeded fields
199
202
deriving (Show , Generic )
200
203
201
204
instance NFData DependencyInstance
@@ -204,7 +207,8 @@ instance A.FromJSON DependencyInstance where
204
207
parseJSON = A. withObject " InstallPlan" $ \ obj -> do
205
208
pkgName <- obj .: " pkg-name"
206
209
pkgVersion <- obj .: " pkg-version"
207
- return $ DependencyInstance pkgName pkgVersion
210
+ cmpName <- obj .: " component-name"
211
+ return $ DependencyInstance pkgName pkgVersion cmpName
208
212
209
213
instance A. FromJSON DependencyInstances where
210
214
parseJSON = A. withObject " PlanJson" $ \ obj -> do
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ parseDeps _ = []
30
30
31
31
-- | Matches valid Cabal dependency names
32
32
packageRegex :: T. Text
33
- packageRegex = " [a-zA-Z0-9_-]+"
33
+ packageRegex = " [a-zA-Z0-9_-]+" -- not sure if this is correct
34
34
35
35
-- | Parses a single FieldLine of Cabal dependencies. Returns a list since a single line may
36
36
-- contain multiple dependencies.
Original file line number Diff line number Diff line change @@ -37,4 +37,4 @@ readCabalFields file contents = do
37
37
$ " Failed to parse cabal file: " <> T. pack (show parseError)
38
38
Right (fields, _warnings) -> do
39
39
-- we don't want to double report diagnostics, all diagnostics are produced by 'ParseCabalFile'.
40
- Right fields
40
+ Right fields
You can’t perform that action at this time.
0 commit comments