Skip to content

Commit 32f9ac2

Browse files
committed
Use type-casting instead of switch-case
1 parent 4594c70 commit 32f9ac2

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/extension.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ export function activate(context: vscode.ExtensionContext) {
1313
let registration = vscode.workspace.registerTextDocumentContentProvider(SCHEME, devdocs)
1414

1515
const getColumn = () => {
16-
const column = vscode.workspace.getConfiguration('devdocs').get('column');
17-
switch (column) {
18-
case 1: return vscode.ViewColumn.One;
19-
case 2: return vscode.ViewColumn.Two;
20-
case 3: return vscode.ViewColumn.Three;
21-
}
22-
23-
return vscode.ViewColumn.Two;
16+
const column = vscode.workspace.getConfiguration('devdocs').get<number>('column');
17+
return column < 1 || column > 3
18+
? vscode.ViewColumn.Two
19+
: <vscode.ViewColumn>column
2420
}
2521

2622
const openHtml = (uri: vscode.Uri, title) => {

0 commit comments

Comments
 (0)