Skip to content
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

x/tools/gopls: watch changed files #31553

Open
ianthehat opened this issue Apr 18, 2019 · 11 comments

Comments

Projects
None yet
6 participants
@ianthehat
Copy link

commented Apr 18, 2019

We cache a lot of information like the AST and typechecking data per file.
If someone changes a file outside the editor, often by doing things with their vcs (update/branch switch is the most common thing mentioned) we currently do not attempt to re-build that information unless it is invalidated by an editor change.
We should be using the LSP handling for workspace/didChangeWatchedFiles to watch all the files we are caching and invalidating them.
It is not clear if we can/should do anything if the client does not support this capability.

@myitcv

This comment has been minimized.

Copy link
Member

commented Apr 18, 2019

Does this not contradict what you said the other day in terms of this being the editor's responsibility?

@ianthehat

This comment has been minimized.

Copy link
Author

commented Apr 18, 2019

No, workspace/didChangeWatchedFile, s is the mechanism by which the server can ask the client to tell it when a file changes, which makes it the editors responsibility

@myitcv

This comment has been minimized.

Copy link
Member

commented Apr 18, 2019

Got you. I misconstrued the title of the issue: it's actually that gopls watches these files through the client. Thanks

@stamblerre stamblerre changed the title gopls needs to watch changed files x/tools/internal/lsp: watch changed files Apr 18, 2019

@gopherbot gopherbot added this to the Unreleased milestone Apr 18, 2019

@myitcv

This comment has been minimized.

Copy link
Member

commented Apr 29, 2019

Just jotting down a couple of notes/questions:

  • This presumably includes watching the main module go.mod file itself too? i.e. it covers the situation where the user adds/drops/changes a requirement
  • Will the server ask the client to watch files in the read-only module cache?
  • Will the server ask the client to watch files in directory-replace-d modules which are writable? Hopefully yes 😉. Main use case here being gohack esque workflows
@ianthehat

This comment has been minimized.

Copy link
Author

commented Apr 29, 2019

  • Watching go.mod - yes
  • Watching module cache - undecided, not doing so is more complicated, and possibly fragile, it would have to demonstrate a significant benefit, and we would have to decide if it caused issues when people clear the cache
  • Watching replaced files- yes

myitcv added a commit to myitcv/govim that referenced this issue Apr 30, 2019

cmd/govim: temporary implementation of file watching
For now use textDocument/didOpen and textDocument/didChange to deal with
generated files changing, whilst we await a proper implementation in
gopls via golang/go#31553.

myitcv added a commit to myitcv/govim that referenced this issue Apr 30, 2019

cmd/govim: temporary implementation of file watching
For now use textDocument/didOpen and textDocument/didChange to deal with
generated files changing, whilst we await a proper implementation in
gopls via golang/go#31553.

myitcv added a commit to myitcv/govim that referenced this issue Apr 30, 2019

cmd/govim: temporary implementation of file watching
For now use textDocument/didOpen and textDocument/didChange to deal with
generated files changing, whilst we await a proper implementation in
gopls via golang/go#31553.

myitcv added a commit to myitcv/govim that referenced this issue Apr 30, 2019

cmd/govim: temporary implementation of file watching
For now use textDocument/didOpen and textDocument/didChange to deal with
generated files changing, whilst we await a proper implementation in
gopls via golang/go#31553.

myitcv added a commit to myitcv/govim that referenced this issue Apr 30, 2019

cmd/govim: temporary implementation of file watching
For now use textDocument/didOpen and textDocument/didChange to deal with
generated files changing, whilst we await a proper implementation in
gopls via golang/go#31553.

myitcv added a commit to myitcv/govim that referenced this issue Apr 30, 2019

cmd/govim: temporary implementation of file watching (#189)
For now use textDocument/didOpen and textDocument/didChange to deal with
generated files changing, whilst we await a proper implementation in
gopls via golang/go#31553.

@stamblerre stamblerre changed the title x/tools/internal/lsp: watch changed files x/tools/gopls: watch changed files Jul 2, 2019

@suzmue suzmue self-assigned this Jul 3, 2019

@suzmue

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2019

To update this thread, I am planning to begin work on implementing workspace/didChangeWatchedFile in gopls

@muirrn

This comment has been minimized.

Copy link

commented Jul 10, 2019

Is this one available or does @suzmue still have dibs?

@stamblerre stamblerre removed the Suggested label Jul 11, 2019

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2019

I'm sorry, I mistakenly added the Suggested label here. I believe @suzmue is still working on this.

@suzmue

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

@muirrn if you want to get started on this, I am not going to get to it right away

@muirrn

This comment has been minimized.

Copy link

commented Jul 14, 2019

Ok, I am working on this one.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 14, 2019

Change https://golang.org/cl/186097 mentions this issue: internal/lsp: fix watched file protocol constants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.