1
0
mirror of https://github.com/golang/go synced 2024-10-01 10:18:32 -06:00
Commit Graph

3762 Commits

Author SHA1 Message Date
Muir Manders
5bac78f585 internal/lsp: add label completion candidates
Now we offer completion candidates for labels when completing "break",
"continue", and "goto" statements. We are reasonably smart about
filtering unusable labels, except we don't filter "goto" candidates
that jump across variable definitions.

Fixes golang/go#33987.

Change-Id: If296a7579845aba5d86c7050ab195c35d4b147ed
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197417
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-16 23:06:01 +00:00
Rebecca Stambler
f6a1a6ff8e internal/lsp: check if the go/packages context has been canceled
Recently been noticing errors where we don't have full metadata for a
given package. It seems to me that, since we added the context to the
packages.Config, there have been cases where the context is canceled on
the first load, and then we type-check with incomplete data. I'm still
not sure if allowing go/packages to be canceled is the correct approach.

Change-Id: I6767ce763538bd579458c8f8db07f15c9eec7b4a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201518
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Muir Manders <muir@mnd.rs>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 22:21:47 +00:00
Rebecca Stambler
eec4c98bf5 go/packages: fix staticcheck warnings
Ran gopls with staticcheck enabled and found these warnings.

Change-Id: I0b41c0daa19ac98c778d643530c9cb3f5f994399
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201442
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 22:20:41 +00:00
Rebecca Stambler
6f5e27347a go/packages: handle invalid files in overlays
This change handles a specific case where `go list` returns an error on
a file that lacks a package declaration. If only one package is returned
as a response, we should add that file to that package, since it may
have valid content in an overlay.

This change uses the internal/span package to correctly parse the error
message from `go list`.

Change-Id: I5909c4fd765746df1003685aa915b7c5f9cdcee5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201220
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 22:16:03 +00:00
Rebecca Stambler
f0068bd333 internal/lsp: remove misleading check span
This span resulted in misleading information, since it would appear any
time you called the Check function. This function often returns cached
results, so it's not particularly useful.

Change-Id: I26be652a99b906fb2e8703ff9af86fbe2ef5fc5d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201219
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-16 19:48:01 +00:00
Michael Matloob
ba31bb9056 go/analysis: remove requirement for unique Analyzer names
It's hard to prevent two independent analysis writers from
using the same name so enforcing this requiremnet just
causes trouble for analysis writers. Remove the requirement.

It would be nice to guarantee that two packages don't introduce
analyses with the same name, but because analyses are values
and not types, they don't have a logical package.

Change-Id: Iad3493e02ceae04ba3e9015c3e9c68ed9fa4b5a2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201218
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
2019-10-16 18:38:41 +00:00
Rebecca Stambler
89dd9f8220 go/packages: handle multiple modules in gopackagestest
Adding a second module to the gopackagestest configuration exposed a
flaky failure. go/packages was attempting to construct an ID relative to
a module. Depending on which module it saw first, it could construct a
relative path based on the incorrect module. Add an additional module to
the overlay tests to make sure we don't regress here.

Also, fix up a few staticcheck errors that were spotted along the way.

Change-Id: I53c2c0eee62ff88eadcb96a3770452dd7799312e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199645
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 18:04:19 +00:00
Pontus Leitzler
6223712555 internal/lsp: fix lsp trace log format for gopls
The -rpc.trace flag in gopls enables logging in "lsp inspector format".
Currently sent responses isn't parsed by the lsp inspector so it fails to
parse gopls logs.

The lsp inspector regexp matcher requires the duration to be prefixed with
"took" instead of "in", e.g. "took <d>ms.".

This change updates gopls to match the log parser in lsp inspector,
see 9aff7a6939/lsp-inspector/src/logParser/rawLogParser.ts (L88)

Change-Id: I3696faf34ba4f0b3d4e205693eaf378941f2f68f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199517
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-16 17:14:07 +00:00
Rebecca Stambler
9c6d90b5a7 internal/lsp: use the analyzer's pointer instead of name
Analyzer names are not guaranteed to be unique.

Change-Id: I4d4cc9fa746cbfbea9926f2cae0eb5dfc41027a5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201217
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-15 21:12:01 +00:00
Rebecca Stambler
f936694f27 internal/lsp: add analyses to the snapshot
This change makes sure that actionHandles are cached within the
snapshot, to minimize the cost of re-computing action handles on each
run of go/analysis.

Change-Id: If6191c5224285eb207aebb997787ea551a47fbaa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201098
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-15 15:04:14 +00:00
Daved
18e3458ac9 cmd/present: fix origin mismatch for websocket when using HTTPS
Fixes golang/go#31328

