mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
When looking at outlines for try functions, allow for not finding a child to provide a span when requesting outlines (#36389)
This commit is contained in:
@@ -182,7 +182,8 @@ namespace ts.OutliningElementsCollector {
|
||||
return spanForNode(n.parent);
|
||||
}
|
||||
else if (tryStatement.finallyBlock === n) {
|
||||
return spanForNode(findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile)!);
|
||||
const node = findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile);
|
||||
if (node) return spanForNode(node);
|
||||
}
|
||||
// falls through
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
// #33102
|
||||
|
||||
//// try[| {
|
||||
//// var x = [
|
||||
//// {% try[||] %}|][|{% except %}|]
|
||||
//// ]
|
||||
//// } catch (e)[| {
|
||||
////
|
||||
//// }|]
|
||||
|
||||
verify.outliningSpansInCurrentFile(test.ranges());
|
||||
@@ -433,6 +433,7 @@ declare namespace FourSlashInterface {
|
||||
printNavigationBar(): void;
|
||||
printNavigationItems(searchValue?: string): void;
|
||||
printScriptLexicalStructureItems(): void;
|
||||
printOutliningSpans(): void;
|
||||
printReferences(): void;
|
||||
printContext(): void;
|
||||
}
|
||||
@@ -775,4 +776,4 @@ declare namespace completion {
|
||||
export const statementKeywordsWithTypes: ReadonlyArray<Entry>;
|
||||
export const statementKeywords: ReadonlyArray<Entry>;
|
||||
export const statementInJsKeywords: ReadonlyArray<Entry>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user