git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
[psc-ide] Parse Modules on load
ee34e21Christoph Hegemann
LICENSE+270−10
@@ -46,6 +46,7 @@ PureScript uses the following Haskell library packages. Their license files foll
46 bytestring-builder
46 bytestring-builder
47 case-insensitive
47 case-insensitive
48 cereal
48 cereal
49+ clock
49 conduit
50 conduit
50 conduit-extra
51 conduit-extra
51 connection
52 connection
@@ -56,8 +57,10 @@ PureScript uses the following Haskell library packages. Their license files foll
56 deepseq
57 deepseq
57 directory
58 directory
58 dlist
59 dlist
60+ easy-file
59 edit-distance
61 edit-distance
60 exceptions
62 exceptions
63+ fail
61 fast-logger
64 fast-logger
62 filepath
65 filepath
63 fsnotify
66 fsnotify
@@ -82,6 +85,7 @@ PureScript uses the following Haskell library packages. Their license files foll
82 network
85 network
83 network-uri
86 network-uri
84 old-locale
87 old-locale
88+ old-time
85 optparse-applicative
89 optparse-applicative
86 parallel
90 parallel
87 parsec
91 parsec
@@ -91,6 +95,7 @@ PureScript uses the following Haskell library packages. Their license files foll
91 pipes-http
95 pipes-http
92 primitive
96 primitive
93 process
97 process
98+ protolude
94 random
99 random
95 regex-base
100 regex-base
96 regex-tdfa
101 regex-tdfa
@@ -105,6 +110,7 @@ PureScript uses the following Haskell library packages. Their license files foll
105 stm
110 stm
106 stm-chans
111 stm-chans
107 streaming-commons
112 streaming-commons
113+ string-conv
108 syb
114 syb
109 tagged
115 tagged
110 template-haskell
116 template-haskell
@@ -117,6 +123,7 @@ PureScript uses the following Haskell library packages. Their license files foll
117 transformers-compat
123 transformers-compat
118 unix
124 unix
119 unix-compat
125 unix-compat
126+ unix-time
120 unordered-containers
127 unordered-containers
121 utf8-string
128 utf8-string
122 vector
129 vector
@@ -955,6 +962,41 @@ cereal LICENSE file:
955 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
962 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
956 POSSIBILITY OF SUCH DAMAGE.
963 POSSIBILITY OF SUCH DAMAGE.
957
964
965+clock LICENSE file:
966+
967+ Copyright (c) 2009-2012, Cetin Sert
968+ Copyright (c) 2010, Eugene Kirpichov
969+
970+ All rights reserved.
971+
972+ Redistribution and use in source and binary forms, with or without
973+ modification, are permitted provided that the following conditions are
974+ met:
975+
976+ * Redistributions of source code must retain the above copyright
977+ notice, this list of conditions and the following disclaimer.
978+
979+ * Redistributions in binary form must reproduce the above
980+ copyright notice, this list of conditions and the following
981+ disclaimer in the documentation and/or other materials provided
982+ with the distribution.
983+
984+ * The names of contributors may not be used to endorse or promote
985+ products derived from this software without specific prior
986+ written permission.
987+
988+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
989+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
990+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
991+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
992+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
993+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
994+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
995+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
996+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
997+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
998+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
999+
958conduit LICENSE file:
1000conduit LICENSE file:
959
1001
960 Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
1002 Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
@@ -1142,16 +1184,16 @@ data-default-class LICENSE file:
1142 may be used to endorse or promote products derived from this software
1184 may be used to endorse or promote products derived from this software
1143 without specific prior written permission.
1185 without specific prior written permission.
1144
1186
1145− THIS SOFTWARE IS PROVIDED BY LUKAS MAI AND CONTRIBUTORS "AS IS" AND ANY
1187+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1146− EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1188+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1147 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1189 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1148− DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
1190+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
1149− DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1191+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1150− (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1192+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1151− LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1193+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1152− ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1194+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1153− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1195+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1154− SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1196+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1155
1197
1156deepseq LICENSE file:
1198deepseq LICENSE file:
1157
1199
@@ -1295,6 +1337,38 @@ dlist LICENSE file:
1295 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1337 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1296 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1338 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1297
1339
1340+easy-file LICENSE file:
1341+
1342+ Copyright (c) 2009, IIJ Innovation Institute Inc.
1343+ All rights reserved.
1344+
1345+ Redistribution and use in source and binary forms, with or without
1346+ modification, are permitted provided that the following conditions
1347+ are met:
1348+
1349+ * Redistributions of source code must retain the above copyright
1350+ notice, this list of conditions and the following disclaimer.
1351+ * Redistributions in binary form must reproduce the above copyright
1352+ notice, this list of conditions and the following disclaimer in
1353+ the documentation and/or other materials provided with the
1354+ distribution.
1355+ * Neither the name of the copyright holders nor the names of its
1356+ contributors may be used to endorse or promote products derived
1357+ from this software without specific prior written permission.
1358+
1359+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1360+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1361+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1362+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1363+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1364+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1365+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1366+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1367+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1368+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1369+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1370+ POSSIBILITY OF SUCH DAMAGE.
1371+
1298edit-distance LICENSE file:
1372edit-distance LICENSE file:
1299
1373
1300 Copyright (c) 2008-2013 Maximilian Bolingbroke
1374 Copyright (c) 2008-2013 Maximilian Bolingbroke
@@ -1354,6 +1428,39 @@ exceptions LICENSE file:
1354 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1428 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1355 POSSIBILITY OF SUCH DAMAGE.
1429 POSSIBILITY OF SUCH DAMAGE.
1356
1430
1431+fail LICENSE file:
1432+
1433+ Copyright (c) 2015, David Luposchainsky & Herbert Valerio Riedel
1434+
1435+ All rights reserved.
1436+
1437+ Redistribution and use in source and binary forms, with or without
1438+ modification, are permitted provided that the following conditions are met:
1439+
1440+ * Redistributions of source code must retain the above copyright
1441+ notice, this list of conditions and the following disclaimer.
1442+
1443+ * Redistributions in binary form must reproduce the above
1444+ copyright notice, this list of conditions and the following
1445+ disclaimer in the documentation and/or other materials provided
1446+ with the distribution.
1447+
1448+ * Neither the name of Herbert Valerio Riedel nor the names of other
1449+ contributors may be used to endorse or promote products derived
1450+ from this software without specific prior written permission.
1451+
1452+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1453+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1454+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1455+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1456+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1457+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1458+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1459+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1460+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1461+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1462+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1463+
1357fast-logger LICENSE file:
1464fast-logger LICENSE file:
1358
1465
1359 Copyright (c) 2009, IIJ Innovation Institute Inc.
1466 Copyright (c) 2009, IIJ Innovation Institute Inc.
@@ -2122,6 +2229,72 @@ old-locale LICENSE file:
2122
2229
2123 -----------------------------------------------------------------------------
2230 -----------------------------------------------------------------------------
2124
2231
2232+old-time LICENSE file:
2233+
2234+ This library (libraries/base) is derived from code from two
2235+ sources:
2236+
2237+ * Code from the GHC project which is largely (c) The University of
2238+ Glasgow, and distributable under a BSD-style license (see below),
2239+
2240+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2241+ and freely redistributable (but see the full license for
2242+ restrictions).
2243+
2244+ The full text of these licenses is reproduced below. Both of the
2245+ licenses are BSD-style or compatible.
2246+
2247+ -----------------------------------------------------------------------------
2248+
2249+ The Glasgow Haskell Compiler License
2250+
2251+ Copyright 2004, The University Court of the University of Glasgow.
2252+ All rights reserved.
2253+
2254+ Redistribution and use in source and binary forms, with or without
2255+ modification, are permitted provided that the following conditions are met:
2256+
2257+ - Redistributions of source code must retain the above copyright notice,
2258+ this list of conditions and the following disclaimer.
2259+
2260+ - Redistributions in binary form must reproduce the above copyright notice,
2261+ this list of conditions and the following disclaimer in the documentation
2262+ and/or other materials provided with the distribution.
2263+
2264+ - Neither name of the University nor the names of its contributors may be
2265+ used to endorse or promote products derived from this software without
2266+ specific prior written permission.
2267+
2268+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2269+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2270+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2271+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2272+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2273+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2274+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2275+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2276+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2277+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2278+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2279+ DAMAGE.
2280+
2281+ -----------------------------------------------------------------------------
2282+
2283+ Code derived from the document "Report on the Programming Language
2284+ Haskell 98", is distributed under the following license:
2285+
2286+ Copyright (c) 2002 Simon Peyton Jones
2287+
2288+ The authors intend this Report to belong to the entire Haskell
2289+ community, and so we grant permission to copy and distribute it for
2290+ any purpose, provided that it is reproduced in its entirety,
2291+ including this Notice. Modified versions of this Report may also be
2292+ copied and distributed for any purpose, provided that the modified
2293+ version is clearly presented as such, and that it does not claim to
2294+ be a definition of the Haskell 98 Language.
2295+
2296+ -----------------------------------------------------------------------------
2297+
2125optparse-applicative LICENSE file:
2298optparse-applicative LICENSE file:
2126
2299
2127 Copyright (c) 2012, Paolo Capriotti
2300 Copyright (c) 2012, Paolo Capriotti
@@ -2276,7 +2449,7 @@ pem LICENSE file:
2276
2449
2277pipes LICENSE file:
2450pipes LICENSE file:
2278
2451
2279− Copyright (c) 2012-2014 Gabriel Gonzalez
2452+ Copyright (c) 2012-2016 Gabriel Gonzalez
2280 All rights reserved.
2453 All rights reserved.
2281
2454
2282 Redistribution and use in source and binary forms, with or without modification,
2455 Redistribution and use in source and binary forms, with or without modification,
@@ -2427,6 +2600,28 @@ process LICENSE file:
2427
2600
2428 -----------------------------------------------------------------------------
2601 -----------------------------------------------------------------------------
2429
2602
2603+protolude LICENSE file:
2604+
2605+ Copyright (c) 2016, Stephen Diehl
2606+
2607+ Permission is hereby granted, free of charge, to any person obtaining a copy
2608+ of this software and associated documentation files (the "Software"), to
2609+ deal in the Software without restriction, including without limitation the
2610+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2611+ sell copies of the Software, and to permit persons to whom the Software is
2612+ furnished to do so, subject to the following conditions:
2613+
2614+ The above copyright notice and this permission notice shall be included in
2615+ all copies or substantial portions of the Software.
2616+
2617+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2618+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2619+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2620+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2621+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2622+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2623+ IN THE SOFTWARE.
2624+
2430random LICENSE file:
2625random LICENSE file:
2431
2626
2432 This library (libraries/base) is derived from code from two
2627 This library (libraries/base) is derived from code from two
@@ -2873,6 +3068,39 @@ streaming-commons LICENSE file:
2873 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3068 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2874 SOFTWARE.
3069 SOFTWARE.
2875
3070
3071+string-conv LICENSE file:
3072+
3073+ Copyright (c) 2012, Ozgun Ataman
3074+
3075+ All rights reserved.
3076+
3077+ Redistribution and use in source and binary forms, with or without
3078+ modification, are permitted provided that the following conditions are met:
3079+
3080+ * Redistributions of source code must retain the above copyright
3081+ notice, this list of conditions and the following disclaimer.
3082+
3083+ * Redistributions in binary form must reproduce the above
3084+ copyright notice, this list of conditions and the following
3085+ disclaimer in the documentation and/or other materials provided
3086+ with the distribution.
3087+
3088+ * Neither the name of Ozgun Ataman nor the names of other
3089+ contributors may be used to endorse or promote products derived
3090+ from this software without specific prior written permission.
3091+
3092+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3093+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3094+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3095+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3096+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3097+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3098+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3099+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3100+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3101+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3102+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3103+
2876syb LICENSE file:
3104syb LICENSE file:
2877
3105
2878 This library (libraries/syb) is derived from code from several
3106 This library (libraries/syb) is derived from code from several
@@ -3289,6 +3517,38 @@ unix-compat LICENSE file:
3289 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3517 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3290 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3518 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3291
3519
3520+unix-time LICENSE file:
3521+
3522+ Copyright (c) 2009, IIJ Innovation Institute Inc.
3523+ All rights reserved.
3524+
3525+ Redistribution and use in source and binary forms, with or without
3526+ modification, are permitted provided that the following conditions
3527+ are met:
3528+
3529+ * Redistributions of source code must retain the above copyright
3530+ notice, this list of conditions and the following disclaimer.
3531+ * Redistributions in binary form must reproduce the above copyright
3532+ notice, this list of conditions and the following disclaimer in
3533+ the documentation and/or other materials provided with the
3534+ distribution.
3535+ * Neither the name of the copyright holders nor the names of its
3536+ contributors may be used to endorse or promote products derived
3537+ from this software without specific prior written permission.
3538+
3539+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3540+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3541+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
3542+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3543+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
3544+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
3545+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3546+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3547+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3548+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3549+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3550+ POSSIBILITY OF SUCH DAMAGE.
3551+
3292unordered-containers LICENSE file:
3552unordered-containers LICENSE file:
3293
3553
3294 Copyright (c) 2010, Johan Tibell
3554 Copyright (c) 2010, Johan Tibell
psc-ide-server/Main.hs+4−5
@@ -44,9 +44,6 @@ import System.IO.Error (isEOFError)
44
44
45import qualified Paths_purescript as Paths
45import qualified Paths_purescript as Paths
46
46
47−-- "Borrowed" from the Idris Compiler
48−-- Copied from upstream impl of listenOn
49−-- bound to localhost interface instead of iNADDR_ANY
50listenOnLocalhost :: PortNumber -> IO Socket
47listenOnLocalhost :: PortNumber -> IO Socket
51listenOnLocalhost port = do
48listenOnLocalhost port = do
52 proto <- getProtocolNumber "tcp"
49 proto <- getProtocolNumber "tcp"
@@ -62,6 +59,7 @@ listenOnLocalhost port = do
62
59
63data Options = Options
60data Options = Options
64 { optionsDirectory :: Maybe FilePath
61 { optionsDirectory :: Maybe FilePath
62+ , optionsGlobs :: [FilePath]
65 , optionsOutputPath :: FilePath
63 , optionsOutputPath :: FilePath
66 , optionsPort :: PortNumber
64 , optionsPort :: PortNumber
67 , optionsNoWatch :: Bool
65 , optionsNoWatch :: Bool
@@ -70,7 +68,7 @@ data Options = Options
70
68
71main :: IO ()
69main :: IO ()
72main = do
70main = do
73− Options dir outputPath port noWatch debug <- execParser opts
71+ Options dir globs outputPath port noWatch debug <- execParser opts
74 maybe (pure ()) setCurrentDirectory dir
72 maybe (pure ()) setCurrentDirectory dir
75 serverState <- newTVarIO emptyPscIdeState
73 serverState <- newTVarIO emptyPscIdeState
76 ideState <- newTVarIO emptyIdeState
74 ideState <- newTVarIO emptyIdeState
@@ -86,13 +84,14 @@ main = do
86 unless noWatch $
84 unless noWatch $
87 void (forkFinally (watcher ideState fullOutputPath) print)
85 void (forkFinally (watcher ideState fullOutputPath) print)
88
86
89− let conf = Configuration {confDebug = debug, confOutputPath = outputPath}
87+ let conf = Configuration {confDebug = debug, confOutputPath = outputPath, confGlobs = globs}
90 env = IdeEnvironment {envStateVar = serverState, ideStateVar = ideState, ideConfiguration = conf}
88 env = IdeEnvironment {envStateVar = serverState, ideStateVar = ideState, ideConfiguration = conf}
91 startServer port env
89 startServer port env
92 where
90 where
93 parser =
91 parser =
94 Options
92 Options
95 <$> optional (strOption (long "directory" `mappend` short 'd'))
93 <$> optional (strOption (long "directory" `mappend` short 'd'))
94+ <*> many (argument str (metavar "Source GLOBS..."))
96 <*> strOption (long "output-directory" `mappend` value "output/")
95 <*> strOption (long "output-directory" `mappend` value "output/")
97 <*> (fromIntegral <$>
96 <*> (fromIntegral <$>
98 option auto (long "port" `mappend` short 'p' `mappend` value (4242 :: Integer)))
97 option auto (long "port" `mappend` short 'p' `mappend` value (4242 :: Integer)))
psc-ide-server/README.md+4−1
@@ -10,7 +10,10 @@ A tool which provides editor support for the PureScript programming language.
10* Vim integration is available here: https://github.com/FrigoEU/psc-ide-vim.
10* Vim integration is available here: https://github.com/FrigoEU/psc-ide-vim.
11
11
12## Running the Server
12## Running the Server
13+
13−Start the server by running the `psc-ide-server` executable.
14+Start the server by running the `psc-ide-server [SOURCEGLOBS]` executable, where
15+`SOURCEGLOBS` are (optional) globs that match your PureScript sourcefiles.
16+
14It supports the following options:
17It supports the following options:
15
18
16- `-p / --port` specify a port. Defaults to 4242
19- `-p / --port` specify a port. Defaults to 4242
purescript.cabal+1
@@ -106,6 +106,7 @@ library
106 boxes >= 0.1.4 && < 0.2.0,
106 boxes >= 0.1.4 && < 0.2.0,
107 bytestring -any,
107 bytestring -any,
108 containers -any,
108 containers -any,
109+ clock -any,
109 directory >= 1.2,
110 directory >= 1.2,
110 dlist -any,
111 dlist -any,
111 edit-distance -any,
112 edit-distance -any,
src/Language/PureScript/Ide.hs+103−81
@@ -14,11 +14,10 @@
14
14
15{-# LANGUAGE OverloadedStrings #-}
15{-# LANGUAGE OverloadedStrings #-}
16{-# LANGUAGE PackageImports #-}
16{-# LANGUAGE PackageImports #-}
17+{-# LANGUAGE TemplateHaskell #-}
17
18
18module Language.PureScript.Ide
19module Language.PureScript.Ide
19 ( handleCommand
20 ( handleCommand
20− -- for tests
21− , printModules
22 ) where
21 ) where
23
22
24import Protolude
23import Protolude
@@ -41,67 +40,74 @@ import Language.PureScript.Ide.Types
41import Language.PureScript.Ide.Util
40import Language.PureScript.Ide.Util
42import System.Directory
41import System.Directory
43import System.FilePath
42import System.FilePath
43+import System.FilePath.Glob
44
44
45handleCommand :: (Ide m, MonadLogger m, MonadError PscIdeError m) =>
45handleCommand :: (Ide m, MonadLogger m, MonadError PscIdeError m) =>
46 Command -> m Success
46 Command -> m Success
47−handleCommand (Load []) = loadAllModules
47+handleCommand c = case c of
48+ Load [] ->
49+ findAvailableExterns >>= loadModules
50+ Load modules ->
48−handleCommand (Load modules) = loadModules modules
51+ loadModules modules
49−handleCommand (Type search filters currentModule) =
52+ Type search filters currentModule ->
50− findType search filters currentModule
53+ findType search filters currentModule
51−handleCommand (Complete filters matcher currentModule) =
54+ Complete filters matcher currentModule ->
52− findCompletions filters matcher currentModule
55+ findCompletions filters matcher currentModule
53−handleCommand (Pursuit query Package) =
56+ Pursuit query Package ->
54− findPursuitPackages query
57+ findPursuitPackages query
55−handleCommand (Pursuit query Identifier) =
58+ Pursuit query Identifier ->
56− findPursuitCompletions query
59+ findPursuitCompletions query
57−handleCommand (List LoadedModules) =
60+ List LoadedModules ->
58− printModules
61+ printModules
59−handleCommand (List AvailableModules) =
62+ List AvailableModules ->
60− listAvailableModules
63+ listAvailableModules
61−handleCommand (List (Imports fp)) =
64+ List (Imports fp) ->
62− importsForFile fp
65+ ImportList <$> getImportsForFile fp
63−handleCommand (CaseSplit l b e wca t) =
66+ CaseSplit l b e wca t ->
64− caseSplit l b e wca t
67+ caseSplit l b e wca t
65−handleCommand (AddClause l wca) =
68+ AddClause l wca ->
66− addClause l wca
69+ addClause l wca
67−handleCommand (Import fp outfp _ (AddImplicitImport mn)) = do
70+ Import fp outfp _ (AddImplicitImport mn) -> do
68− rs <- addImplicitImport fp mn
71+ rs <- addImplicitImport fp mn
69− answerRequest outfp rs
72+ answerRequest outfp rs
70−handleCommand (Import fp outfp filters (AddImportForIdentifier ident)) = do
73+ Import fp outfp filters (AddImportForIdentifier ident) -> do
71− rs <- addImportForIdentifier fp ident filters
74+ rs <- addImportForIdentifier fp ident filters
72− case rs of
75+ case rs of
73− Right rs' -> answerRequest outfp rs'
76+ Right rs' -> answerRequest outfp rs'
77+ Left question ->
74− Left question -> pure $ CompletionResult (map completionFromMatch question)
78+ pure (CompletionResult (map completionFromMatch question))
75−handleCommand (Rebuild file) =
79+ Rebuild file ->
76− rebuildFile file
80+ rebuildFile file
77−handleCommand Cwd =
81+ Cwd ->
78− TextResult . toS <$> liftIO getCurrentDirectory
82+ TextResult . toS <$> liftIO getCurrentDirectory
83+ Reset ->
79−handleCommand Reset = resetIdeState *> pure (TextResult "State has been reset.")
84+ resetIdeState $> TextResult "State has been reset."
85+ Quit ->
80−handleCommand Quit = liftIO exitSuccess
86+ liftIO exitSuccess
81−
87+
82−findCompletions :: (Ide m) =>
88+findCompletions :: Ide m =>
83 [Filter] -> Matcher -> Maybe P.ModuleName -> m Success
89 [Filter] -> Matcher -> Maybe P.ModuleName -> m Success
84findCompletions filters matcher currentModule = do
90findCompletions filters matcher currentModule = do
85 modules <- getAllModules2 currentModule
91 modules <- getAllModules2 currentModule
86 pure . CompletionResult . map completionFromMatch . getCompletions filters matcher $ modules
92 pure . CompletionResult . map completionFromMatch . getCompletions filters matcher $ modules
87
93
88−findType :: (Ide m) =>
94+findType :: Ide m =>
89 Text -> [Filter] -> Maybe P.ModuleName -> m Success
95 Text -> [Filter] -> Maybe P.ModuleName -> m Success
90findType search filters currentModule = do
96findType search filters currentModule = do
91 modules <- getAllModules2 currentModule
97 modules <- getAllModules2 currentModule
92 pure . CompletionResult . map completionFromMatch . getExactMatches search filters $ modules
98 pure . CompletionResult . map completionFromMatch . getExactMatches search filters $ modules
93
99
94−findPursuitCompletions :: (MonadIO m) =>
100+findPursuitCompletions :: MonadIO m =>
95 PursuitQuery -> m Success
101 PursuitQuery -> m Success
96findPursuitCompletions (PursuitQuery q) =
102findPursuitCompletions (PursuitQuery q) =
97 PursuitResult <$> liftIO (searchPursuitForDeclarations q)
103 PursuitResult <$> liftIO (searchPursuitForDeclarations q)
98
104
99−findPursuitPackages :: (MonadIO m) =>
105+findPursuitPackages :: MonadIO m =>
100 PursuitQuery -> m Success
106 PursuitQuery -> m Success
101findPursuitPackages (PursuitQuery q) =
107findPursuitPackages (PursuitQuery q) =
102 PursuitResult <$> liftIO (findPackagesForModuleIdent q)
108 PursuitResult <$> liftIO (findPackagesForModuleIdent q)
103
109
104−printModules :: (Ide m) => m Success
110+printModules :: Ide m => m Success
105printModules = ModuleList . map runModuleNameT <$> getLoadedModulenames
111printModules = ModuleList . map runModuleNameT <$> getLoadedModulenames
106
112
107outputDirectory :: Ide m => m FilePath
113outputDirectory :: Ide m => m FilePath
@@ -131,54 +137,70 @@ addClause
131 -> m Success
137 -> m Success
132addClause t wca = MultilineTextResult <$> CS.addClause t wca
138addClause t wca = MultilineTextResult <$> CS.addClause t wca
133
139
134−importsForFile :: (MonadIO m, MonadError PscIdeError m) =>
140+-- | Finds all the externs.json files inside the output folder and returns the
135− FilePath -> m Success
141+-- corresponding Modulenames
136−importsForFile fp = do
137− imports <- getImportsForFile fp
138− pure (ImportList imports)
139−
140−-- | Takes the output directory and a filepath like "Monad.Control.Eff" and
141−-- looks up, whether that folder contains an externs.json
142−checkExternsPath :: FilePath -> FilePath -> IO (Maybe FilePath)
143−checkExternsPath oDir d
144− | d `elem` [".", ".."] = pure Nothing
145− | otherwise = do
146− let file = oDir </> d </> "externs.json"
147− ex <- doesFileExist file
148− if ex
149− then pure (Just file)
150− else pure Nothing
151−
152−findAllExterns :: (Ide m, MonadError PscIdeError m) => m [FilePath]
142+findAvailableExterns :: (Ide m, MonadError PscIdeError m) => m [P.ModuleName]
153−findAllExterns = do
143+findAvailableExterns = do
154 oDir <- outputDirectory
144 oDir <- outputDirectory
155 unlessM (liftIO (doesDirectoryExist oDir))
145 unlessM (liftIO (doesDirectoryExist oDir))
156 (throwError (GeneralError "Couldn't locate your output directory."))
146 (throwError (GeneralError "Couldn't locate your output directory."))
157 liftIO $ do
147 liftIO $ do
158− dirs <- getDirectoryContents oDir
148+ directories <- getDirectoryContents oDir
159− externPaths <- traverse (checkExternsPath oDir) dirs
149+ moduleNames <- filterM (checkExternsPath oDir) directories
160− pure (catMaybes externPaths)
150+ pure (P.moduleNameFromString <$> moduleNames)
161−
151+ where
152+ -- | Takes the output directory and a filepath like "Monad.Control.Eff" and
153+ -- looks up, whether that folder contains an externs.json
154+ checkExternsPath :: FilePath -> FilePath -> IO Bool
155+ checkExternsPath oDir d
156+ | d `elem` [".", ".."] = pure False
157+ | otherwise = do
158+ let file = oDir </> d </> "externs.json"
159+ doesFileExist file
160+
161+-- | Finds all matches for the globs specified at the commandline
162+findAllSourceFiles :: Ide m => m [FilePath]
163+findAllSourceFiles = do
164+ globs <- confGlobs . ideConfiguration <$> ask
165+ liftIO (concatMapM glob globs)
166+
167+-- | Looks up the ExternsFiles for the given Modulenames and loads them into the
168+-- server state. Then proceeds to parse all the specified sourcefiles and
169+-- inserts their ASTs into the state. Finally kicks off an async worker, which
170+-- populates Stage 2 and 3 of the state.
162loadModules
171loadModules
163 :: (Ide m, MonadError PscIdeError m, MonadLogger m)
172 :: (Ide m, MonadError PscIdeError m, MonadLogger m)
164 => [P.ModuleName]
173 => [P.ModuleName]
165 -> m Success
174 -> m Success
166−loadModules mns = do
175+loadModules moduleNames = do
176+ -- We resolve all the modulenames to externs files and load these into memory.
167 oDir <- outputDirectory
177 oDir <- outputDirectory
178+ let efPaths =
168− let efPaths = map (\mn -> oDir </> P.runModuleName mn </> "externs.json") mns
179+ map (\mn -> oDir </> P.runModuleName mn </> "externs.json") moduleNames
169 efiles <- traverse readExternFile efPaths
180 efiles <- traverse readExternFile efPaths
170 traverse_ insertExterns efiles
181 traverse_ insertExterns efiles
171− --TODO Get rid of this once ModuleOld is gone
182+
172− traverse_ insertModule efiles
183+ -- We parse all source files, log eventual parse failures if the debug flag
173− populateStage2
184+ -- was set and insert the succesful parses into the state.
174− pure (TextResult ("Loaded " <> foldMap runModuleNameT mns <> "."))
185+ (failures, allModules) <-
175−
186+ partitionEithers <$> (traverse parseModule =<< findAllSourceFiles)
176−loadAllModules :: (Ide m, MonadError PscIdeError m) => m Success
187+ unless (null failures) $
177−loadAllModules = do
188+ $(logDebug) ("Failed to parse: " <> show failures)
178− exts <- traverse readExternFile =<< findAllExterns
189+ traverse_ insertModule allModules
179− traverse_ insertExterns exts
190+
191+ -- Because we still need the "old" module format to resolve reexports in the
192+ -- worker thread, we insert it into the state aswell.
180− --TODO Get rid of this once ModuleOld is gone
193+ -- TODO Get rid of this once ModuleOld is gone
181− traverse_ insertModule exts
194+ traverse_ insertModuleOld efiles
195+
196+ -- Finally we kick off the worker with @async@ and return the number of
197+ -- successfully parsed modules.
182 env <- ask
198 env <- ask
199+ let runLogger =
200+ runStdoutLoggingT
201+ . filterLogger (\_ _ -> confDebug (ideConfiguration env))
202+ -- populateStage2 returns Unit for now, so it's fine to discard this result.
203+ -- We might want to block on this in a benchmarking situation.
183− _ <- liftIO $ async (runStdoutLoggingT (runReaderT populateStage2 env))
204+ _ <- liftIO (async (runLogger (runReaderT populateStage2 env)))
184− pure (TextResult "All modules loaded.")
205+ pure (TextResult ("Loaded " <> show (length efiles) <> " modules and "
206+ <> show (length allModules) <> " source files."))
src/Language/PureScript/Ide/CaseSplit.hs+3−2
@@ -36,6 +36,7 @@ import Language.PureScript.Ide.Types
36import Language.PureScript.Ide.Util
36import Language.PureScript.Ide.Util
37
37
38import Text.Parsec as Parsec
38import Text.Parsec as Parsec
39+import qualified Text.PrettyPrint.Boxes as Box
39
40
40type Constructor = (P.ProperName 'P.ConstructorName, [P.Type])
41type Constructor = (P.ProperName 'P.ConstructorName, [P.Type])
41
42
@@ -135,8 +136,8 @@ parseTypeDeclaration' s =
135 Right (P.TypeDeclaration i t) -> pure (i, t)
136 Right (P.TypeDeclaration i t) -> pure (i, t)
136 Right _ -> throwError (GeneralError "Found a non-type-declaration")
137 Right _ -> throwError (GeneralError "Found a non-type-declaration")
137 Left err ->
138 Left err ->
138− throwError (GeneralError ("Parsing the typesignature failed with: "
139+ throwError (GeneralError ("Parsing the type signature failed with: "
139− <> show err))
140+ <> toS (Box.render (P.prettyPrintParseError err))))
140
141
141splitFunctionType :: P.Type -> [P.Type]
142splitFunctionType :: P.Type -> [P.Type]
142splitFunctionType t = fromMaybe [] arguments
143splitFunctionType t = fromMaybe [] arguments
src/Language/PureScript/Ide/Reexports.hs+1−2
@@ -28,7 +28,6 @@ import Protolude
28
28
29import Data.List (union)
29import Data.List (union)
30import qualified Data.Map as Map
30import qualified Data.Map as Map
31−import qualified Data.Text as T
32import Language.PureScript.Ide.Types
31import Language.PureScript.Ide.Types
33import Language.PureScript.Ide.Externs
32import Language.PureScript.Ide.Externs
34import qualified Language.PureScript as P
33import qualified Language.PureScript as P
@@ -94,5 +93,5 @@ resolveReexports modules m =
94 then replaced
93 then replaced
95 else resolveReexports modules replaced
94 else resolveReexports modules replaced
96
95
97−resolveReexports2 :: Map T.Text [ExternDecl] -> ModuleOld -> Module
96+resolveReexports2 :: Map Text [ExternDecl] -> ModuleOld -> Module
98resolveReexports2 decls = convertModule . resolveReexports decls
97resolveReexports2 decls = convertModule . resolveReexports decls
src/Language/PureScript/Ide/SourceFile.hs+32−44
@@ -14,7 +14,12 @@
14
14
15{-# LANGUAGE OverloadedStrings #-}
15{-# LANGUAGE OverloadedStrings #-}
16
16
17−module Language.PureScript.Ide.SourceFile where
17+module Language.PureScript.Ide.SourceFile
18+ ( parseModule
19+ , getImportsForFile
20+ -- SOON...
21+ , getDeclPosition
22+ ) where
18
23
19import Protolude
24import Protolude
20
25
@@ -24,26 +29,18 @@ import Language.PureScript.Ide.Util
24import Language.PureScript.Ide.Externs (unwrapPositioned,
29import Language.PureScript.Ide.Externs (unwrapPositioned,
25 unwrapPositionedRef)
30 unwrapPositionedRef)
26import Language.PureScript.Ide.Types
31import Language.PureScript.Ide.Types
27−import System.Directory
28import System.FilePath
32import System.FilePath
29import System.IO.UTF8 (readUTF8File)
33import System.IO.UTF8 (readUTF8File)
30
34
31−parseModuleFromFile :: (MonadIO m, MonadError PscIdeError m) =>
35+parseModule
32− FilePath -> m P.Module
36+ :: (MonadIO m)
33−parseModuleFromFile fp = do
37+ => FilePath
34− exists <- liftIO (doesFileExist fp)
38+ -> m (Either FilePath (FilePath, P.Module) )
35− if exists
39+parseModule path = do
36− then do
37− content <- liftIO (readUTF8File fp)
40+ contents <- liftIO (readUTF8File path)
38− let m = do tokens <- P.lex fp content
41+ case P.parseModuleFromFile identity (path, contents) of
39− P.runTokenParser "" P.parseModule tokens
42+ Left _ -> pure (Left path)
40− either (throwError . (`ParseError` "File could not be parsed.")) pure m
43+ Right m -> pure (Right m)
41− else throwError (NotFound "File does not exist.")
42−
43−-- data Module = Module SourceSpan [Comment] ModuleName [Declaration] (Maybe [DeclarationRef])
44−
45−getDeclarations :: P.Module -> [P.Declaration]
46−getDeclarations (P.Module _ _ _ declarations _) = declarations
47
44
48getImports :: P.Module -> [(P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)]
45getImports :: P.Module -> [(P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)]
49getImports (P.Module _ _ _ declarations _) =
46getImports (P.Module _ _ _ declarations _) =
@@ -55,26 +52,21 @@ getImports (P.Module _ _ _ declarations _) =
55getImportsForFile :: (MonadIO m, MonadError PscIdeError m) =>
52getImportsForFile :: (MonadIO m, MonadError PscIdeError m) =>
56 FilePath -> m [ModuleImport]
53 FilePath -> m [ModuleImport]
57getImportsForFile fp = do
54getImportsForFile fp = do
58− module' <- parseModuleFromFile fp
55+ moduleE <- parseModule fp
59− let imports = getImports module'
56+ case moduleE of
57+ Left _ -> throwError (GeneralError "Failed to parse sourcefile.")
58+ Right (_, module') ->
60− pure (mkModuleImport . unwrapPositionedImport <$> imports)
59+ pure (mkModuleImport . unwrapPositionedImport <$> getImports module')
61− where
60+ where
62− mkModuleImport (mn, importType', qualifier) =
61+ mkModuleImport (mn, importType', qualifier) =
63− ModuleImport
62+ ModuleImport
64− (runModuleNameT mn)
63+ (runModuleNameT mn)
65− importType'
64+ importType'
66− (runModuleNameT <$> qualifier)
65+ (runModuleNameT <$> qualifier)
67− unwrapPositionedImport (mn, it, q) = (mn, unwrapImportType it, q)
66+ unwrapPositionedImport (mn, it, q) = (mn, unwrapImportType it, q)
68− unwrapImportType (P.Explicit decls) = P.Explicit (map unwrapPositionedRef decls)
67+ unwrapImportType (P.Explicit decls) = P.Explicit (map unwrapPositionedRef decls)
69− unwrapImportType (P.Hiding decls) = P.Hiding (map unwrapPositionedRef decls)
68+ unwrapImportType (P.Hiding decls) = P.Hiding (map unwrapPositionedRef decls)
70− unwrapImportType P.Implicit = P.Implicit
69+ unwrapImportType P.Implicit = P.Implicit
71−
72−getPositionedImports :: P.Module -> [P.Declaration]
73−getPositionedImports (P.Module _ _ _ declarations _) =
74− mapMaybe isImport declarations
75− where
76− isImport i@(P.PositionedDeclaration _ _ P.ImportDeclaration{}) = Just i
77− isImport _ = Nothing
78
70
79getDeclPosition :: P.Module -> Text -> Maybe P.SourceSpan
71getDeclPosition :: P.Module -> Text -> Maybe P.SourceSpan
80getDeclPosition m ident = getFirst (foldMap (match ident) decls)
72getDeclPosition m ident = getFirst (foldMap (match ident) decls)
@@ -102,9 +94,5 @@ getDeclPosition m ident = getFirst (foldMap (match ident) decls)
102 properEqual x q = runProperNameT x == q
94 properEqual x q = runProperNameT x == q
103 identEqual x q = runIdentT x == q
95 identEqual x q = runIdentT x == q
104
96
105−goToDefinition :: Text -> FilePath -> IO (Maybe P.SourceSpan)
97+ getDeclarations :: P.Module -> [P.Declaration]
106−goToDefinition q fp = do
98+ getDeclarations (P.Module _ _ _ declarations _) = declarations
107− m <- runExceptT (parseModuleFromFile fp)
108− case m of
109− Right module' -> pure (getDeclPosition module' q)
110− Left _ -> pure Nothing
src/Language/PureScript/Ide/State.hs+37−18
@@ -19,10 +19,12 @@
19module Language.PureScript.Ide.State
19module Language.PureScript.Ide.State
20 ( getLoadedModulenames
20 ( getLoadedModulenames
21 , getExternFiles
21 , getExternFiles
22− , insertModule
22+ , insertModuleOld
23 , resetIdeState
23 , resetIdeState
24 , cacheRebuild
24 , cacheRebuild
25 , insertExterns
25 , insertExterns
26+ , insertModule
27+ , insertModuleSTM
26 , insertExternsSTM
28 , insertExternsSTM
27 , getAllModules2
29 , getAllModules2
28 , getStage1
30 , getStage1
@@ -34,18 +36,19 @@ module Language.PureScript.Ide.State
34 ) where
36 ) where
35
37
36import Protolude
38import Protolude
39+import qualified Prelude
37
40
38import Control.Concurrent.STM
41import Control.Concurrent.STM
39import "monad-logger" Control.Monad.Logger
42import "monad-logger" Control.Monad.Logger
40import qualified Data.Map.Lazy as M
43import qualified Data.Map.Lazy as M
41−import qualified Data.Text as T
42−import Data.Time (getCurrentTime, diffUTCTime)
43import Language.PureScript.Externs
44import Language.PureScript.Externs
44import Language.PureScript.Ide.Externs
45import Language.PureScript.Ide.Externs
45import Language.PureScript.Ide.Reexports
46import Language.PureScript.Ide.Reexports
46import Language.PureScript.Ide.Types
47import Language.PureScript.Ide.Types
47import Language.PureScript.Ide.Util
48import Language.PureScript.Ide.Util
48import qualified Language.PureScript as P
49import qualified Language.PureScript as P
50+import System.Clock
51+import System.FilePath
49
52
50-- | Resets all State inside psc-ide
53-- | Resets all State inside psc-ide
51resetIdeState :: Ide m => m ()
54resetIdeState :: Ide m => m ()
@@ -68,16 +71,16 @@ getExternFiles = s1Externs <$> getStage1
68-- | Inserts an @ExternsFile@ into the PscIdeState. Also converts the
71-- | Inserts an @ExternsFile@ into the PscIdeState. Also converts the
69-- ExternsFile into psc-ide's internal Declaration format
72-- ExternsFile into psc-ide's internal Declaration format
70-- TODO: should be removed when the "old" Declaration format gets removed
73-- TODO: should be removed when the "old" Declaration format gets removed
71−insertModule :: Ide m => ExternsFile -> m ()
74+insertModuleOld :: Ide m => ExternsFile -> m ()
72−insertModule externsFile = do
75+insertModuleOld externsFile = do
73 stateVar <- envStateVar <$> ask
76 stateVar <- envStateVar <$> ask
74− liftIO . atomically $ insertModuleSTM stateVar externsFile
77+ liftIO . atomically $ insertModuleOldSTM stateVar externsFile
75
78
76−-- | STM version of insertModule
79+-- | STM version of insertModuleOld
77−insertModuleSTM :: TVar PscIdeState -> ExternsFile -> STM ()
80+insertModuleOldSTM :: TVar PscIdeState -> ExternsFile -> STM ()
78−insertModuleSTM st ef = modifyTVar st (insertModule' ef)
81+insertModuleOldSTM st ef = modifyTVar st (insertModule' ef)
79
82
80−-- | Pure version of insertModule
83+-- | Pure version of insertModuleOld
81insertModule' :: ExternsFile -> PscIdeState -> PscIdeState
84insertModule' :: ExternsFile -> PscIdeState -> PscIdeState
82insertModule' ef state =
85insertModule' ef state =
83 state
86 state
@@ -85,6 +88,22 @@ insertModule' ef state =
85 in M.insert mn decls (pscIdeStateModules state)
88 in M.insert mn decls (pscIdeStateModules state)
86 }
89 }
87
90
91+-- | Insert a Module into Stage1 of the State
92+insertModule :: Ide m => (FilePath, P.Module) -> m ()
93+insertModule module' = do
94+ stateVar <- ideStateVar <$> ask
95+ liftIO . atomically $ insertModuleSTM stateVar module'
96+
97+-- | STM version of insertModule
98+insertModuleSTM :: TVar IdeState -> (FilePath, P.Module) -> STM ()
99+insertModuleSTM ref (fp, module') =
100+ modifyTVar ref $ \x ->
101+ x { ideStage1 = (ideStage1 x) {
102+ s1Modules = M.insert
103+ (P.getModuleName module')
104+ (module', fp)
105+ (s1Modules (ideStage1 x))}}
106+
88-- | Retrieves Stage1 from the State.
107-- | Retrieves Stage1 from the State.
89-- This includes loaded Externfiles
108-- This includes loaded Externfiles
90-- (TODO: as soon as we actually parse the modules) aswell as the parsed modules
109-- (TODO: as soon as we actually parse the modules) aswell as the parsed modules
@@ -131,17 +150,17 @@ setStage2STM ref s2 = do
131-- cache
150-- cache
132getAllModules2 :: Ide m => Maybe P.ModuleName -> m [(P.ModuleName, [IdeDeclaration])]
151getAllModules2 :: Ide m => Maybe P.ModuleName -> m [(P.ModuleName, [IdeDeclaration])]
133getAllModules2 mmoduleName = do
152getAllModules2 mmoduleName = do
134− modules <- s2Modules <$> getStage2
153+ declarations <- s2Declarations <$> getStage2
135 rebuild <- cachedRebuild
154 rebuild <- cachedRebuild
136 case mmoduleName of
155 case mmoduleName of
137− Nothing -> pure (M.toList modules)
156+ Nothing -> pure (M.toList declarations)
138 Just moduleName ->
157 Just moduleName ->
139 case rebuild of
158 case rebuild of
140 Just (cachedModulename, ef)
159 Just (cachedModulename, ef)
141 | cachedModulename == moduleName ->
160 | cachedModulename == moduleName ->
142 pure . M.toList $
161 pure . M.toList $
143− M.insert moduleName (snd . convertModule . convertExterns $ ef) modules
162+ M.insert moduleName (snd . convertModule . convertExterns $ ef) declarations
144− _ -> pure (M.toList modules)
163+ _ -> pure (M.toList declarations)
145
164
146-- | Adds an ExternsFile into psc-ide's State Stage1. This does not populate the
165-- | Adds an ExternsFile into psc-ide's State Stage1. This does not populate the
147-- following Stages, which needs to be done after all the necessary Exterms have
166-- following Stages, which needs to be done after all the necessary Exterms have
@@ -175,11 +194,11 @@ populateStage2 :: (Ide m, MonadLogger m) => m ()
175populateStage2 = do
194populateStage2 = do
176 st <- ideStateVar <$> ask
195 st <- ideStateVar <$> ask
177 duration <- liftIO $ do
196 duration <- liftIO $ do
178− start <- getCurrentTime
197+ start <- getTime Monotonic
179 atomically (populateStage2STM st)
198 atomically (populateStage2STM st)
180− end <- getCurrentTime
199+ end <- getTime Monotonic
181− pure (diffUTCTime end start)
200+ pure (Prelude.show (diffTimeSpec start end))
182− $(logDebug) $ "Finished populating Stage2 in " <> T.pack (show duration)
201+ $(logDebug) $ "Finished populating Stage2 in " <> toS duration
183
202
184-- | STM version of populateStage2
203-- | STM version of populateStage2
185populateStage2STM :: TVar IdeState -> STM ()
204populateStage2STM :: TVar IdeState -> STM ()
src/Language/PureScript/Ide/Types.hs+5−3
@@ -12,7 +12,7 @@
12-- Type definitions for psc-ide
12-- Type definitions for psc-ide
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15−{-# LANGUAGE OverloadedStrings #-}
15+{-# LANGUAGE OverloadedStrings #-}
16
16
17module Language.PureScript.Ide.Types where
17module Language.PureScript.Ide.Types where
18
18
@@ -74,6 +74,7 @@ data Configuration =
74 Configuration
74 Configuration
75 { confOutputPath :: FilePath
75 { confOutputPath :: FilePath
76 , confDebug :: Bool
76 , confDebug :: Bool
77+ , confGlobs :: [FilePath]
77 }
78 }
78
79
79data IdeEnvironment =
80data IdeEnvironment =
@@ -102,17 +103,18 @@ emptyIdeState :: IdeState
102emptyIdeState = IdeState emptyStage1 emptyStage2
103emptyIdeState = IdeState emptyStage1 emptyStage2
103
104
104emptyStage1 :: Stage1
105emptyStage1 :: Stage1
105−emptyStage1 = Stage1 M.empty
106+emptyStage1 = Stage1 M.empty M.empty
106
107
107emptyStage2 :: Stage2
108emptyStage2 :: Stage2
108emptyStage2 = Stage2 M.empty Nothing
109emptyStage2 = Stage2 M.empty Nothing
109
110
110data Stage1 = Stage1
111data Stage1 = Stage1
111 { s1Externs :: M.Map P.ModuleName P.ExternsFile
112 { s1Externs :: M.Map P.ModuleName P.ExternsFile
113+ , s1Modules :: M.Map P.ModuleName (P.Module, FilePath)
112 }
114 }
113
115
114data Stage2 = Stage2
116data Stage2 = Stage2
115− { s2Modules :: M.Map P.ModuleName [IdeDeclaration]
117+ { s2Declarations :: M.Map P.ModuleName [IdeDeclaration]
116 , s2CachedRebuild :: Maybe (P.ModuleName, P.ExternsFile)
118 , s2CachedRebuild :: Maybe (P.ModuleName, P.ExternsFile)
117 }
119 }
118
120