Skip to content

Commit 6f54ab5

Browse files
committed
[skip ci] fix(outline): don't crash in files that contained indexed signature in type
1 parent 8c70e19 commit 6f54ab5

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

integration/fixtures/test-project-js/src/index.jsx renamed to integration/fixtures/test-project/src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
interface Type {
2+
[p: string]: any
3+
}
4+
15
const Component = () => {
26
return (
37
<div className="main__wrap">

integration/suite/outline.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ describe('Outline', () => {
8181

8282
describe('Outline in js project', () => {
8383
it('Initial', async () => {
84-
await vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(fromFixtures('test-project-js')))
84+
await vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(fromFixtures('test-project')))
8585
await delay(500)
86-
await vscode.commands.executeCommand('vscode.open', vscode.Uri.file(fromFixtures('test-project-js/src/index.jsx')))
86+
await vscode.commands.executeCommand('vscode.open', vscode.Uri.file(fromFixtures('test-project/src/index.tsx')))
8787
await delay(600)
8888
document = editor().document
8989
const data = await getOutline()
@@ -93,7 +93,7 @@ describe('Outline', () => {
9393

9494
it('Reopen', async () => {
9595
await delay(500)
96-
await vscode.commands.executeCommand('vscode.open', vscode.Uri.file(fromFixtures('test-project-js/src/index.jsx')))
96+
await vscode.commands.executeCommand('vscode.open', vscode.Uri.file(fromFixtures('test-project/src/index.tsx')))
9797
await delay(600)
9898
document = editor().document
9999
const data = await getOutline()
@@ -169,7 +169,7 @@ const jsProjectExpectedOutline = (navbarPosName = 'NavBar') => [
169169
const simplifyOutline = (items: Array<vscode.SymbolInformation & vscode.DocumentSymbol>) => {
170170
const newItems: Array<{ name: any; children? }> = []
171171
for (const { children, name } of items) {
172-
if (name === 'classes') continue
172+
if (['classes', 'Type'].includes(name)) continue
173173
newItems.push({ name, ...(children?.length ? { children: simplifyOutline(children as any) } : {}) })
174174
}
175175

src/configurationType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export type Configuration = {
171171
* Extend outline with:
172172
* - JSX Elements
173173
* more coming soon...
174-
* Experimental and might not be stable
174+
* Should be stable enough!
175175
* @default false
176176
*/
177177
patchOutline: boolean

typescript/src/getPatchedNavTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const getPatchedNavModule = (ts: typeof tslib) => {
3030
},
3131
{
3232
predicateString: 'return "<unknown>";',
33-
linesOffset: -2,
33+
linesOffset: -1,
3434
addString: `
3535
case ts.SyntaxKind.JsxSelfClosingElement:
3636
return getNameFromJsxTag(node);

0 commit comments

Comments
 (0)