[M] Change in dart/sdk[main]: DAS plugins: Only use fix edits which apply to each file with a match...

2 views
Skip to first unread message

Samuel Rawlins (Gerrit)

unread,
Sep 8, 2025, 8:52:23 PMSep 8
to Brian Wilkerson, Danny Tuppeny, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson and Danny Tuppeny

Samuel Rawlins added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Samuel Rawlins . resolved

Let me know if this direction makes sense. I have to do some manual testing before I land.

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Danny Tuppeny
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I6c428c59f46901e00cdd5045fced770cf6fe6101
Gerrit-Change-Number: 448820
Gerrit-PatchSet: 3
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Danny Tuppeny <dan...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Danny Tuppeny <dan...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Comment-Date: Tue, 09 Sep 2025 00:52:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Brian Wilkerson (Gerrit)

unread,
Sep 16, 2025, 4:26:45 PM (13 days ago) Sep 16
to Samuel Rawlins, Brian Wilkerson, Danny Tuppeny, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Danny Tuppeny and Samuel Rawlins

Brian Wilkerson added 1 comment

File pkg/analysis_server/lib/src/lsp/handlers/code_actions/plugins.dart
Line 90, Patchset 3 (Latest): .modificationStamp;
Brian Wilkerson . unresolved

The logic here seems right. The question is whether the `modificationStamp` and the `editFileStamp` are the consistent. The plugin isolate produced the `editFileStamp`, but I don't know where that came from. I also don't know where the `modificationStamp` came from.

If they are both from the file system then they are consistent and I think we're good to go. But if either of them is a fake modification stamp from the client, then was it passed along in such a way as to ensure that both isolates are seeing the same value?

Open in Gerrit

Related details

Attention is currently required from:
  • Danny Tuppeny
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I6c428c59f46901e00cdd5045fced770cf6fe6101
Gerrit-Change-Number: 448820
Gerrit-PatchSet: 3
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Danny Tuppeny <dan...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Danny Tuppeny <dan...@google.com>
Gerrit-Comment-Date: Tue, 16 Sep 2025 20:26:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
Sep 26, 2025, 2:54:12 PM (3 days ago) Sep 26
to Brian Wilkerson, Danny Tuppeny, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson, Danny Tuppeny and Samuel Rawlins

Samuel Rawlins voted and added 1 comment

Votes added by Samuel Rawlins

Commit-Queue+1

1 comment

File pkg/analysis_server/lib/src/lsp/handlers/code_actions/plugins.dart
Line 90, Patchset 3: .modificationStamp;
Brian Wilkerson . resolved

The logic here seems right. The question is whether the `modificationStamp` and the `editFileStamp` are the consistent. The plugin isolate produced the `editFileStamp`, but I don't know where that came from. I also don't know where the `modificationStamp` came from.

If they are both from the file system then they are consistent and I think we're good to go. But if either of them is a fake modification stamp from the client, then was it passed along in such a way as to ensure that both isolates are seeing the same value?

Samuel Rawlins

Good point. I checked with where the `timeStamp` field is created in the "change builder" code and sure enough, all of the code there uses `0` or `-1` (for a non-existent file).

