deep-assoc-completion icon indicating copy to clipboard operation
deep-assoc-completion copied to clipboard

Disable completion // with `@noDeepAssoc` doc comment

Open RobinRadic opened this issue 5 years ago • 10 comments

Is there a way to disable completion for method arguments?

Otherwise, a php annotation would be nice.

class Foo {

    /**
     * @param  array $attributes
     */
    public function create(array $attributes){
       // random method body using $attributes array like
       if($attributes['bar']){}
       if($attributes['foobar']){}
       if($attributes['barfoo']){}
   }
}
$foo = new Foo
/** @noDeepAssoc */
$foo->create([
  'bar'    => '<caret>',
  'foobar'    => '<caret>',
);

RobinRadic avatar Jan 24 '20 05:01 RobinRadic

Hi. There is no such functionality yet. I can add it. Do you want method arguments completion disablable only per function basis, or should there also be an option in settings to disable it everywhere?

klesun avatar Jan 24 '20 07:01 klesun

I'd like to disable it on a per function basis. Ideally both as a method docblock and a inline docblock:

class Foo {

    /**
     * @param  array $attributes
     * @noDeepAssoc 
     */
    public function create(array $attributes){
       // random method body using $attributes array like
       if($attributes['bar']){}
       if($attributes['foobar']){}
       if($attributes['barfoo']){}
   }
}
$foo = new Foo
$foo->create([
  'bar'    => '<caret>', // no deep-assoc-completion
  'foobar'    => '<caret>', // no deep-assoc-completion
);
class Foo {

    /**
     * @param  array $attributes
     */
    public function create(array $attributes){
       // random method body using $attributes array like
       if($attributes['bar']){}
       if($attributes['foobar']){}
       if($attributes['barfoo']){}
   }
}
$foo = new Foo
/** @noDeepAssoc */
$foo->create([
  'bar'    => '<caret>', // no deep-assoc-completion
  'foobar'    => '<caret>', // no deep-assoc-completion
);

RobinRadic avatar Jan 24 '20 22:01 RobinRadic

I think it makes sense to also use it for variables and properties, if that's possible

class Foo {
   /** 
   * @var array
  */
   public $barAttr = ['bar' => 'foo', 'foo' => 'bar'];
   /** 
   * @var array
  * @noDeepAssoc 
  */ 
   public $barFooAttr = ['bar' => 'foo', 'foo' => 'bar'];
}
$foo = new Foo
$barAttr = $foo->barAttr;
/** @noDeepAssoc */
$foo->barAttr['<caret>']; // no deep-assoc-completion
/** @noDeepAssoc */
$barAttr['<caret>']; // no deep-assoc-completion

$barFooAttr = $foo->barFooAttr;
$foo->barFooAttr['<caret>']; // no deep-assoc-completion
$barFooAttr['<caret>']; // no deep-assoc-completion

RobinRadic avatar Jan 24 '20 23:01 RobinRadic

Ok, got it. Will take some time, but I'll implement this.

klesun avatar Jan 25 '20 07:01 klesun

by

/**
 * @noDeepAssoc 
 */
public function create(array $attributes);

You want to only disable argument completion? Or completion from this function result, like $this->create()['<caret>'] should be disabled as well?

If you don't want result completion be disabled, I think the name of this tag should be something more like @noDeepAssocUsageBasedCompletion.

klesun avatar Jan 25 '20 07:01 klesun

@noDeepAssoc for all @noDeepAssocArgumentCompletion @noDeepAssocUsageCompletion maby?

RobinRadic avatar Jan 25 '20 22:01 RobinRadic

Yeah, sounds good. Though inside the plugin argument completion and usage based completion is same thing.

klesun avatar Jan 25 '20 22:01 klesun

At least name-wise

klesun avatar Jan 25 '20 22:01 klesun

I don't want to overcomplicate things for you, I'm already happy with just @noDeepAssoc disabling all deep assoc completion

RobinRadic avatar Jan 25 '20 22:01 RobinRadic

ok, cool

klesun avatar Jan 25 '20 22:01 klesun