Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
cloogle.org
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cloogle
cloogle.org
Commits
c49b8bc8
Verified
Commit
c49b8bc8
authored
Jan 31, 2017
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add include_builtins field
parent
8394d109
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
37 deletions
+41
-37
README.md
README.md
+2
-3
backend/Cloogle.dcl
backend/Cloogle.dcl
+8
-7
backend/Cloogle.icl
backend/Cloogle.icl
+8
-7
backend/CloogleServer.icl
backend/CloogleServer.icl
+23
-20
No files found.
README.md
View file @
c49b8bc8
...
...
@@ -127,9 +127,8 @@ JSON request with at least one of the following fields:
*
`name`
, the name of the function to search for.
*
`className`
, the name of the class to search for.
*
`typeName`
, the name of the type to search for.
*
`libraries`
, a list of two elements:
*
A list of names of libraries to search in
*
A boolean, whether language builtins should be searched or not.
*
`libraries`
, a list of names of libraries to search in.
*
`include_builtins`
, a boolean, whether language builtins should be searched or not.
*
`modules`
, a list of names of modules to search in.
*
`page`
: 0 for the first
*n*
results, 1 for the next
*n*
, etc.
...
...
backend/Cloogle.dcl
View file @
c49b8bc8
...
...
@@ -6,13 +6,14 @@ from Data.Maybe import :: Maybe
from
Text
.
JSON
import
generic
JSONEncode
,
generic
JSONDecode
,
::
JSONNode
::
Request
=
{
unify
::
Maybe
String
,
name
::
Maybe
String
,
className
::
Maybe
String
,
typeName
::
Maybe
String
,
modules
::
Maybe
[
String
]
,
libraries
::
Maybe
([
String
],
Bool
)
,
page
::
Maybe
Int
=
{
unify
::
Maybe
String
,
name
::
Maybe
String
,
className
::
Maybe
String
,
typeName
::
Maybe
String
,
modules
::
Maybe
[
String
]
,
libraries
::
Maybe
[
String
]
,
include_builtins
::
Maybe
Bool
,
page
::
Maybe
Int
}
::
Response
...
...
backend/Cloogle.icl
View file @
c49b8bc8
...
...
@@ -11,13 +11,14 @@ derive JSONDecode Request, Response, Result, ShortClassResult, BasicResult,
instance
zero
Request
where
zero
=
{
unify
=
Nothing
,
name
=
Nothing
,
className
=
Nothing
,
typeName
=
Nothing
,
modules
=
Nothing
,
libraries
=
Nothing
,
page
=
Nothing
zero
=
{
unify
=
Nothing
,
name
=
Nothing
,
className
=
Nothing
,
typeName
=
Nothing
,
modules
=
Nothing
,
libraries
=
Nothing
,
include_builtins
=
Nothing
,
page
=
Nothing
}
instance
zero
Response
...
...
backend/CloogleServer.icl
View file @
c49b8bc8
...
...
@@ -38,13 +38,14 @@ MAX_RESULTS :== 15
CACHE_PREFETCH
:==
5
::
RequestCacheKey
=
{
c_unify
::
Maybe
Type
,
c_name
::
Maybe
String
,
c_className
::
Maybe
String
,
c_typeName
::
Maybe
String
,
c_modules
::
Maybe
[
String
]
,
c_libraries
::
Maybe
([
String
],
Bool
)
,
c_page
::
Maybe
Int
=
{
c_unify
::
Maybe
Type
,
c_name
::
Maybe
String
,
c_className
::
Maybe
String
,
c_typeName
::
Maybe
String
,
c_modules
::
Maybe
[
String
]
,
c_libraries
::
Maybe
[
String
]
,
c_include_builtins
::
Bool
,
c_page
::
Int
}
derive
JSONEncode
Kind
,
ClassOrGeneric
,
Type
,
RequestCacheKey
...
...
@@ -53,13 +54,14 @@ where toString rck = toString $ toJSON rck
toRequestCacheKey
::
Request
->
RequestCacheKey
toRequestCacheKey
r
=
{
c_unify
=
r
.
unify
>>=
parseType
o
fromString
,
c_name
=
r
.
name
,
c_className
=
r
.
className
,
c_typeName
=
r
.
typeName
,
c_modules
=
sort
<$>
r
.
modules
,
c_libraries
=
appFst
sort
<$>
r
.
libraries
,
c_page
=
r
.
page
<|>
Just
0
{
c_unify
=
r
.
unify
>>=
parseType
o
fromString
,
c_name
=
r
.
name
,
c_className
=
r
.
className
,
c_typeName
=
r
.
typeName
,
c_modules
=
sort
<$>
r
.
modules
,
c_libraries
=
sort
<$>
r
.
libraries
,
c_include_builtins
=
fromJust
(
r
.
include_builtins
<|>
Just
True
)
,
c_page
=
fromJust
(
r
.
page
<|>
Just
0
)
}
Start
w
...
...
@@ -135,7 +137,7 @@ where
#
w
=
writeCache
Brief
req`
resp`
w
=
cachePages
key
(
npages
-
1
)
(
i
+
1
)
response
keep
w
where
req`
=
{
key
&
c_page
=
((+)
i
)
<$>
(
key
.
c_page
<|>
pure
0
)
}
req`
=
{
key
&
c_page
=
key
.
c_page
+
i
}
resp`
=
{
response
&
more_available
=
Just
$
max
0
(
length
results
-
MAX_RESULTS
)
...
...
@@ -153,9 +155,10 @@ where
suggs
_
_
_
=
Nothing
search
::
!
Request
!
TypeDB
->
[
Result
]
search
{
unify
,
name
,
className
,
typeName
,
modules
,
libraries
,
page
}
db
search
{
unify
,
name
,
className
,
typeName
,
modules
,
libraries
,
page
,
include_builtins
}
db
#
include_builtins
=
fromJust
(
include_builtins
<|>
Just
True
)
#
db
=
case
libraries
of
(
Just
ls
)
=
filterLocations
(
isLibMatch
ls
)
db
(
Just
ls
)
=
filterLocations
(
isLibMatch
include_builtins
ls
)
db
Nothing
=
db
#
db
=
case
modules
of
(
Just
ms
)
=
filterLocations
(
isModMatch
ms
)
db
...
...
@@ -387,9 +390,9 @@ where
isModMatch
mods
(
Location
_
mod
_
_
_)
=
isMember
mod
mods
isModMatch
_
(
Builtin
_)
=
False
isLibMatch
::
(![
String
],
!
Bool
)
Location
->
Bool
isLibMatch
(
libs
,_)
(
Location
lib
_
_
_
_)
=
any
(\
l
->
indexOf
l
lib
==
0
)
libs
isLibMatch
(_,
blti
)
(
Builtin
_)
=
blti
isLibMatch
::
!
Bool
![
String
]
Location
->
Bool
isLibMatch
_
libs
(
Location
lib
_
_
_
_)
=
any
(\
l
->
indexOf
l
lib
==
0
)
libs
isLibMatch
blti
_
(
Builtin
_)
=
blti
loc
::
Location
->
LocationResult
loc
(
Location
lib
mod
ln
iln
_)
=
(
lib
,
mod
,
ln
,
iln
)
...
...
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