Skip to content

[DTD] Add a getActiveLocation method to the Editor service #61538

@bkonyi

Description

@bkonyi

While it's currently possible to listen to the DTD Editor to respond to changes in the currently selected file in the IDE, there's no way to query the current state manually.

The implementers of the Editor service should add support for a ActiveLocation getActiveLocation() method which returns the currently selected location.

ActiveLocation would have roughly the following interface:

class ActiveLocation {
  /// An identifier that represents the active document.
  ///
  /// `null` is there is no active document.
  OptionalVersionedTextDocumentIdentifier? textDocument;

  /// The set of selections in the document.
  ///
  /// There will always be at least one selection if there is an active document
  /// (textDocument != null), but there may also be more if a user has multiple
  /// selections active.
  ///
  /// The first selection is always the primary selection for actions that only
  /// support one location.
  List<EditorSelection> selections;
}

The interface for ActiveLocationChangedEvent would now effectively be:

class ActiveLocationChangedEvent extends ActiveLocation implements Event {
  String eventKind;
}

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.pkg-dtdFor issues related to the Dart Tooling Daemon (package:dtd or pkg/dtd_impl within the Dart SDK)triagedIssue has been triaged by sub team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions