MCPcopy Create free account
hub / github.com/nsf/gocode / resolveKnownPackageIdent

Function resolveKnownPackageIdent

cursorcontext.go:423–437  ·  view source on GitHub ↗

Decl deduction failed, but we're on " .", this ident can be an unexported package, let's try to match the ident against a set of known packages and if it matches try to import it. TODO: Right now I've made a static list of built-in packages, but in theory we could scan all GOPATH packages as w

(ident string, filename string, context *package_lookup_context)

Source from the content-addressed store, hash-verified

421// scan the packages. And many of them will have conflicts. Can we make a smart
422// prediction algorithm which will prefer certain packages over another ones?
423func resolveKnownPackageIdent(ident string, filename string, context *package_lookup_context) *package_file_cache {
424 importPath, ok := knownPackageIdents[ident]
425 if !ok {
426 return nil
427 }
428
429 path, ok := abs_path_for_package(filename, importPath, context)
430 if !ok {
431 return nil
432 }
433
434 p := new_package_file_cache(path, importPath)
435 p.update_cache()
436 return p
437}
438
439var knownPackageIdents = map[string]string{
440 "adler32": "hash/adler32",

Callers 1

aproposMethod · 0.85

Calls 3

abs_path_for_packageFunction · 0.85
new_package_file_cacheFunction · 0.85
update_cacheMethod · 0.80

Tested by

no test coverage detected