forked from microsoft/TypeScript
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better outlining spans for prototype methods (microsoft#32782)
* Changed outlining to better outline ES5 classes (functions assigned to prototype) * Changed outlining to better outline ES5 classes (properties assigned to functions) * Fixed some small bugs when merging es5 class nodes. Added tests for new es5 class outline. * Added support for interlaced ES5 classes (where an ES5 class's members are mixed with other declarations). * Fixed crash in outline when assigning {} to the prototype. * Added support for nested es5 declarations. * Added support for prototype assignment for es5 classes.
- Loading branch information
1 parent
cd371da
commit fa9e0fa
Showing
8 changed files
with
1,089 additions
and
29 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/// <reference path="fourslash.ts"/> | ||
|
||
// @Filename: foo.js | ||
|
||
////A.prototype.a = function() { }; | ||
////A.prototype.b = function() { }; | ||
////function A() {} | ||
|
||
verify.navigationTree({ | ||
"text": "<global>", | ||
"kind": "script", | ||
"childItems": [ | ||
{ | ||
"text": "A", | ||
"kind": "class", | ||
"childItems": [ | ||
{ | ||
"text": "a", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "b", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "constructor", | ||
"kind": "constructor" | ||
} | ||
] | ||
} | ||
] | ||
}); | ||
|
||
verify.navigationBar([ | ||
{ | ||
"text": "<global>", | ||
"kind": "script", | ||
"childItems": [ | ||
{ | ||
"text": "A", | ||
"kind": "class" | ||
} | ||
] | ||
}, | ||
{ | ||
"text": "A", | ||
"kind": "class", | ||
"childItems": [ | ||
{ | ||
"text": "a", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "b", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "constructor", | ||
"kind": "constructor" | ||
} | ||
], | ||
"indent": 1 | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/// <reference path="fourslash.ts"/> | ||
|
||
// @Filename: foo.js | ||
|
||
////var A; | ||
////A.prototype.a = function() { }; | ||
////A.b = function() { }; | ||
|
||
verify.navigationTree({ | ||
"text": "<global>", | ||
"kind": "script", | ||
"childItems": [ | ||
{ | ||
"text": "A", | ||
"kind": "class", | ||
"childItems": [ | ||
{ | ||
"text": "constructor", | ||
"kind": "constructor" | ||
}, | ||
{ | ||
"text": "a", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "b", | ||
"kind": "function" | ||
} | ||
] | ||
} | ||
] | ||
}); | ||
|
||
verify.navigationBar([ | ||
{ | ||
"text": "<global>", | ||
"kind": "script", | ||
"childItems": [ | ||
{ | ||
"text": "A", | ||
"kind": "class" | ||
} | ||
] | ||
}, | ||
{ | ||
"text": "A", | ||
"kind": "class", | ||
"childItems": [ | ||
{ | ||
"text": "constructor", | ||
"kind": "constructor" | ||
}, | ||
{ | ||
"text": "a", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "b", | ||
"kind": "function" | ||
} | ||
], | ||
"indent": 1 | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/// <reference path="fourslash.ts"/> | ||
|
||
// @Filename: foo.js | ||
|
||
////var A; | ||
////A.prototype = { }; | ||
////A.prototype = { m() {} }; | ||
////A.prototype.a = function() { }; | ||
////A.b = function() { }; | ||
|
||
verify.navigationTree({ | ||
"text": "<global>", | ||
"kind": "script", | ||
"childItems": [ | ||
{ | ||
"text": "A", | ||
"kind": "class", | ||
"childItems": [ | ||
{ | ||
"text": "constructor", | ||
"kind": "constructor" | ||
}, | ||
{ | ||
"text": "m", | ||
"kind": "method" | ||
}, | ||
{ | ||
"text": "a", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "b", | ||
"kind": "function" | ||
} | ||
] | ||
} | ||
] | ||
}); | ||
|
||
verify.navigationBar([ | ||
{ | ||
"text": "<global>", | ||
"kind": "script", | ||
"childItems": [ | ||
{ | ||
"text": "A", | ||
"kind": "class" | ||
} | ||
] | ||
}, | ||
{ | ||
"text": "A", | ||
"kind": "class", | ||
"childItems": [ | ||
{ | ||
"text": "constructor", | ||
"kind": "constructor" | ||
}, | ||
{ | ||
"text": "m", | ||
"kind": "method" | ||
}, | ||
{ | ||
"text": "a", | ||
"kind": "function" | ||
}, | ||
{ | ||
"text": "b", | ||
"kind": "function" | ||
} | ||
], | ||
"indent": 1 | ||
} | ||
]); |
Oops, something went wrong.