mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
fix(56665): Improve Outline for template literals (#56667)
This commit is contained in:
parent
2c7162143b
commit
22bee05d8f
@ -84,6 +84,7 @@ import {
|
||||
isStatic,
|
||||
isStringLiteralLike,
|
||||
isStringOrNumericLiteralLike,
|
||||
isTemplateLiteral,
|
||||
isToken,
|
||||
isVariableDeclaration,
|
||||
lastOrUndefined,
|
||||
@ -1057,7 +1058,7 @@ function getFunctionOrClassName(node: FunctionExpression | FunctionDeclaration |
|
||||
return `${name} callback`;
|
||||
}
|
||||
|
||||
const args = cleanText(mapDefined(parent.arguments, a => isStringLiteralLike(a) ? a.getText(curSourceFile) : undefined).join(", "));
|
||||
const args = cleanText(mapDefined(parent.arguments, a => isStringLiteralLike(a) || isTemplateLiteral(a) ? a.getText(curSourceFile) : undefined).join(", "));
|
||||
return `${name}(${args}) callback`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
//// // These will only show up as childItems.
|
||||
//// function z() {}
|
||||
//// console.log(function() {})
|
||||
//// describe("this", 'function', `is a function`, `but this ${"wont"} show`, () => {});
|
||||
//// describe("this", 'function', `is a function`, `with template literal ${"a"}`, () => {});
|
||||
//// [].map(() => {});
|
||||
////})
|
||||
////(function classes() {
|
||||
@ -77,11 +77,11 @@ verify.navigationTree({
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
"text": `describe("this", 'function', \`is a function\`) callback`,
|
||||
"text": "describe(\"this\", 'function', `is a function`, `with template literal ${\"a\"}`) callback",
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
"text": `map() callback`,
|
||||
"text": "map() callback",
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
@ -199,11 +199,11 @@ verify.navigationBar([
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
"text": `describe("this", 'function', \`is a function\`) callback`,
|
||||
"text": "describe(\"this\", 'function', `is a function`, `with template literal ${\"a\"}`) callback",
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
"text": `map() callback`,
|
||||
"text": "map() callback",
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////describe('foo', () => {
|
||||
//// test(`a ${1} b ${2}`, () => {})
|
||||
////})
|
||||
////
|
||||
////const a = 1;
|
||||
////const b = 2;
|
||||
////describe('foo', () => {
|
||||
//// test(`a ${a} b {b}`, () => {})
|
||||
////})
|
||||
|
||||
verify.navigationTree({
|
||||
"text": "<global>",
|
||||
"kind": "script",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "a",
|
||||
"kind": "const"
|
||||
},
|
||||
{
|
||||
"text": "b",
|
||||
"kind": "const"
|
||||
},
|
||||
{
|
||||
"text": "describe('foo') callback",
|
||||
"kind": "function",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "test(`a ${1} b ${2}`) callback",
|
||||
"kind": "function"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "describe('foo') callback",
|
||||
"kind": "function",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "test(`a ${a} b {b}`) callback",
|
||||
"kind": "function"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
verify.navigationBar([
|
||||
{
|
||||
"text": "<global>",
|
||||
"kind": "script",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "a",
|
||||
"kind": "const"
|
||||
},
|
||||
{
|
||||
"text": "b",
|
||||
"kind": "const"
|
||||
},
|
||||
{
|
||||
"text": "describe('foo') callback",
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
"text": "describe('foo') callback",
|
||||
"kind": "function"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "describe('foo') callback",
|
||||
"kind": "function",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "test(`a ${1} b ${2}`) callback",
|
||||
"kind": "function"
|
||||
}
|
||||
],
|
||||
"indent": 1
|
||||
},
|
||||
{
|
||||
"text": "describe('foo') callback",
|
||||
"kind": "function",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "test(`a ${a} b {b}`) callback",
|
||||
"kind": "function"
|
||||
}
|
||||
],
|
||||
"indent": 1
|
||||
}
|
||||
]);
|
||||
Loading…
x
Reference in New Issue
Block a user