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): avoid generating TS syntactic diagnostics for templates #55091

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions packages/language-service/src/ts_plugin.ts
Expand Up @@ -22,6 +22,16 @@ export function create(info: ts.server.PluginCreateInfo): NgLanguageService {

const ngLS = new LanguageService(project, tsLS, config);

function getSyntacticDiagnostics(fileName: string): ts.DiagnosticWithLocation[] {
if (isTypeScriptFile(fileName)) {
clydin marked this conversation as resolved.
Show resolved Hide resolved
return tsLS.getSyntacticDiagnostics(fileName);
}

// Template files do not currently produce separate syntactic diagnostics and
// are instead produced during the semantic diagnostic analysis.
return [];
}

function getSemanticDiagnostics(fileName: string): ts.Diagnostic[] {
const diagnostics: ts.Diagnostic[] = [];
if (!angularOnly && isTypeScriptFile(fileName)) {
Expand Down Expand Up @@ -212,6 +222,7 @@ export function create(info: ts.server.PluginCreateInfo): NgLanguageService {

return {
...tsLS,
getSyntacticDiagnostics,
getSemanticDiagnostics,
getTypeDefinitionAtPosition,
getQuickInfoAtPosition,
Expand Down