-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support static json file caching #19
Conversation
8159343
to
8755547
Compare
I think I need is. deoplete-go is to slow :/ When I press |
@fatih 1-2sec !? I test now, return 0.3-0.5... |
@fatih Statically caching for Go stdlib packages. If you test it, Move BTW, Does not yet on/off setting value. but I will add. Don't worry :) |
@fatih Mine is blazing fast. I'll test and look at this tomorrow. Gonna do some other work now. |
FYI, |
@zchee sorry not sure what you said there. What do you mean? |
@nhooyr Open https://github.com/zchee/deoplete-go/blob/master/test/fmt.go, type |
Oh i see, interesting. Well I'll take a look at the rest tomorrow, bye. |
We do not need but it will be displayed in comments Fix this problem and need |
Hi @zchee, Is it possible to make caching automatically? And when is cache invalidated? For example If I add my own package and I modify the package after 2 days and add new identifiers into it, what will happen to the cache? |
@fatih Not automatically. and I will only update commit the json for each version up of Go.
If you typed package has been import in the buffer, cache invalidated.
If we create the wrapper(or decomposition) of |
2531196
to
7b05831
Compare
e9b81f5
to
78e5da3
Compare
@nhooyr @fatih @svanharmelen Hi, Also included Go v1.6 I usually use How to install:
If you have a time, Could you test it? 🙏 If exists any strings before the current cursor, cache completion does not work. package main
import (
"fmt"
)
func main() {
fmt.Println("test")
// os package does not import
// and exists string before cursor
fmt.Println(os.|)
// syscall package does not import, also not exists string before cursor
// will be cache completion works fine
syscall.|
} I'm advance next plan. If no reply, It will be merged after a while. (maybe 2, 3 days) Thanks! |
also, now |
@zchee just played a little with this and it seems to work fine. But I must admit I don't really notice much difference (if any) in speed as my completion was already very fast without the caching. So is speed the only reason for the caching, or does it fix any another use cases? As for the usability, you currently have to do a few manual steps in order to get things setup. If using a newer or older Go version, you would first have to run Wouldn't it be an idea to not ship the pre-generated JSON files with the I guess that would be a much better user experience as setting up stuff (or updating afterwards) will only be 1 |
Yes, fast result is important, but this branch's goal is not the fast result. OK, I'm consider |
21b3659
to
c51d16a
Compare
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 <[email protected]>
c4850f3
to
eef6f7b
Compare
- Add parses library name - e.g. 'go/ast' is 'go' - If imported 'github.com/pkg/errors', ignore cache for 'errors' - Change json cache files - 'go/ast' is '/path/to/go/ast.json' - 'errors' is '/path/to/errors/errors.json' Signed-off-by: Koichi Shiraishi <[email protected]>
Now fixed the wrong completion list if duplicate package name (e.g. Maybe no bug. |
Avoid the execute gocode during this condition
Conditions
context['input']
Flow
1. Parse current import package
2. Check current input
1. Parse current import package
.
) on your type3. If...else and return
If all
true
on2. Check current input
, return the static caching json data.Avoid the execute gocode. So can be fast response.
else, exec the
gocode
, and return result.Currently not yet tested.