Skip to content

Commit 3bdc4e4

Browse files
author
Jendrik Wenke
committed
compile typescript with strict option
1 parent 4efa3e2 commit 3bdc4e4

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

vscode-dotty/src/extension.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
import * as fs from 'fs';
44
import * as path from 'path';
5-
import { spawn } from 'child_process';
65

76
import * as cpp from 'child-process-promise';
87

9-
import { commands, workspace, Disposable, ExtensionContext, Uri } from 'vscode';
10-
import { Executable, LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind } from 'vscode-languageclient';
11-
import * as lc from 'vscode-languageclient';
8+
import { ExtensionContext } from 'vscode';
129
import * as vscode from 'vscode';
10+
import { LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient';
1311

1412
let extensionContext: ExtensionContext
1513
let outputChannel: vscode.OutputChannel
@@ -45,7 +43,7 @@ export function activate(context: ExtensionContext) {
4543
})
4644
}
4745

48-
function fetchAndRun(artifact: String) {
46+
function fetchAndRun(artifact: string) {
4947
const coursierPath = path.join(extensionContext.extensionPath, './out/coursier');
5048

5149
vscode.window.withProgress({
@@ -64,15 +62,15 @@ function fetchAndRun(artifact: String) {
6462

6563
let classPath = ""
6664

67-
coursierProc.stdout.on('data', (data) => {
65+
coursierProc.stdout.on('data', (data: Buffer) => {
6866
classPath += data.toString().trim()
6967
})
70-
coursierProc.stderr.on('data', (data) => {
68+
coursierProc.stderr.on('data', (data: Buffer) => {
7169
let msg = data.toString()
7270
outputChannel.append(msg)
7371
})
7472

75-
coursierProc.on('close', (code) => {
73+
coursierProc.on('close', (code: number) => {
7674
if (code != 0) {
7775
let msg = "Fetching the language server failed."
7876
outputChannel.append(msg)

vscode-dotty/src/passthrough-server.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
'use strict';
22

3-
import {
4-
IPCMessageReader, IPCMessageWriter,
5-
createConnection, IConnection, TextDocumentSyncKind,
6-
TextDocuments, TextDocument, Diagnostic, DiagnosticSeverity,
7-
InitializeParams, InitializeResult, TextDocumentPositionParams,
8-
CompletionItem, CompletionItemKind
9-
} from 'vscode-languageserver';
10-
113
import * as net from 'net';
124

13-
let argv = process.argv.slice(2)
14-
let port = argv.shift()
5+
let argv: string[] = process.argv.slice(2)
6+
const firstArg: string | undefined = argv.shift()
7+
let port: string
8+
if (firstArg === undefined) {
9+
throw new Error('Expected port as the first argument')
10+
} else {
11+
port = firstArg
12+
}
1513

1614
let client = new net.Socket()
1715
client.setEncoding('utf8')

vscode-dotty/src/types.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
declare module 'child-process-promise' {
2+
3+
import {ChildProcess} from "child_process";
4+
5+
interface ChildPromiseResult {
6+
code: number;
7+
}
8+
9+
interface ChildProcessPromise extends Promise<ChildPromiseResult> {
10+
childProcess: ChildProcess;
11+
}
12+
13+
function spawn(command: string, args: string[]): ChildProcessPromise;
14+
}

vscode-dotty/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"es6"
88
],
99
"sourceMap": true,
10-
"rootDir": "."
10+
"rootDir": ".",
11+
"strict": true
1112
},
1213
"exclude": [
1314
"node_modules",

0 commit comments

Comments
 (0)