Skip to content

Commit

Permalink
compile typescript with strict option
Browse files Browse the repository at this point in the history
  • Loading branch information
Jendrik Wenke committed Mar 13, 2018
1 parent 4efa3e2 commit 3bdc4e4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
14 changes: 6 additions & 8 deletions vscode-dotty/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import * as fs from 'fs';
import * as path from 'path';
import { spawn } from 'child_process';

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

import { commands, workspace, Disposable, ExtensionContext, Uri } from 'vscode';
import { Executable, LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind } from 'vscode-languageclient';
import * as lc from 'vscode-languageclient';
import { ExtensionContext } from 'vscode';
import * as vscode from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient';

let extensionContext: ExtensionContext
let outputChannel: vscode.OutputChannel
Expand Down Expand Up @@ -45,7 +43,7 @@ export function activate(context: ExtensionContext) {
})
}

function fetchAndRun(artifact: String) {
function fetchAndRun(artifact: string) {
const coursierPath = path.join(extensionContext.extensionPath, './out/coursier');

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

let classPath = ""

coursierProc.stdout.on('data', (data) => {
coursierProc.stdout.on('data', (data: Buffer) => {
classPath += data.toString().trim()
})
coursierProc.stderr.on('data', (data) => {
coursierProc.stderr.on('data', (data: Buffer) => {
let msg = data.toString()
outputChannel.append(msg)
})

coursierProc.on('close', (code) => {
coursierProc.on('close', (code: number) => {
if (code != 0) {
let msg = "Fetching the language server failed."
outputChannel.append(msg)
Expand Down
18 changes: 8 additions & 10 deletions vscode-dotty/src/passthrough-server.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
'use strict';

import {
IPCMessageReader, IPCMessageWriter,
createConnection, IConnection, TextDocumentSyncKind,
TextDocuments, TextDocument, Diagnostic, DiagnosticSeverity,
InitializeParams, InitializeResult, TextDocumentPositionParams,
CompletionItem, CompletionItemKind
} from 'vscode-languageserver';

import * as net from 'net';

let argv = process.argv.slice(2)
let port = argv.shift()
let argv: string[] = process.argv.slice(2)
const firstArg: string | undefined = argv.shift()
let port: string
if (firstArg === undefined) {
throw new Error('Expected port as the first argument')
} else {
port = firstArg
}

let client = new net.Socket()
client.setEncoding('utf8')
Expand Down
14 changes: 14 additions & 0 deletions vscode-dotty/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare module 'child-process-promise' {

import {ChildProcess} from "child_process";

interface ChildPromiseResult {
code: number;
}

interface ChildProcessPromise extends Promise<ChildPromiseResult> {
childProcess: ChildProcess;
}

function spawn(command: string, args: string[]): ChildProcessPromise;
}
3 changes: 2 additions & 1 deletion vscode-dotty/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"es6"
],
"sourceMap": true,
"rootDir": "."
"rootDir": ".",
"strict": true
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit 3bdc4e4

Please sign in to comment.