Skip to content

Commit 2d87813

Browse files
authored
chore: make ts stricter in extension (#4146)
1 parent a8a8477 commit 2d87813

6 files changed

Lines changed: 13 additions & 34 deletions

File tree

vscode/extension/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function activate(context: vscode.ExtensionContext) {
5656
onDidChangePythonInterpreter(async () => {
5757
await restart()
5858
}),
59-
onDidChangeConfiguration(async (e: vscode.ConfigurationChangeEvent) => {
59+
onDidChangeConfiguration(async (_: vscode.ConfigurationChangeEvent) => {
6060
await restart()
6161
}),
6262
registerCommand(`sqlmesh.restart`, async () => {

vscode/extension/src/lsp/lsp.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import path from "path"
2-
import { workspace, ExtensionContext, OutputChannel, window, Disposable } from "vscode"
1+
import { window, OutputChannel, Disposable } from "vscode"
32
import { ServerOptions, LanguageClientOptions, LanguageClient, TransportKind } from "vscode-languageclient/node"
4-
import { sqlmesh_exec, sqlmesh_lsp_exec } from "../utilities/sqlmesh/sqlmesh"
3+
import { sqlmesh_lsp_exec } from "../utilities/sqlmesh/sqlmesh"
54
import { err, isErr, ok, Result } from "../utilities/functional/result"
65
import { getWorkspaceFolders } from "../utilities/common/vscodeapi"
76

@@ -14,7 +13,7 @@ export class LSPClient implements Disposable {
1413
this.client = undefined
1514
}
1615

17-
public async start() {
16+
public async start(): Promise<Result<undefined, string>> {
1817
if (!outputChannel) {
1918
outputChannel = window.createOutputChannel('sqlmesh_actual_lsp_implementation')
2019
}
@@ -59,7 +58,8 @@ export class LSPClient implements Disposable {
5958
}
6059

6160
this.client = new LanguageClient('sqlmesh-lsp-example', 'SQLMesh Language Server', serverOptions, clientOptions)
62-
this.client.start()
61+
await this.client.start()
62+
return ok(undefined)
6363
}
6464

6565
public async restart() {

vscode/extension/src/utilities/common/setup.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

vscode/extension/src/utilities/functional/result.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export const isErr = <T, E>(result: Result<T, E>): result is { ok: false; error:
1515
/**
1616
* returns an ok version `Result<T, E>` from a value `T`
1717
*/
18-
export const ok = <T, E>(value: T): { ok: true, value: T} => {
18+
export const ok = <T>(value: T): { ok: true, value: T} => {
1919
return { ok: true, value }
2020
}
2121

2222
/**
2323
* returns an error version `Result<T, E>` from an error `E`
2424
*/
25-
export const err = <T, E>(error: E): { ok: false, error: E } => {
25+
export const err = <E>(error: E): { ok: false, error: E } => {
2626
return { ok: false, error }
2727
}

vscode/extension/src/utilities/sqlmesh/sqlmesh.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import path from "path"
22
import { traceLog, traceVerbose } from "../common/log"
33
import { getInterpreterDetails } from "../common/python"
4-
import { getWorkspaceFolders } from "../common/vscodeapi"
5-
import { Result, err, ok } from "../functional/result"
4+
import { Result, ok } from "../functional/result"
65
import { getProjectRoot } from "../common/utilities"
76

87
export type sqlmesh_exec = {

vscode/extension/tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
"rootDir": "src",
1111
"strict": true, /* enable all strict type-checking options */
1212
/* Additional Checks */
13-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
14-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
15-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
13+
"noImplicitReturns": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"noUnusedParameters": true,
16+
"noUnusedLocals": true,
1617
"paths": {
1718
"@bus/*": ["../bus/src/*"]
1819
}

0 commit comments

Comments
 (0)