feat(language-service): module definitions on directive hover (#32763)
Adds information about the NgModule a Directive is declared in when the Directive class name is hovered over, in the form ``` (directive) NgModule.Directive: class ``` Closes #32565 PR Close #32763
This commit is contained in:
@ -12,7 +12,7 @@ import {isAstResult} from './common';
|
||||
import {getTemplateCompletions} from './completions';
|
||||
import {getDefinitionAndBoundSpan, getTsDefinitionAndBoundSpan} from './definitions';
|
||||
import {getDeclarationDiagnostics, getTemplateDiagnostics, ngDiagnosticToTsDiagnostic, uniqueBySpan} from './diagnostics';
|
||||
import {getHover} from './hover';
|
||||
import {getHover, getTsHover} from './hover';
|
||||
import {Diagnostic, LanguageService} from './types';
|
||||
import {TypeScriptServiceHost} from './typescript_host';
|
||||
|
||||
@ -97,5 +97,14 @@ class LanguageServiceImpl implements LanguageService {
|
||||
if (templateInfo) {
|
||||
return getHover(templateInfo, position);
|
||||
}
|
||||
|
||||
// Attempt to get Angular-specific hover information in a TypeScript file, the NgModule a
|
||||
// directive belongs to.
|
||||
if (fileName.endsWith('.ts')) {
|
||||
const sf = this.host.getSourceFile(fileName);
|
||||
if (sf) {
|
||||
return getTsHover(sf, position, this.host);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user