Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Cloogle
cloogle.org
Commits
d0244e26
Verified
Commit
d0244e26
authored
Nov 21, 2018
by
Camil Staps
🐟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show including apps suggestion also on typeName/className queries
parent
1ab45a97
Pipeline
#16575
passed with stage
in 15 minutes and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
backend/CloogleServer.icl
backend/CloogleServer.icl
+14
-13
frontend/api.js
frontend/api.js
+4
-0
No files found.
backend/CloogleServer.icl
View file @
d0244e26
...
...
@@ -213,7 +213,7 @@ errexit msg rcode w
=
setReturnCode
rcode
w
handle
::
!
RankSettings
!(
Maybe
Request
)
!*
CloogleDB
!*
World
->
*(!
Response
,
!(!
Maybe
CacheKey
,
!
MicroSeconds
),
!*
CloogleDB
,
!*
World
)
handle
_
Nothing
db
w
=
(
err
InvalidInput
"Couldn't parse input"
,
(
Nothing
,
0
),
db
,
w
)
handle
_
Nothing
db
w
=
(
err
InvalidInput
"Couldn't parse input"
Nothing
,
(
Nothing
,
0
),
db
,
w
)
handle
rsets
(
Just
request
=:{
unify
,
name
,
page
})
db
w
#!
(
start
,
w
)
=
nsTime
w
//Check cache
...
...
@@ -223,13 +223,13 @@ handle rsets (Just request=:{unify,name,page}) db w
#
r
=
fromJust
mbResponse
=
respond
start
Nothing
{
r
&
return
=
if
(
r
.
return
==
0
)
1
r
.
return
}
db
w
|
isJust
name
&&
size
(
fromJust
name
)
>
40
=
respond
start
Nothing
(
err
InvalidName
"Function name too long"
)
db
w
=
respond
start
Nothing
(
err
InvalidName
"Function name too long"
Nothing
)
db
w
|
isJust
name
&&
any
isSpace
(
fromString
$
fromJust
name
)
=
respond
start
Nothing
(
err
InvalidName
"Name cannot contain spaces"
)
db
w
=
respond
start
Nothing
(
err
InvalidName
"Name cannot contain spaces"
Nothing
)
db
w
|
isJust
unify
&&
isNothing
(
parseType
$
fromString
$
fromJust
unify
)
=
respond
start
Nothing
(
err
InvalidType
"Couldn't parse type"
)
db
w
=
respond
start
Nothing
(
err
InvalidType
"Couldn't parse type"
Nothing
)
db
w
|
all
isNothing
[
unify
,
name
,
request
.
typeName
,
request
.
className
]
&&
isNothing
request
.
using
=
respond
start
Nothing
(
err
InvalidInput
"Empty query"
)
db
w
=
respond
start
Nothing
(
err
InvalidInput
"Empty query"
Nothing
)
db
w
// Results
#!
drop_n
=
fromJust
(
page
<|>
pure
0
)
*
MAX_RESULTS
#!
(
res
,
suggs
,
db
)
=
searchWithSuggestions
rsets
request
db
...
...
@@ -245,7 +245,7 @@ handle rsets (Just request=:{unify,name,page}) db w
#!
(
results
,
nextpages
)
=
splitAt
MAX_RESULTS
results
// Response
#!
response
=
if
(
isEmpty
results
)
(
err
NoResults
"No results"
)
(
err
NoResults
"No results"
suggs
)
{
zero
&
data
=
results
,
more_available
=
Just
more
...
...
@@ -402,10 +402,11 @@ where
}
makeLogEntry
_
_
=
abort
"CloogleServer: failure in makeLogEntry
\n
"
err
::
CloogleError
String
->
Response
err
c
m
=
{
return
=
toInt
c
,
data
=
[]
,
msg
=
m
,
more_available
=
Nothing
,
suggestions
=
Nothing
}
err
::
!
CloogleError
!
String
!(
Maybe
[(
Request
,
Int
)])
->
Response
err
c
m
suggs
=
{
return
=
toInt
c
,
data
=
[]
,
msg
=
m
,
more_available
=
Nothing
,
suggestions
=
suggs
}
frontend/api.js
View file @
d0244e26
...
...
@@ -677,6 +677,10 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
var
sugstrmeta
=
[];
if
(
'
name
'
in
sug
)
{
sugstr
.
push
(
sug
.
name
);
}
else
if
(
'
typeName
'
in
sug
)
{
sugstr
.
push
(
'
type
'
+
sug
.
typeName
);
}
else
if
(
'
className
'
in
sug
)
{
sugstr
.
push
(
'
class
'
+
sug
.
className
);
}
if
(
'
unify
'
in
sug
)
{
sugstr
.
push
(
'
::
'
+
sug
.
unify
);
...
...
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