Skip to content

Commit

Permalink
deps: x/tools and gopls 1d492ad1
Browse files Browse the repository at this point in the history
* internal/lsp/cache: add additional spans for tracing 1d492ad1
* internal/lsp/cache: fix race condition in type-checking fd6a59f2
* internal/imports: ignore invalid mod cache entries 6b3d1c9b
* internal/lsp: avoid using the importer's context as much as possible 2a03e9e3
* internal/lsp: turn on completion documentation by default adb45749
* internal/lsp: fix declarations in references df305b82
* internal/lsp: fix deadlock in type-checking 70bfb602
* go/ssa/interp: skip recover2 testcase 958971f5
* gopls: update x/tools version a4fdb3a8
* internal/lsp: use memoize store's context when type checking 2b65078b
* go/packages: make sure to request dependencies when we NeedTypesInfo 56125e7d
* internal/lsp/source: fixes completion for slice literals of pointers 2161848f
* internal/lsp: enable deep completion and fuzzy matching by default 6afc7fca
* x/tools/gopls: add fallback to default GOPATH if missing f340ed3a
* internal/imports: skip scanned module cache dirs 340205e5
* go/packages,internal/lsp: skip memory-intensive tests on the linux-arm builder 5d7988b7
* internal/imports: use cache of mod cache pkgs in find packages ee1fc86a
* internal/imports: avoid walking dir for mod file in mod cache 857b4dd9
* internal/lsp: add prepare rename support c9403068
* internal/lsp: add foldingRange support 114c5755
* go/packages: set GOPACKAGESDRIVER=off for all the tests 88604bcf
* go/analysis/passes/printf: handle a potential nil pointer bce66953
* go/packages: ignore Cgo compilation error correctly f4d89772
* x/tools/gopls: reimplement rpc logging at a lower level d151469a
* internal/lsp: use protocol.Ranges for source.Identifier 42f498d3
* go/analysis/cmd/vet: remove aed303cb
* internal/lsp: initialize CodeActionProvider with supported actions a0cf054a
* internal/lsp: limit deep completion search scope b29f5f60
* cmd/gopls: add documentation 062dbaeb
* internal/lsp: add tests at the diff hook layer 71894ab6
* internal/lsp: start handling watched file change events 1f0dd028
* internal/lsp: add additional information when logging errors 11cc3c15
* go/internal/gcimporter: make safe for concurrent use 07722704
* go/analysis: handle common nil pointers c2567a22
* internal/lsp: support renaming of import spec c4a336ef
* internal/lsp: use the explicit import spec name as ident 71f556f0
* internal/lsp: return error when renaming within an import spec fc82fb2a
* internal/telemetry: add the ability to flush telemetry data 65e3620a
* internal/telemetry: pass the http.Client to the ocagent fa80cb57
* internal/lsp: use protocol.Range in completion items 547ecf7b
* internal/lsp: unlabel context, log errors when canceled 3aeeb259
* internal/imports: save information about the module cache 324b3533
* internal/lsp: speed up deep completion search f0be937d
* internal/lsp: abstract the diff library so it can be substituted 85edb9ef
* internal/telemetry: change concurrency model d9ab56aa
* internal/lsp: test adding imports for package statements with comments 15fda70b
* internal/lsp: prefer inserting imports into existing blocks d308a98e
* internal/lsp: separate out getMapper function 6889da9d
* internal/lsp: add completions of unimported std lib pkgs caa95bb4
* internal/lsp: use protocol.Range for diagnostics instead of span.Span a857023c
* internal/lsp: return rename errors for one package only d5940c88
* internal/imports: get candidate imports d0b42650
* internal/telemetry: clean up the exporter api 5b08f89b
* internal/lsp: propagate hoverKind to completion documentation 25624417
* internal/lsp: label context cancellation errors 3100af0b
* internal/telemetry: extract units to their own package 922a4ee3
* internal/lsp: split the telemetry library out 156eb2ae
* internal/lsp: limit concurrent file reads d87e9bba
* internal/lsp: fix bug renaming local vars with test files present 9065c182
* internal/imports: merge import declarations ea414246
* internal/imports: use the resolver to load exports 578fe565
* internal/imports: test exported functions with nil args 4cb0cfd1
* go/packages: work around another case where go list doesn't respect -e 9fae7b2c
* go/packages: add test case for golang/go#33462 f60b6e7d
* go/packages: set -mod=readonly when processing overlays in module mode 5b18234b
* go/packages: handle more errors that 'go list' prints to stderr 597f5776
* internal/lsp: fix race condition in caching 60bb3025
* internal/lsp: add fuzzy completion matching 2adf8288
* internal/lsp: show generated warning on didChange, not didOpen 9dba7caf
* internal/lsp: use memoize package to cache source.Packages 62ee0342
* internal/lsp: don't deep complete struct field names 41f33577
* go/analysis: add a "-fix" flag to checker to apply suggested fixes 97f12d73
* internal/lsp: fix data race in cmd tests 528a2984
* go/packages: add a test case for golang/go#32499 afc36949
* internal/imports: return initialized options 2ad8dc80
* internal/lsp: ignore files that begin with underscores 1e8b33d6
* internal/lsp: support an experimental structured hover format 89a01ca1
* internal/lsp: change ordering of hover depending on hoverKind 0d62d440
* internal/imports: fix setting default options 4147ede4
* internal/lsp: fix documentation for completion items f07d81a5
* go/analysis: remove +experimental build tag from suggested fixes e713427f
* go/packages: handle ad-hoc overlays with sources outside modules a804cf87
* internal/lsp: prevent too much open files issues 128824a2
* x/tools/cmd/gopls: prevent nil pointer dereferences b346f7fd
* internal/lsp: minor refactoring for source.Identifier 8be58fba
* internal/lsp: show "do not edit" message when user opens generated file cae9aa54
* go/packages: add a test for ad-hoc packages in overlays 88ddfceb
* internal/lsp/testdata: delete nodisk/newdisk_exists.go 9fb8e5c8
* go/packages: rewrite Go 1.11's no such directory err to look like 1.13's 6743d409
* internal/lsp: use x/xerrors to create new errors be5259f2
* internal/lsp/cmd: handle errors when adding a file 249e2b9b
* internal/lsp/cmd: remove unused isRace global variable in cmd 73d70853
* internal/lsp: do not show errors for code actions on go.mod files 1dcc99b6
* internal/lsp: support single-line hover for LSP clients like Vim 982211fc
* go/analysis: change AllObjectFacts and AllPackageFacts to filter facts 35ef2682
* go/packages: handle case when go list returns absolute ImportPath c5a2fd39
* internal/lsp/telemetry/ocagent: add convertAnnotation tests e1fc249b
* internal/lsp: format files that parse in packages with parse errors 2756c524
* gopls: return file error if file open fails 773fe550
* go/analysis/passes/printf: improve support for %w 1d172726
* internal/lsp: handle potential nil pointers in GetToken 43c5e4ca
* internal/gopathwalk: fix typo ("nonexistant" → "nonexistent") e9bb7d36
* internal/imports, internal/lsp: quick fix import errors 5f95ed59
* internal/imports: fix typos in documentation 1e85ed80
* x/tools/internal/imports: don't load package names for empty list 5a5cfefe
* internal/lsp: extra telemetry tagging of files and packages c001e47e
* internal/lsp: fix watched file protocol constants dddb7617
* internal/lsp: set initialized state 09f9cfa8
* internal/lsp: find import errors for named imports a81e99d7
* internal/lsp: use correct desc for annotation ed3277de
* internal/lsp/cache: clean up parse.go 7deaedd4
* internal/lsp/source: fix renaming of SuggestedFixes in experimental file ff9f1409
* internal/lsp: process configuration per workspace folder fc6e2057
  • Loading branch information
