diff --git a/.editorconfig b/.editorconfig index 01a20f16fe3aa..fb460b9847422 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,6 @@ trim_trailing_whitespace = true [*.md] insert_final_newline = false trim_trailing_whitespace = false + +[*.sh] +end_of_line = lf diff --git a/.gitattributes b/.gitattributes index b45635737ca2b..b2fad337c5e1e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,5 +8,8 @@ # API guardian patch must always use LF for tests to work *.patch eol=lf +# sh files must always use LF +*.sh eol=lf + # Must keep Windows line ending to be parsed correctly scripts/windows/packages.txt eol=crlf diff --git a/packages/language-service/src/ts_plugin.ts b/packages/language-service/src/ts_plugin.ts index 368dba70e8741..b2c11ed709283 100644 --- a/packages/language-service/src/ts_plugin.ts +++ b/packages/language-service/src/ts_plugin.ts @@ -17,7 +17,9 @@ const projectHostMap = new WeakMap(); export function getExternalFiles(project: tss.server.Project): string[]|undefined { const host = projectHostMap.get(project); - if (host) { + const rootFiles = (project as any).getRootFilesMap(); + + if (host && rootFiles && Array.from(rootFiles).length) { const externalFiles = host.getTemplateReferences(); return externalFiles; } @@ -51,7 +53,7 @@ function diagnosticMessageToDiagnosticMessageText(message: string | DiagnosticMe return diagnosticChainToDiagnosticChain(message); } -function diagnosticToDiagnostic(d: Diagnostic, file: ts.SourceFile): ts.Diagnostic { +function diagnosticToDiagnostic(d: Diagnostic, file: ts.SourceFile | undefined): ts.Diagnostic { const result = { file, start: d.span.start, @@ -147,9 +149,7 @@ export function create(info: tss.server.PluginCreateInfo): ts.LanguageService { const ours = ls.getDiagnostics(fileName); if (ours && ours.length) { const file = oldLS.getProgram() !.getSourceFile(fileName); - if (file) { - base.push.apply(base, ours.map(d => diagnosticToDiagnostic(d, file))); - } + base.push.apply(base, ours.map(d => diagnosticToDiagnostic(d, file))); } });