I then updated the code in change_builder_core.dart to use real modification time stamps. But this does not work for OverlayResourceProvider. :(

When I send a request for edits for a file which is unchanged in the IDE (but which was previously changed, so I think an Overlay was added and then removed), I get these timestamps:

Request time stamp: 1758812993075, time stamp on edit: 0

`ResourceProvider.setOverlay` is always called with `modificationStamp: _overlayModificationStamp++`, in legacy_analysis_server.dart, lsp_analysis_server.dart, and plugin_server.dart. I obviously copy/pasted the impl into plugin_server.dart. I think that this code is used because we otherwise don't have a timestamp to use. LspAnalysisServer and LegacyAnalysisServer could use
`DateTime.now`... but that probably wouldn't work: If the client (VS Code) sent
an overlay notification with one timestamp, and asked for edits, and LspAnalysisServer set it's own overlay time to `DateTime.now`, then several milliseconds would have elapsed.

(Indeed, AnalysisServer starts with
`int overlayModificationStamp = DateTime.now().millisecondsSinceEpoch;` and PluginServer starts with
`int _overlayModificationStamp = 0;` but I don't think we can try to synchronize these either.)

I see that the `AddContentOverlay` and the `ChangeContentOverlay` classes have a `version` on them, "Version numbers allow the server to tag edits with the version of the document they apply to which can avoid applying edits to documents that have already been updated since the edits were computed." Well that sounds great! I've started using these in this CL. Let me know what you think...

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Danny Tuppeny
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I6c428c59f46901e00cdd5045fced770cf6fe6101
Gerrit-Change-Number: 448820
Gerrit-PatchSet: 6
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Danny Tuppeny <dan...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Attention: Danny Tuppeny <dan...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Fri, 26 Sep 2025 18:54:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Brian Wilkerson <brianwi...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Brian Wilkerson (Gerrit)

unread,
Sep 26, 2025, 5:51:28 PM (3 days ago) Sep 26
to Samuel Rawlins, Brian Wilkerson, Danny Tuppeny, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Danny Tuppeny and Samuel Rawlins

Brian Wilkerson added 1 comment

File pkg/analysis_server_plugin/lib/src/plugin_server.dart
Line 87, Patchset 7 (Latest): int _overlayModificationStamp = DateTime.now().millisecondsSinceEpoch;
Brian Wilkerson . unresolved

It's my understanding that LSP requires the 'version' fields the client sends to be monotonically increasing but not necessarily sequential. That means that they might be timestamps, or they might be just the next integer after the previous 'version' number.

As a result, I don't know that we can / want to use a real timestamp. I'll defer to you and Danny on this one.

I don't know whether the legacy protocol sends us a version number or whether it just always ends up being some constant value. If they don't send us one then a fake 'version' similar to LSP's would be best when communicating with the plugin isolate.

Open in Gerrit

Related details

Attention is currently required from:
  • Danny Tuppeny
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I6c428c59f46901e00cdd5045fced770cf6fe6101
Gerrit-Change-Number: 448820
Gerrit-PatchSet: 7
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Danny Tuppeny <dan...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Danny Tuppeny <dan...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Fri, 26 Sep 2025 21:51:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
Sep 27, 2025, 10:34:15 AM (2 days ago) Sep 27
to Brian Wilkerson, Danny Tuppeny, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson and Danny Tuppeny

Samuel Rawlins added 1 comment

File pkg/analysis_server_plugin/lib/src/plugin_server.dart
Line 87, Patchset 7 (Latest): int _overlayModificationStamp = DateTime.now().millisecondsSinceEpoch;
Brian Wilkerson . resolved

It's my understanding that LSP requires the 'version' fields the client sends to be monotonically increasing but not necessarily sequential. That means that they might be timestamps, or they might be just the next integer after the previous 'version' number.

As a result, I don't know that we can / want to use a real timestamp. I'll defer to you and Danny on this one.

I don't know whether the legacy protocol sends us a version number or whether it just always ends up being some constant value. If they don't send us one then a fake 'version' similar to LSP's would be best when communicating with the plugin isolate.

Samuel Rawlins

This change just brings the plugin server in line with `AnalysisServer`: https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/lib/src/analysis_server.dart#L237

There is a theory there about reducing collisions. I can add a similar comment here.

Otherwise, this CL doesn't have anything to do with what LSP clients or legacy clients send to DAS. This is purely between DAS and the plugins isolate. In lsp_analysis_server.dart, we start passing an overlay version number in each call to AddContentOverlay and ChangeContentOverlay. And then plugin_server.dart consumes them here.

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Danny Tuppeny
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I6c428c59f46901e00cdd5045fced770cf6fe6101
Gerrit-Change-Number: 448820
Gerrit-PatchSet: 7
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Danny Tuppeny <dan...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Attention: Danny Tuppeny <dan...@google.com>
Gerrit-Comment-Date: Sat, 27 Sep 2025 14:34:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Brian Wilkerson <brianwi...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages