| 1 | package Neovim::RPC::API::AutoDiscover; | ||||||||||
| 2 | 3 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||
| 3 | 3 | $Neovim::RPC::API::AutoDiscover::VERSION = '1.0.1'; | |||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 3 | with 'Neovim::RPC::API'; | |||||||||
| 9 | |||||||||||
| 10 | 3 | ▶ | use Promises qw/ deferred /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 3 | ▶ | use experimental 'postderef'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 15 | 0 | my $self = shift; | |||||||||
| 16 | |||||||||||
| 17 | 0 | $self->add_command({ name => 'vim_get_api_info' }); | |||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | $self->vim_get_api_info->then(sub { | ||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||
| 20 | 0 | my( $response ) = @_; | |||||||||
| 21 | |||||||||||
| 22 | 0 | $self->channel_id( $response->[0] ); | |||||||||
| 23 | |||||||||||
| 24 | 0 | my @funcs = $response->[1]{'functions'}->@*; | |||||||||
| 25 | |||||||||||
| 26 | 0 | for my $f ( @funcs ) { | |||||||||
| 27 | 0 | ▶ | next if $self->has_command( $f->{name} ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | $self->log->debugf( "adding function %s", $f->{name} ); | |||||||||
| 29 | 0 | $self->add_command( $f ); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | while ( my ( $type, $val ) = each $response->[1]{'types'}->%* ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | $self->types->{$type} = $val->{id}; | |||||||||
| 34 | } | ||||||||||
| 35 | }) | ||||||||||
| 36 | 0 | ▶ | ->then(sub{ | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 37 | 0 | $self->vim_set_var( name => 'nvimx_channel', value => $self->channel_id ); | |||||||||
| 38 | }) | ||||||||||
| 39 | 0 | ▶ | ->then(sub{ $self->ready->resolve($self) }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 3 | 1; | |||||||||
| 43 | |||||||||||
| 44 | __END__ | ||||||||||