Change-Id: Ib190f42970d5b203e3f1fbf997aa896cf624bf91
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171118
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 20:52:21 +00:00
Michael Matloob
539cdc44f8 go/packages: temporarily disable some tests running on go tip with -race
A change in go/types has uncovered a race in go/packages. While we debug,
ignore those tests when running on tip with -race to make the builders
green. This change will be reverted as soon as the issue is fixed.

Updates golang/go#31749

Change-Id: I96f0b30a1bc203a5c36a2ce30c943583b7f8035a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200819
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-14 17:20:00 +00:00
Rebecca Stambler
b53505e708 internal/lsp: cache analysis using memoize package
This change moves to the approach of caching the analysis using the
memoize package. This means that we will do less work, as we no longer
need to recompute results that are unchanged. The cache key for an
analysis is simply the key of the CheckPackageHandle, along with the
name of the analyzer.

Change-Id: I0e589ccf088ff1de5670401b7207ffa77a254ceb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200817
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-14 17:19:42 +00:00
Shengjing Zhu
5fa5b1782b gopls/doc: instructions for adding settings in coc.nvim
Change-Id: I7d69477cc103e8e45b0e9394e32945a0d8ee19b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200868
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-14 14:15:50 +00:00
Peter Weinberger
8de300cfc2 internal/lsp/protocol: handle case of an otherwise empty notification
Some notifications, like exit, have no other arguments, a case the code
was not handling correctly.

Change-Id: Ib5ff536352ba6ad0d09cd80c9d5f0a987abbe500
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200298
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Peter Weinberger <pjw@google.com>
2019-10-12 15:20:04 +00:00
Michael Matloob
4c025a95b2 go/packages: make a copy of the config.Env slice in the test.
Before this change, we were "saving" config.Env and then appending
to it to create a new slice, like so:

  savedEnv := config.Env
  ...
  // for each test case
    config.Env = append(savedEnv, additionalValue)

but we're modifying savedEnv during each env. Even though it might
work, it's not doing what we expect. Clean this up.

Change-Id: Idcf8199d836241df2b934308863512c566c0c485
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200769
Run-TryBot: Michael Matloob <matloob@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 21:18:36 +00:00
Emmanuel T Odeke
7667e13ae9 internal/telemetry: modify *Subscriber to take timeAt
Modifies the various Subscriber signatures to take in
an "at" time.Time field, which captures the time that
a measurement was made. This field will then be used
when exporting points as their EndTime.

Fixes #34490.

Change-Id: I9e87b65e374876ae3d4df0abedb64bb7dcb221b6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199577
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-11 20:42:57 +00:00
Muir Manders
59731289e9 internal/lsp: include context in go/packages config
Include the context when invoking go/packages.Load so it is
cancelable. Otherwise if the user is manually typing an import or
otherwise messing around with imports, a big queue of potentially very
slow go/packages.Load calls will build up.

Fixes golang/go#34414.

Change-Id: I80732086b478b908c720739708dd773e81fe2b81
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200058
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 19:56:53 +00:00
Rebecca Stambler
638914d249 internal/lsp: return an error from {Narrowest,Widest}CheckPackageHandle
This will prevent us from panicking in cases with errors.

Fixes golang/go#34824

Change-Id: I02c20655f6926ec00c1591a905ff5a107cc44192
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200300
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-11 16:51:06 +00:00
Ian Cottrell
5889748991 internal/lsp: use options hooks to install diff driver
Change-Id: I2f94c2a68d0036a47ccac3fce07cf9f3b784d443
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200558
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 16:38:31 +00:00
Ian Cottrell
17d4c77023 internal/lsp: fix unified diffs of edits at the end of a file
Change-Id: I3a7db9261f0bc16609af6d58b363ec52474cb07e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200697
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 16:38:14 +00:00
Ian Cottrell
2c43fbf27d internal/lsp: fix test failures caused by diff algorithm variance
Fixes golang/go#34833

Change-Id: I7f8c1d3214914af40a8b9c3532f9a0a6e17246c0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200557
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 16:37:56 +00:00
Ian Cottrell
e5ffc44a6f internal/lsp: remove edit fixups from rename now diff is functional
Change-Id: I9b26388abe4b1470605852c71c397c7fddf7fdef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199740
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:19:05 +00:00
Ian Cottrell
a26de0c301 gopls: use go-diff for edit generation
this supports sub-line diffs and is much faster

Fixes golang/go#33003
Fixes golang/go#32586
Updates golang/go#31937

Change-Id: I02f82c75828e7e3ec804e8beee916893d4c14b3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/191018
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:18:25 +00:00
Ian Cottrell
7025dca8be internal/lsp: expand edits to whole lines in ToUnified
We don't want to support sub line edits or non line context in the unified diff
printing.

