Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
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
张蕾
Geth-Modification
Commits
f0868098
Commit
f0868098
authored
Feb 20, 2016
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jsre: fix <tab><tab> completion magic
parent
5542b51b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
completion.go
jsre/completion.go
+12
-3
completion_test.go
jsre/completion_test.go
+5
-1
No files found.
jsre/completion.go
View file @
f0868098
...
...
@@ -55,9 +55,18 @@ func getCompletions(vm *otto.Otto, line string) (results []string) {
}
}
})
// e.g. web3<tab><tab> append dot since its an object
if
obj
,
_
=
vm
.
Object
(
line
);
obj
!=
nil
{
results
=
append
(
results
,
line
+
"."
)
// Append opening parenthesis (for functions) or dot (for objects)
// if the line itself is the only completion.
if
len
(
results
)
==
1
&&
results
[
0
]
==
line
{
obj
,
_
:=
vm
.
Object
(
line
)
if
obj
!=
nil
{
if
obj
.
Class
()
==
"Function"
{
results
[
0
]
+=
"("
}
else
{
results
[
0
]
+=
"."
}
}
}
sort
.
Strings
(
results
)
...
...
jsre/completion_test.go
View file @
f0868098
...
...
@@ -40,7 +40,11 @@ func TestCompleteKeywords(t *testing.T) {
}{
{
input
:
"x"
,
want
:
[]
string
{
"x"
,
"x."
},
want
:
[]
string
{
"x."
},
},
{
input
:
"x.someMethod"
,
want
:
[]
string
{
"x.someMethod("
},
},
{
input
:
"x."
,
...
...
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