Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(language-service): get the right 'ElementAst' in the nested HTML tag #35317

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/language-service/src/locate_symbol.ts
Expand Up @@ -116,8 +116,8 @@ function locateSymbol(ast: TemplateAst, path: TemplateAstPath, info: AstResult):
},
visitElementProperty(ast) { attributeValueSymbol(); },
visitAttr(ast) {
const element = path.head;
if (!element || !(element instanceof ElementAst)) return;
const element = path.first(ElementAst);
if (!element) return;
// Create a mapping of all directives applied to the element from their selectors.
const matcher = new SelectorMatcher<DirectiveAst>();
for (const dir of element.directives) {
Expand Down
3 changes: 2 additions & 1 deletion packages/language-service/test/hover_spec.ts
Expand Up @@ -99,7 +99,8 @@ describe('hover', () => {
});

it('should be able to find a reference to a directive', () => {
const content = mockHost.override(TEST_TEMPLATE, `<div string-model~{cursor}></div>`);
const content =
kyliau marked this conversation as resolved.
Show resolved Hide resolved
mockHost.override(TEST_TEMPLATE, `<div><div string-model~{cursor}></div></div>`);
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'cursor');
const quickInfo = ngLS.getQuickInfoAtPosition(TEST_TEMPLATE, marker.start);
expect(quickInfo).toBeDefined();
Expand Down