Change-Id: I4267b11b50f12d817dac0fbbae7e1db44ca3dad0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199739
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:14:46 +00:00
Ian Cottrell
6ac766747f internal/lsp: merge diffing test data sets
also improve the actual verification of the unified diff

Change-Id: I9c23c24e1fc8571cce2a7879463659ec7069fe99
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199738
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:13:25 +00:00
Ian Cottrell
7822de7a2d internal/lsp: fix patch tests on builders
Fixes golang/go#34620

Change-Id: Id8e2310c27d5697a8988b9e8dc85be979f9b8d40
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199737
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-10 20:12:59 +00:00
Jay Conrod
8abd424004 internal/imports: skip TestModeGetmodeVendor
Test is broken by recent cmd/go vendoring changes. Skipping the test
case while we figure out what to do.

Updates golang/go#34826

Change-Id: I31a6f18e40420970251e25836edcf32c56c10ef5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200299
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-10 17:12:13 +00:00
Nathan Dias
0337d82405 ocagent: convert Int64Data and Float64Data metrics to *wire.Metric.
Histogram data still needs to be converted and
timestamps are not attached as they are not yet available.

What works:

* convertMetric will now convert Int64Data and Float64Data.

What does not work yet:

* Histogram64Int and Histogram64Float will still not be converted.
* StartTime and EndTime will not be attached to timeseries and points.
* MetricDescriptors will not have a unit attached.
* no labels will be attached to timeseries.

Updates golang/go#33819

Change-Id: I65f9af716ba6282e809d0a9d10777d70475e4c83
GitHub-Last-Rev: 10820a9971e1f4c0529fadc567b2533256c2e961
GitHub-Pull-Request: golang/tools#170
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199857
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-10 07:50:00 +00:00
Brad Fitzpatrick
b090f1f240 go/analysis/passes/asmdecl: remove amd64p32 support
Updates golang/go#30439

Change-Id: I46c7de8d16c3470f2f20a4d0e03b74bb38c8aff0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199500
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-10-09 21:34:38 +00:00
Ian Cottrell
6536af71d9 internal/span: end of file is now last line +1
We already accepted it as a valid input, but for output we still produced
last_line,last_column+1
Also add package docs and improve error messages

Change-Id: I017aa326e8392134e67e8fabec47e750c8055454
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199641
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-07 18:54:44 +00:00
Agniva De Sarker
79dbfd6c86 cmd/godoc: update findGOROOT
After godoc stopped being part of the Go distribution, the location
of the godoc binary and the go binary can be different. Hence the old
GOROOT finding logic does not work anymore.

We shell out to "go env GOROOT" to return the new GOROOT.

Fixes golang/go#23445

Change-Id: I16e4c0798e3f5cda13d9f6546cf82808a10c4a0b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199279
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-07 18:40:23 +00:00
Rebecca Stambler
944452d4f0 internal/lsp: stop cluttering logs with highlight errors
We used to return an error from textDocument/highlight if the cursor
wasn't over an identifier. Logging these errors is not useful, as the
cursor is often not on an identifier.

Change-Id: Ibb43908149315c72923a22bdca567aa2b3ee68d8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199640
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-07 17:20:23 +00:00
Panos Georgiadis
83b12cb08e Fix vscode config to watch file changes
Fix the documentation by using the correct configuration for
watching file changes outside of the editor.

Fixes https://github.com/microsoft/vscode-go/issues/2810

Change-Id: Ib550d9831fe4563ceb5917d9196b201a03b051d2
GitHub-Last-Rev: 86c49abed8a0c79b641e02a23128b4654d2d6d48
GitHub-Pull-Request: golang/tools#169
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199578
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-07 17:02:13 +00:00
Dan Kortschak
af92b0ef1f godoc/vfs/zipfs: fix godoc formatting
Change-Id: I0303e362e82b713823b46247d15baa2ff6f6a344
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-07 15:17:16 +00:00
Ian Cottrell
c9f9432ec4 internal/lsp: clean up ApplyEdits
This should be a faster but equivalent implementation.

Change-Id: I7bc756644c601b953ba7715e093bfa10ca5ea97b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198878
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-05 01:44:04 +00:00
Ian Cottrell
5bee6a6eb8 internal/lsp: cleanup the diff package
Make sure everything is documented and move things to sensible files now all the
cross package shuffling is done

Change-Id: I884053a207d6741cda066afa5da91b00f1dfd31c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198877
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-05 01:43:51 +00:00
Michael Matloob
43d3a2ca2a go/packages: update tests to reflect changes in golang.org/cl/198459
That change changes the name of an ad-hoc package go list produces
to contain the names of the files instead of just being called
"command-line-arguments". It also means go list will report multiple
packages for an ad-hoc package that's not saved on disk that contains
multiple sources.

