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

Connect the Property Editor to DTD #8598

Merged
merged 9 commits into from
Dec 11, 2024
Merged

Conversation

elliette
Copy link
Member

@elliette elliette commented Dec 5, 2024

Work towards: #8531, #1948
This PR:

  • Connects the Property Editor client to DTD
  • Flutter Property Editor responds to ActiveLocationChangedEvent from editor
  • Flutter Property Editor sends request for editable arguments to Analysis Server

This PR also:

  • Moves all property editor code into a single directory
standalone_ui/ide_shared/property_editor
   property_editor_controller.dart <--The controller for the property editor.
   property_editor_panel.dart  <-- This is the panel containing the property editor view.
   property_editor_view.dart <-- The view containing the property editor items.

property_editor_updates

@elliette elliette requested a review from a team as a code owner December 5, 2024 21:49
@elliette elliette requested review from kenzieschmoll and removed request for a team December 5, 2024 21:49
@@ -256,6 +289,196 @@ class ThemeChangedEvent extends EditorEvent {
Map<String, Object?> toJson() => {Field.theme: theme};
}

/// An event sent by an editor when the current cursor position/s change.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "cursor position changes" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to specify that this could be either a single or multiple cursor positions.

await tester.pumpWidget(wrap(propertyEditor));
eventController.add(activeLocationChangedEvent1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why send this at the end of the test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not *really at the end of the test, this is what triggers the request for editable arguments, the existence of which we wait for in the waitForEditableArgs invocation above.

elliette added a commit to elliette/devtools that referenced this pull request Dec 10, 2024
Comment on lines +52 to +54
children: <Widget>[
...args.map((arg) => _EditablePropertyItem(argument: arg)),
].joinWith(const PaddedDivider.noPadding()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get rid of the outer list and just write:

children: args.map((arg) => _EditablePropertyItem(argument: arg)).toList().joinWith(const PaddedDivider.noPadding()),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the outer list (or a cast) is necessary so that the list is of type Widget instead of type _EditablePropertyItem. Otherwise calling .joinWith results in the error that PaddedDivider is not type _EditablePropertyItem.

Copy link
Member

@kenzieschmoll kenzieschmoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few nits but overall lgtm

@elliette elliette merged commit 9d78520 into flutter:master Dec 11, 2024
24 checks passed
_currentDocument = textDocument;
_currentCursorPosition = cursorPosition;
// Get the editable arguments for the current position.
final result = await editorClient.getEditableArguments(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything to ensure this service was registered before it's called? Currently the method is prefixed with experimental/ but that will change at some point in future. Since DevTools ships in the SDK, probably it'll be hard to get these out of sync, but it could certainly happen if running either the analysis server or DevTools from source.

There is an initialized event sent over DTD's Lsp stream to indicate when all LSP services have been registered, so if the registration has not happened before then, it isn't available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants