-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid the call gocode during this condition - Conditions - Hook the insert of dot(.) - Typed the package has not yet been imported use context['input'] - Match the typed package name and json file name Signed-off-by: Koichi Shiraishi <k@zchee.io>
- Loading branch information
Showing
278 changed files
with
836 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
./benchmark | ||
./build | ||
./images | ||
./plugin | ||
./*.tags | ||
|
||
# json tarballs | ||
*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,7 @@ docs/_build/ | |
|
||
# PyBuilder | ||
target/ | ||
|
||
|
||
# json tarballs | ||
*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.6.2-alpine | ||
MAINTAINER zchee <k@zchee.io> | ||
|
||
RUN set -ex \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
make \ | ||
git \ | ||
tar \ | ||
python3 \ | ||
\ | ||
&& go get -u -v github.com/nsf/gocode | ||
|
||
COPY ./ /deoplete-go | ||
|
||
RUN cd /deoplete-go \ | ||
&& make gen_json \ | ||
\ | ||
&& tar cf json_1.6.2_linux_amd64.tar.gz ./data/json/1.6.2/linux_amd64 | ||
|
||
CMD ["cat", "/deoplete-go/json_1.6.2_linux_amd64.tar.gz"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/usr/bin/env python3 | ||
import json | ||
import os | ||
import subprocess | ||
import sys | ||
import re | ||
|
||
def main(): | ||
base_offset = 41 | ||
|
||
go_version_raw = subprocess.Popen("go version", | ||
shell=True, | ||
stdout=subprocess.PIPE | ||
).stdout.read() | ||
|
||
go_version = str(go_version_raw).split(' ')[2].strip('go') | ||
go_os = sys.argv[1] | ||
go_arch = sys.argv[2] | ||
|
||
with open('./stdlib-' + go_version + '_' + go_os + '_' + go_arch + '.txt') as stdlib: | ||
packages = stdlib.read().splitlines() | ||
|
||
for pkg in packages: | ||
template_file = './template.go' | ||
f = open(template_file) | ||
fs = f.read(-1) | ||
|
||
func = None | ||
if re.search(r'/', pkg): | ||
func = str(pkg).split(r'/')[-1] | ||
else: | ||
func = pkg | ||
source = str(fs).replace('IMPORT', pkg).replace('FUNC', func).encode() | ||
|
||
offset = base_offset + (len(pkg) + len(func)) | ||
|
||
process = subprocess.Popen([FindBinaryPath('gocode'), | ||
'-f=json', | ||
'autocomplete', | ||
template_file, | ||
str(offset)], | ||
stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
start_new_session=True) | ||
process.stdin.write(source) | ||
stdout_data, stderr_data = process.communicate() | ||
result = json.loads(stdout_data.decode()) | ||
|
||
out_dir = os.path.join( | ||
'./json', go_version, go_os + '_' + go_arch) | ||
if not os.path.exists(out_dir): | ||
os.makedirs(out_dir) | ||
|
||
out_path = \ | ||
os.path.join(out_dir, func + '.json') | ||
out = open(out_path, 'w') | ||
out.write(json.dumps(result, sort_keys=True)) | ||
out.close() | ||
|
||
print(pkg) | ||
|
||
|
||
def FindBinaryPath(cmd): | ||
def is_exec(fpath): | ||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK) | ||
|
||
fpath, fname = os.path.split(cmd) | ||
if fpath: | ||
if is_exec(cmd): | ||
return cmd | ||
else: | ||
for path in os.environ["PATH"].split(os.pathsep): | ||
path = path.strip('"') | ||
binary = os.path.join(path, cmd) | ||
if is_exec(binary): | ||
return binary | ||
return error(self.vim, 'gocode binary not found') | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0, [{"class": "const", "name": "Size", "type": ""}, {"class": "func", "name": "Checksum", "type": "func(data []byte) uint32"}, {"class": "func", "name": "New", "type": "func() hash.Hash32"}]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0, [{"class": "const", "name": "BlockSize", "type": ""}, {"class": "func", "name": "NewCipher", "type": "func(key []byte) (cipher.Block, error)"}, {"class": "type", "name": "KeySizeError", "type": "int"}]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0, [{"class": "func", "name": "Decode", "type": "func(dst []byte, src []byte, flush bool) (ndst int, nsrc int, err error)"}, {"class": "func", "name": "Encode", "type": "func(dst []byte, src []byte) int"}, {"class": "func", "name": "MaxEncodedLen", "type": "func(n int) int"}, {"class": "func", "name": "NewDecoder", "type": "func(r io.Reader) io.Reader"}, {"class": "func", "name": "NewEncoder", "type": "func(w io.Writer) io.WriteCloser"}, {"class": "type", "name": "CorruptInputError", "type": "int64"}]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0, [{"class": "const", "name": "ClassApplication", "type": ""}, {"class": "const", "name": "ClassContextSpecific", "type": ""}, {"class": "const", "name": "ClassPrivate", "type": ""}, {"class": "const", "name": "ClassUniversal", "type": ""}, {"class": "const", "name": "TagBitString", "type": ""}, {"class": "const", "name": "TagBoolean", "type": ""}, {"class": "const", "name": "TagEnum", "type": ""}, {"class": "const", "name": "TagGeneralString", "type": ""}, {"class": "const", "name": "TagGeneralizedTime", "type": ""}, {"class": "const", "name": "TagIA5String", "type": ""}, {"class": "const", "name": "TagInteger", "type": ""}, {"class": "const", "name": "TagOID", "type": ""}, {"class": "const", "name": "TagOctetString", "type": ""}, {"class": "const", "name": "TagPrintableString", "type": ""}, {"class": "const", "name": "TagSequence", "type": ""}, {"class": "const", "name": "TagSet", "type": ""}, {"class": "const", "name": "TagT61String", "type": ""}, {"class": "const", "name": "TagUTCTime", "type": ""}, {"class": "const", "name": "TagUTF8String", "type": ""}, {"class": "func", "name": "Marshal", "type": "func(val interface{}) ([]byte, error)"}, {"class": "func", "name": "Unmarshal", "type": "func(b []byte, val interface{}) (rest []byte, err error)"}, {"class": "func", "name": "UnmarshalWithParams", "type": "func(b []byte, val interface{}, params string) (rest []byte, err error)"}, {"class": "type", "name": "BitString", "type": "struct"}, {"class": "type", "name": "Enumerated", "type": "int"}, {"class": "type", "name": "Flag", "type": "bool"}, {"class": "type", "name": "ObjectIdentifier", "type": "[]int"}, {"class": "type", "name": "RawContent", "type": "[]byte"}, {"class": "type", "name": "RawValue", "type": "struct"}, {"class": "type", "name": "StructuralError", "type": "struct"}, {"class": "type", "name": "SyntaxError", "type": "struct"}]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0, [{"class": "const", "name": "Bad", "type": ""}, {"class": "const", "name": "Con", "type": ""}, {"class": "const", "name": "FilterFuncDuplicates", "type": ""}, {"class": "const", "name": "FilterImportDuplicates", "type": ""}, {"class": "const", "name": "FilterUnassociatedComments", "type": ""}, {"class": "const", "name": "Fun", "type": ""}, {"class": "const", "name": "Lbl", "type": ""}, {"class": "const", "name": "Pkg", "type": ""}, {"class": "const", "name": "RECV", "type": ""}, {"class": "const", "name": "SEND", "type": ""}, {"class": "const", "name": "Typ", "type": ""}, {"class": "const", "name": "Var", "type": ""}, {"class": "func", "name": "FileExports", "type": "func(src *ast.File) bool"}, {"class": "func", "name": "FilterDecl", "type": "func(decl ast.Decl, f ast.Filter) bool"}, {"class": "func", "name": "FilterFile", "type": "func(src *ast.File, f ast.Filter) bool"}, {"class": "func", "name": "FilterPackage", "type": "func(pkg *ast.Package, f ast.Filter) bool"}, {"class": "func", "name": "Fprint", "type": "func(w io.Writer, fset *token.FileSet, x interface{}, f ast.FieldFilter) error"}, {"class": "func", "name": "Inspect", "type": "func(node ast.Node, f func(ast.Node) bool)"}, {"class": "func", "name": "IsExported", "type": "func(name string) bool"}, {"class": "func", "name": "MergePackageFiles", "type": "func(pkg *ast.Package, mode ast.MergeMode) *ast.File"}, {"class": "func", "name": "NewCommentMap", "type": "func(fset *token.FileSet, node ast.Node, comments []*ast.CommentGroup) ast.CommentMap"}, {"class": "func", "name": "NewIdent", "type": "func(name string) *ast.Ident"}, {"class": "func", "name": "NewObj", "type": "func(kind ast.ObjKind, name string) *ast.Object"}, {"class": "func", "name": "NewPackage", "type": "func(fset *token.FileSet, files map[string]*ast.File, importer ast.Importer, universe *ast.Scope) (*ast.Package, error)"}, {"class": "func", "name": "NewScope", "type": "func(outer *ast.Scope) *ast.Scope"}, {"class": "func", "name": "NotNilFilter", "type": "func(_ string, v reflect.Value) bool"}, {"class": "func", "name": "PackageExports", "type": "func(pkg *ast.Package) bool"}, {"class": "func", "name": "Print", "type": "func(fset *token.FileSet, x interface{}) error"}, {"class": "func", "name": "SortImports", "type": "func(fset *token.FileSet, f *ast.File)"}, {"class": "func", "name": "Walk", "type": "func(v ast.Visitor, node ast.Node)"}, {"class": "type", "name": "ArrayType", "type": "struct"}, {"class": "type", "name": "AssignStmt", "type": "struct"}, {"class": "type", "name": "BadDecl", "type": "struct"}, {"class": "type", "name": "BadExpr", "type": "struct"}, {"class": "type", "name": "BadStmt", "type": "struct"}, {"class": "type", "name": "BasicLit", "type": "struct"}, {"class": "type", "name": "BinaryExpr", "type": "struct"}, {"class": "type", "name": "BlockStmt", "type": "struct"}, {"class": "type", "name": "BranchStmt", "type": "struct"}, {"class": "type", "name": "CallExpr", "type": "struct"}, {"class": "type", "name": "CaseClause", "type": "struct"}, {"class": "type", "name": "ChanDir", "type": "int"}, {"class": "type", "name": "ChanType", "type": "struct"}, {"class": "type", "name": "CommClause", "type": "struct"}, {"class": "type", "name": "Comment", "type": "struct"}, {"class": "type", "name": "CommentGroup", "type": "struct"}, {"class": "type", "name": "CommentMap", "type": "map[ast.Node][]*ast.CommentGroup"}, {"class": "type", "name": "CompositeLit", "type": "struct"}, {"class": "type", "name": "Decl", "type": "interface"}, {"class": "type", "name": "DeclStmt", "type": "struct"}, {"class": "type", "name": "DeferStmt", "type": "struct"}, {"class": "type", "name": "Ellipsis", "type": "struct"}, {"class": "type", "name": "EmptyStmt", "type": "struct"}, {"class": "type", "name": "Expr", "type": "interface"}, {"class": "type", "name": "ExprStmt", "type": "struct"}, {"class": "type", "name": "Field", "type": "struct"}, {"class": "type", "name": "FieldFilter", "type": "func(name string, value reflect.Value) bool"}, {"class": "type", "name": "FieldList", "type": "struct"}, {"class": "type", "name": "File", "type": "struct"}, {"class": "type", "name": "Filter", "type": "func(string) bool"}, {"class": "type", "name": "ForStmt", "type": "struct"}, {"class": "type", "name": "FuncDecl", "type": "struct"}, {"class": "type", "name": "FuncLit", "type": "struct"}, {"class": "type", "name": "FuncType", "type": "struct"}, {"class": "type", "name": "GenDecl", "type": "struct"}, {"class": "type", "name": "GoStmt", "type": "struct"}, {"class": "type", "name": "Ident", "type": "struct"}, {"class": "type", "name": "IfStmt", "type": "struct"}, {"class": "type", "name": "ImportSpec", "type": "struct"}, {"class": "type", "name": "Importer", "type": "func(imports map[string]*ast.Object, path string) (pkg *ast.Object, err error)"}, {"class": "type", "name": "IncDecStmt", "type": "struct"}, {"class": "type", "name": "IndexExpr", "type": "struct"}, {"class": "type", "name": "InterfaceType", "type": "struct"}, {"class": "type", "name": "KeyValueExpr", "type": "struct"}, {"class": "type", "name": "LabeledStmt", "type": "struct"}, {"class": "type", "name": "MapType", "type": "struct"}, {"class": "type", "name": "MergeMode", "type": "uint"}, {"class": "type", "name": "Node", "type": "interface"}, {"class": "type", "name": "ObjKind", "type": "int"}, {"class": "type", "name": "Object", "type": "struct"}, {"class": "type", "name": "Package", "type": "struct"}, {"class": "type", "name": "ParenExpr", "type": "struct"}, {"class": "type", "name": "RangeStmt", "type": "struct"}, {"class": "type", "name": "ReturnStmt", "type": "struct"}, {"class": "type", "name": "Scope", "type": "struct"}, {"class": "type", "name": "SelectStmt", "type": "struct"}, {"class": "type", "name": "SelectorExpr", "type": "struct"}, {"class": "type", "name": "SendStmt", "type": "struct"}, {"class": "type", "name": "SliceExpr", "type": "struct"}, {"class": "type", "name": "Spec", "type": "interface"}, {"class": "type", "name": "StarExpr", "type": "struct"}, {"class": "type", "name": "Stmt", "type": "interface"}, {"class": "type", "name": "StructType", "type": "struct"}, {"class": "type", "name": "SwitchStmt", "type": "struct"}, {"class": "type", "name": "TypeAssertExpr", "type": "struct"}, {"class": "type", "name": "TypeSpec", "type": "struct"}, {"class": "type", "name": "TypeSwitchStmt", "type": "struct"}, {"class": "type", "name": "UnaryExpr", "type": "struct"}, {"class": "type", "name": "ValueSpec", "type": "struct"}, {"class": "type", "name": "Visitor", "type": "interface"}]] |
Oops, something went wrong.