gotoImplementation function

Extension gotoImplementation(
  1. ImplementationSource source, [
  2. GotoDefinitionOptions options = const GotoDefinitionOptions()
])

Set up go-to-implementation support.

The source callback is called when the user requests "go to implementation". This navigates to implementations of interfaces, abstract classes, or methods.

Example:

gotoImplementation((state, pos) async {
  final result = await lspClient.implementation(state.doc, pos);
  if (result == null) return null;
  return DefinitionResult(result.map((loc) => DefinitionLocation(
    uri: loc.uri,
    pos: loc.range.start,
  )).toList());
})

Implementation

Extension gotoImplementation(
  ImplementationSource source, [
  GotoDefinitionOptions options = const GotoDefinitionOptions(),
]) {
  final config = GotoImplementationConfig(
    source: source,
    options: options,
  );

  return ExtensionList([
    gotoImplementationFacet.of(config),
  ]);
}