Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
adfa3af9
Commit
adfa3af9
authored
Nov 05, 2013
by
Eyal Dechter
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'notebook_completions' into directives
parents
fc177677
26630501
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
Completion.hs
IHaskell/Completion.hs
+6
-3
Writer.hs
IHaskell/Message/Writer.hs
+2
-1
Types.hs
IHaskell/Types.hs
+1
-0
No files found.
IHaskell/Completion.hs
View file @
adfa3af9
...
@@ -15,7 +15,7 @@ module IHaskell.Completion (makeCompletions) where
...
@@ -15,7 +15,7 @@ module IHaskell.Completion (makeCompletions) where
import
Prelude
import
Prelude
import
Data.List
import
Data.List
import
IHaskell.Types
import
IHaskell.Types
import
GhcMonad
(
liftIO
)
import
GhcMonad
(
liftIO
,
GhcMonad
)
import
qualified
GHC
import
qualified
GHC
import
Outputable
(
showPpr
)
import
Outputable
(
showPpr
)
import
Data.Char
import
Data.Char
...
@@ -26,6 +26,8 @@ import Data.Aeson
...
@@ -26,6 +26,8 @@ import Data.Aeson
import
IHaskell.Message.Writer
import
IHaskell.Message.Writer
import
qualified
Data.ByteString.Lazy
as
L
import
qualified
Data.ByteString.Lazy
as
L
makeCompletions
::
GHC
.
GhcMonad
m
=>
MessageHeader
->
Message
->
m
Message
makeCompletions
replyHeader
(
CompleteRequest
hdr
code
line
pos
)
=
do
makeCompletions
replyHeader
(
CompleteRequest
hdr
code
line
pos
)
=
do
ns
<-
GHC
.
getRdrNamesInScope
ns
<-
GHC
.
getRdrNamesInScope
...
@@ -33,9 +35,10 @@ makeCompletions replyHeader (CompleteRequest hdr code line pos) = do
...
@@ -33,9 +35,10 @@ makeCompletions replyHeader (CompleteRequest hdr code line pos) = do
let
candidate
=
getWordAt
(
toString
line
)
pos
let
candidate
=
getWordAt
(
toString
line
)
pos
opts
|
Just
cand
<-
candidate
=
filter
(
cand
`
isPrefixOf
`)
$
map
(
showPpr
fs
)
ns
opts
|
Just
cand
<-
candidate
=
filter
(
cand
`
isPrefixOf
`)
$
map
(
showPpr
fs
)
ns
|
otherwise
=
[]
|
otherwise
=
[]
matched_text
=
fromString
$
maybe
""
id
candidate
let
reply
=
CompleteReply
replyHeader
(
map
fromString
opts
)
line
True
let
reply
=
CompleteReply
replyHeader
(
map
fromString
opts
)
matched_text
line
True
liftIO
(
L
.
putStrLn
$
encode
$
toJSON
reply
)
liftIO
(
L
.
putStrLn
$
encode
$
toJSON
reply
)
return
reply
return
reply
...
...
IHaskell/Message/Writer.hs
View file @
adfa3af9
...
@@ -56,8 +56,9 @@ instance ToJSON Message where
...
@@ -56,8 +56,9 @@ instance ToJSON Message where
"execution_count"
.=
execCount
,
"execution_count"
.=
execCount
,
"code"
.=
code
"code"
.=
code
]
]
toJSON
(
CompleteReply
_
m
t
s
)
=
object
[
toJSON
(
CompleteReply
_
m
mt
t
s
)
=
object
[
"matches"
.=
m
,
"matches"
.=
m
,
"matched_text"
.=
mt
,
"text"
.=
t
,
"text"
.=
t
,
"status"
.=
if
s
then
"ok"
::
String
else
"error"
"status"
.=
if
s
then
"ok"
::
String
else
"error"
]
]
...
...
IHaskell/Types.hs
View file @
adfa3af9
...
@@ -204,6 +204,7 @@ data Message
...
@@ -204,6 +204,7 @@ data Message
|
CompleteReply
{
|
CompleteReply
{
header
::
MessageHeader
,
header
::
MessageHeader
,
completionMatches
::
[
ByteString
],
completionMatches
::
[
ByteString
],
completionMatchedText
::
ByteString
,
completionText
::
ByteString
,
completionText
::
ByteString
,
completionStatus
::
Bool
completionStatus
::
Bool
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment