mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Include "export" modifier on function assigned to an export (export const x = () => 0;).
This commit is contained in:
parent
9e127967b6
commit
2ae5806210
@ -514,7 +514,7 @@ namespace ts.NavigationBar {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
kind: getNodeKind(n.node),
|
||||
kindModifiers: getNodeModifiers(n.node),
|
||||
kindModifiers: getModifiers(n.node),
|
||||
spans: getSpans(n),
|
||||
childItems: map(n.children, convertToTree)
|
||||
};
|
||||
@ -524,7 +524,7 @@ namespace ts.NavigationBar {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
kind: getNodeKind(n.node),
|
||||
kindModifiers: getNodeModifiers(n.node),
|
||||
kindModifiers: getModifiers(n.node),
|
||||
spans: getSpans(n),
|
||||
childItems: map(n.children, convertToChildItem) || emptyChildItemArray,
|
||||
indent: n.indent,
|
||||
@ -594,6 +594,13 @@ namespace ts.NavigationBar {
|
||||
: createTextSpanFromNode(node, curSourceFile);
|
||||
}
|
||||
|
||||
function getModifiers(node: ts.Node): string {
|
||||
if (node.parent && node.parent.kind === SyntaxKind.VariableDeclaration) {
|
||||
node = node.parent;
|
||||
}
|
||||
return getNodeModifiers(node);
|
||||
}
|
||||
|
||||
function getFunctionOrClassName(node: FunctionExpression | FunctionDeclaration | ArrowFunction | ClassLikeDeclaration): string {
|
||||
if (node.name && getFullWidth(node.name) > 0) {
|
||||
return declarationNameToString(node.name);
|
||||
|
||||
@ -6,10 +6,6 @@
|
||||
//// .a = function() { };
|
||||
//// })();
|
||||
|
||||
function navExact(name: string, kind: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
verify.navigationTree(
|
||||
{
|
||||
"text": "<global>",
|
||||
|
||||
@ -0,0 +1,78 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////export const value = 2;
|
||||
////export const func = () => 2;
|
||||
////export const func2 = function() { };
|
||||
////export function exportedFunction() { }
|
||||
|
||||
verify.navigationBar([
|
||||
{
|
||||
"text": "\"navigationBarItemsNamedArrowFunctions\"",
|
||||
"kind": "module",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "exportedFunction",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "func",
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
"text": "func2",
|
||||
"kind": "function"
|
||||
},
|
||||
{
|
||||
"text": "value",
|
||||
"kind": "const",
|
||||
"kindModifiers": "export"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "exportedFunction",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"indent": 1
|
||||
},
|
||||
{
|
||||
"text": "func",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"indent": 1
|
||||
},
|
||||
{
|
||||
"text": "func2",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"indent": 1
|
||||
}
|
||||
]);
|
||||
|
||||
verify.navigationTree({
|
||||
"text": "\"navigationBarItemsNamedArrowFunctions\"",
|
||||
"kind": "module",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "exportedFunction",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "func",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "func2",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "value",
|
||||
"kind": "const",
|
||||
"kindModifiers": "export"
|
||||
}
|
||||
]
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user