Skip to content

Commit 5378829

Browse files
committed
Return nothign when there's nothing to add
1 parent 28cd0a0 commit 5378829

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-typescript-dev",
33
"displayName": "TSC Dev",
44
"description": "An extension for working in the TypeScript codebase",
5-
"version": "0.0.4",
5+
"version": "0.0.5",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/orta/vscode-typescript-dev"

src/twoslashCompletion.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ export const twoslashCompetions: vscode.CompletionItemProvider = {
1313
const thisLine = document.getText(range)
1414
// Not a comment
1515
if (!thisLine.startsWith("//")) {
16-
return { items: [] }
16+
return
1717
}
1818

1919
const words = thisLine.replace("\t", "").split(" ")
2020

2121
// Not the right amount of
2222
if (words.length !== 2) {
23-
return { items: [] }
23+
return
2424
}
2525

2626
const word = words[1]
2727

2828
// Not a @ at the first word
2929
if (!word.startsWith("@")) {
30-
return { items: [] }
30+
return
3131
}
3232

3333
const workspace = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor!.document.uri)
@@ -40,7 +40,7 @@ export const twoslashCompetions: vscode.CompletionItemProvider = {
4040
`TSC Dev Ext: Could not find a copy of TypeScript at ${workspaceRoot + "/node_modules/typescript"}`
4141
)
4242
console.error("Could not find local copy of TS")
43-
return { items: [] }
43+
return
4444
}
4545

4646
// @ts-ignore - ts.optionDeclarations is private
@@ -59,8 +59,9 @@ export const twoslashCompetions: vscode.CompletionItemProvider = {
5959
}
6060
})
6161

62-
return {
63-
items: results,
64-
}
62+
if (results.length)
63+
return {
64+
items: results,
65+
}
6566
},
6667
}

0 commit comments

Comments
 (0)