myitcv committed Sep 5, 2019
1 parent 46ffc9c commit 54ed795
Show file tree
Hide file tree
Showing 147 changed files with 6,500 additions and 2,679 deletions.
2 changes: 1 addition & 1 deletion cmd/govim/complete.go
Expand Up @@ -53,7 +53,7 @@ func (v *vimstate) complete(args ...json.RawMessage) (interface{}, error) {
Abbr: i.Label,
Menu: i.Detail,
Word: i.TextEdit.NewText,
Info: i.Detail,
Info: i.Documentation,
})
}

Expand Down
20 changes: 13 additions & 7 deletions cmd/govim/gopls_client.go
Expand Up @@ -18,8 +18,9 @@ const (

var _ protocol.Client = (*govimplugin)(nil)

func (g *govimplugin) ShowMessage(context.Context, *protocol.ShowMessageParams) error {
panic("not implemented yet")
func (g *govimplugin) ShowMessage(ctxt context.Context, params *protocol.ShowMessageParams) error {
g.logGoplsClientf("Asked to show a message: %v", params.Message)
return nil
}
func (g *govimplugin) ShowMessageRequest(context.Context, *protocol.ShowMessageRequestParams) (*protocol.MessageActionItem, error) {
panic("not implemented yet")
Expand All @@ -46,19 +47,24 @@ func (g *govimplugin) WorkspaceFolders(context.Context) ([]protocol.WorkspaceFol
func (g *govimplugin) Configuration(ctxt context.Context, params *protocol.ConfigurationParams) ([]interface{}, error) {
defer absorbShutdownErr()
g.logGoplsClientf("Configuration: %v", pretty.Sprint(params))
// Assert based on the current behaviour of gopls
want := 1
if got := len(params.Items); want != got {
return nil, fmt.Errorf("govim gopls client: expected %v item(s) in params; got %v", want, got)

// gopls now sends params.Items for each of the configured
// workspaces. For now, we assume that the first item will be
// for the section "gopls" and only configure that. We will
// configure further workspaces when we add support for them.
if len(params.Items) == 0 || params.Items[0].Section != "gopls" {
return nil, fmt.Errorf("govim gopls client: expected at least one item, with the first section \"gopls\"")
}
res := make([]interface{}, len(params.Items))
conf := make(map[string]interface{})
if !g.usePopupWindows() {
conf[goplsConfigNoDocsOnHover] = true
conf[goplsConfigHoverKind] = "NoDocumentation"
} else {
conf[goplsConfigHoverKind] = "FullDocumentation"
}
return []interface{}{conf}, nil
res[0] = conf
return res, nil
}
func (g *govimplugin) ApplyEdit(context.Context, *protocol.ApplyWorkspaceEditParams) (*protocol.ApplyWorkspaceEditResponse, error) {
panic("not implemented yet")
Expand Down
36 changes: 27 additions & 9 deletions cmd/govim/internal/golang_org_x_tools/gopathwalk/walk.go
Expand Up @@ -59,15 +59,27 @@ func SrcDirsRoots(ctx *build.Context) []Root {
// paths of the containing source directory and the package directory.
// add will be called concurrently.
func Walk(roots []Root, add func(root Root, dir string), opts Options) {
WalkSkip(roots, add, func(Root, string) bool { return false }, opts)
}

// WalkSkip walks Go source directories ($GOROOT, $GOPATH, etc) to find packages.
// For each package found, add will be called (concurrently) with the absolute
// paths of the containing source directory and the package directory.
// For each directory that will be scanned, skip will be called (concurrently)
// with the absolute paths of the containing source directory and the directory.
// If skip returns false on a directory it will be processed.
// add will be called concurrently.
// skip will be called concurrently.
func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) {
for _, root := range roots {
walkDir(root, add, opts)
walkDir(root, add, skip, opts)
}
}

func walkDir(root Root, add func(Root, string), opts Options) {
func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) {
if _, err := os.Stat(root.Path); os.IsNotExist(err) {
if opts.Debug {
log.Printf("skipping nonexistant directory: %v", root.Path)
log.Printf("skipping nonexistent directory: %v", root.Path)
}
return
}
Expand All @@ -77,6 +89,7 @@ func walkDir(root Root, add func(Root, string), opts Options) {
w := &walker{
root: root,
add: add,
skip: skip,
opts: opts,
}
w.init()
Expand All @@ -91,9 +104,10 @@ func walkDir(root Root, add func(Root, string), opts Options) {

// walker is the callback for fastwalk.Walk.
type walker struct {
root Root // The source directory to scan.
add func(Root, string) // The callback that will be invoked for every possible Go package dir.
opts Options // Options passed to Walk by the user.
root Root // The source directory to scan.
add func(Root, string) // The callback that will be invoked for every possible Go package dir.
skip func(Root, string) bool // The callback that will be invoked for every dir. dir is skipped if it returns true.
opts Options // Options passed to Walk by the user.

ignoredDirs []os.FileInfo // The ignored directories, loaded from .goimportsignore files.
}
Expand Down Expand Up @@ -151,12 +165,16 @@ func (w *walker) getIgnoredDirs(path string) []string {
return ignoredDirs
}

func (w *walker) shouldSkipDir(fi os.FileInfo) bool {
func (w *walker) shouldSkipDir(fi os.FileInfo, dir string) bool {
for _, ignoredDir := range w.ignoredDirs {
if os.SameFile(fi, ignoredDir) {
return true
}
}
if w.skip != nil {
// Check with the user specified callback.
return w.skip(w.root, dir)
}
return false
}

Expand Down Expand Up @@ -184,7 +202,7 @@ func (w *walker) walk(path string, typ os.FileMode) error {
return filepath.SkipDir
}
fi, err := os.Lstat(path)
if err == nil && w.shouldSkipDir(fi) {
if err == nil && w.shouldSkipDir(fi, path) {
return filepath.SkipDir
}
return nil
Expand Down Expand Up @@ -224,7 +242,7 @@ func (w *walker) shouldTraverse(dir string, fi os.FileInfo) bool {
if !ts.IsDir() {
return false
}
if w.shouldSkipDir(ts) {
if w.shouldSkipDir(ts, dir) {
return false
}
// Check for symlink loops by statting each directory component
Expand Down

0 comments on commit 54ed795

Please sign in to comment.