Repository navigation
Closed
Labels
Milestone
Description
Which @angular/* package(s) are the source of the bug?
language-service
Is this a regression?
No
Description
Let say I have a directive like this:
import { Directive, HostBinding, Input } from '@angular/core';
@Directive({
standalone: true,
selector: '[appBgColor]'
})
export class BgColorDirective {
@HostBinding('style.display') display = 'inline-block';
@Input() @HostBinding('style.background-color') bgColor = 'yellow';
}In the component, I want to use directive composition API including the inputs
import { Component } from '@angular/core';
import { BgColorDirective } from '../bg-color.directive';
@Component({
selector: 'app-my-comp',
templateUrl: './my-comp.component.html',
styleUrls: ['./my-comp.component.scss'],
hostDirectives: [
{
directive: BgColorDirective,
inputs: ['bgColor']
}
]
})
export class MyCompComponent { }And the usage of component
<app-my-comp [bgColor]="'red'"></app-my-comp>After compile, it works fine. But in VSCode, I got this error:
I think this is about the language service issue.
Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
It should has no error in VSCode.
Please provide the environment you discovered this bug in (run ng version)
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 15.0.0
Node: 16.17.0
Package Manager: npm 8.15.0
OS: darwin arm64
Angular: 15.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1500.0
@angular-devkit/build-angular 15.0.0
@angular-devkit/core 15.0.0
@angular-devkit/schematics 15.0.0
@schematics/angular 15.0.0
rxjs 7.5.7
typescript 4.8.4
Anything else?
No response

Activity
atscott commentedon Nov 17, 2022
Are you using the latest version of the extension? The latest version of the extension is required because it bundles the Angular compiler and host directives were not supported pre-v15.
Note: I downloaded your project everything appeared to be working.
wellwind commentedon Nov 17, 2022
I didn't notice the extension version, but it seems updated automatically, now I'm using v15.0.1 and all works fine. Thanks :)
atscott commentedon Nov 17, 2022
@wellwind We did find some issues while investigating this. All inputs from the directive will be available in autocompletion (even if they're not listed in the hostDirective inputs). Also, host directives on other directives aren't showing up in completions (only for components)
crisbeto commentedon Nov 17, 2022
I'll reopen this to investigate the issues Andrew mentioned.
fix(language-service): correctly handle host directive inputs/outputs (…
angular-automatic-lock-bot commentedon Dec 23, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
fix(language-service): correctly handle host directive inputs/outputs (…