Skip to content

Commit

Permalink
[html] A 'return' statement can only be used within a function body. F…
Browse files Browse the repository at this point in the history
…ixes #143220
  • Loading branch information
aeschli committed Apr 4, 2022
1 parent c7a6851 commit a0612b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Expand Up @@ -87,7 +87,7 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
const languageService = await host.getLanguageService(jsDocument);
const syntaxDiagnostics: ts.Diagnostic[] = languageService.getSyntacticDiagnostics(jsDocument.uri);
const semanticDiagnostics = languageService.getSemanticDiagnostics(jsDocument.uri);
return syntaxDiagnostics.concat(semanticDiagnostics).map((diag: ts.Diagnostic): Diagnostic => {
return syntaxDiagnostics.concat(semanticDiagnostics).filter(d => d.code !== 1108).map((diag: ts.Diagnostic): Diagnostic => {
return {
range: convertRange(jsDocument, diag),
severity: DiagnosticSeverity.Error,
Expand Down
Expand Up @@ -121,6 +121,8 @@ suite('HTML Embedded Support', () => {
assertEmbeddedLanguageContent('<script type="text/javascript">var i = 0;</script>', 'javascript', ' var i = 0; ');

assertEmbeddedLanguageContent('<div onKeyUp="foo()" onkeydown="bar()"/>', 'javascript', ' foo(); bar(); ');
assertEmbeddedLanguageContent('<div onKeyUp="return"/>', 'javascript', ' return; ');

});

});

0 comments on commit a0612b2

Please sign in to comment.