Update test cases that depend on this behavior.

One thing to be aware of: the change in go list (without additional
changes in go/packages) will break users depending on ad-hoc
packages with multiple files, when the any of the  files don't exist
on disk. We're not adding a work-around in this cl because overlays
aren't guaranteed to be 100% correct and the LSP doesn't need this
functionality. If this turns out to be a problem we can fix it.

Change-Id: I342cd3cb54bf35992186ee02ddd9ac316ff1db4f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199097
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-04 21:17:43 +00:00
Matts966
d89860af3b go/analysis/analysistest: fix nil pointer dereference when sorting facts
Without this change, we can't use `ExportPackageFact` function with analysistest package.

PackageFacts are keyed by nil and analysistest.check crashed while sorting, due to a nil object dereference.

Change-Id: Ic94c71acc9c74012bf150e1d72e937da8dfdff75
GitHub-Last-Rev: 51c91008a6756e66c630bfeabc9b8da08c12bfdd
GitHub-Pull-Request: golang/tools#163
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196758
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-10-04 19:10:47 +00:00
jaap aarts
27eeabb020 internal/lsp: convert comments to markdown before sending to client
This converts all the comments from golang doc syntax to popper markdown.

Fixes #34161

Change-Id: If513100170e7d8c159bfa93b0d1e36d293e9872f
GitHub-Last-Rev: 093f82e6ad8567b3e41bcf5daf14e9c0b5832015
GitHub-Pull-Request: golang/tools#165
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197760
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-10-04 18:35:38 +00:00
Rebecca Stambler
b22818684c go/internal/gcimporter: support Go versions < 1.11
Fixes golang/go#34689

Change-Id: I7ab6c5a00c24a188b2dbd75160091cf6c834bd6a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199037
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-04 18:21:43 +00:00
Rebecca Stambler
72853e10c5 go/internal/gcimporter: handle the possibility of a nil fileset
This panic was found by running the gopherjs tests:
https://circleci.com/gh/gopherjs/gopherjs/1767.

Change-Id: Ica97f31d20bbbd541b40ae3fd17594238883706a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198857
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-04 05:50:02 +00:00
Ian Cottrell
88641d98b3 internal/lsp: cleanup the diff/myers package
The only exposed symbol is now the ComputeEdits function, all other functionality
is now moved up to the diff layer and using edits instead of operations.

Change-Id: I149e4f3276592e1a7c2c52e6eaffc826cc22a9fa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198518
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-04 03:45:34 +00:00
Ian Cottrell
cc9bfb3eec internal/lsp: rewrite the unified diff handling
It is now in the diff package written in terms of edits, instead of the myers package.
This also means that the unified handling is no longer pluggable because it does
not need to be.

Change-Id: I7141b023e95ed0c1d21cbc81c7420c117fc5ef1a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198517
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-04 03:45:17 +00:00
Ian Cottrell
db1ebf78a8 internal/lsp: move unified diff testing to the diff interface
This now checks at the diff.TextEdit layer rather than  myers.Op

Change-Id: I706657a6c5705f0ad7109aa81f4dce174dda5f2b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198380
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-04 03:44:59 +00:00
Ian Cottrell
b917058f11 internal/lsp: invert the diff dependencies so myers depends on diff
This makes it so the diff package is depended on by all implementations, rather
than the diff package having to depend on the default myers implementation.

Change-Id: I04b9caee6ff1017fa8e5476a7434e4b0e17753c3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198379
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-04 02:16:33 +00:00
Ian Cottrell
6e0078a899 internal/lsp: allow the diff alorithm to be specified per view
Change-Id: Ib9d44d2012253189f87bc3b15a88b400f76ae955
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198378
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-04 02:16:33 +00:00
Rebecca Stambler
246a69f4f1 go/gcexportdata: use IExportData when writing gcexportdata
Updates golang/go#28260

Change-Id: Id0ef98e1599fbef4dd67ba23c20ddb8bc4d33228
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198742
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-04 02:16:33 +00:00
Rebecca Stambler
9901302c21 internal/lsp: use dependencies in cache keys
This change includes dependencies in the cache keys for
CheckPackageHandles. This should fix the issue with propagating results
to reverse dependencies.

Updates golang/go#34410

Change-Id: I025b7f0d6b0dcaa89c3461ebd94eadd35de4955f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198317
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-04 02:16:33 +00:00
Ian Cottrell
f7bb6f12f0 internal/lsp: do not allow diff.ApplyEdits to be replaced
We only need one implementation of this, it must cope with all inputs, and it
has no freedom in it's results, so it does not need to be pluggable.

Change-Id: I6fec0c339eb288649a670fc3e2cb00c726467e20
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198377
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-04 02:16:33 +00:00