Skip to content

Commit

Permalink
Attempt #2 - update npm dependencies, fix tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoon committed Feb 25, 2016
1 parent b262ac2 commit 2a2483b
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 80 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"url": "https://github.com/VSCodeVim/Vim/issues"
},
"engines": {
"vscode": "^0.10.1"
"vscode": "^0.10.8"
},
"categories": [
"Other"
Expand Down Expand Up @@ -144,23 +144,23 @@
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
"test": "node ./node_modules/vscode/bin/test",
"postinstall": "gulp init"
"postinstall": "node ./node_modules/vscode/bin/install && gulp init"
},
"dependencies": {
"lodash": "^4.5.1",
"vscode": "0.11.x"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp": "^3.9.1",
"gulp-mocha": "^2.2.0",
"gulp-shell": "^0.5.1",
"gulp-shell": "^0.5.2",
"gulp-soften": "^0.0.1",
"gulp-trimlines": "^1.0.0",
"gulp-tslint": "^3.6.0",
"gulp-typescript": "^2.9.2",
"gulp-tslint": "^4.3.2",
"gulp-typescript": "^2.12.0",
"gulp-typings": "^1.1.0",
"tslint": "^3.2.1",
"typescript": "^1.6.2",
"typings": "^0.6.8",
"vscode": "0.10.x"
},
"dependencies": {
"lodash": "^3.10.1"
"tslint": "^3.5.0",
"typescript": "^1.8.2",
"typings": "^0.6.8"
}
}
15 changes: 7 additions & 8 deletions src/cmd_line/commands/quit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"use strict";

import vscode = require('vscode');
import * as vscode from "vscode";
import * as node from "../node";
import * as error from '../../error';

import node = require('../node');
import error = require('../../error');

export interface QuitCommandArguments extends node.CommandArgs {
export interface IQuitCommandArguments extends node.ICommandArgs {
bang?: boolean;
range?: node.LineRange;
}
Expand All @@ -15,16 +14,16 @@ export interface QuitCommandArguments extends node.CommandArgs {
// http://vimdoc.sourceforge.net/htmldoc/editing.html#:quit
//
export class QuitCommand extends node.CommandBase {
protected _arguments : QuitCommandArguments;
protected _arguments : IQuitCommandArguments;

constructor(args : QuitCommandArguments) {
constructor(args : IQuitCommandArguments) {
super();
this._name = 'quit';
this._shortName = 'q';
this._arguments = args;
}

get arguments() : QuitCommandArguments {
get arguments() : IQuitCommandArguments {
return this._arguments;
}

Expand Down
16 changes: 8 additions & 8 deletions src/cmd_line/commands/write.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use strict";

// XXX: use graceful-fs ??
import fs = require('fs');
import * as fs from 'fs';

import node = require('../node');
import util = require('../../util');
import error = require('../../error');
import * as node from '../node';
import * as util from '../../util';
import * as error from '../../error';

export interface WriteCommandArguments extends node.CommandArgs {
export interface IWriteCommandArguments extends node.ICommandArgs {
opt? : string;
optValue? : string;
bang? : boolean;
Expand All @@ -22,16 +22,16 @@ export interface WriteCommandArguments extends node.CommandArgs {
// http://vimdoc.sourceforge.net/htmldoc/editing.html#:write
//
export class WriteCommand extends node.CommandBase {
protected _arguments : WriteCommandArguments;
protected _arguments : IWriteCommandArguments;

constructor(args : WriteCommandArguments) {
constructor(args : IWriteCommandArguments) {
super();
this._name = 'write';
this._shortName = 'w';
this._arguments = args;
}

get arguments() : WriteCommandArguments {
get arguments() : IWriteCommandArguments {
return this._arguments;
}

Expand Down
19 changes: 9 additions & 10 deletions src/cmd_line/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import {Scanner} from "./scanner";
import {Token, TokenType} from "./token";

// Describes a function that can lex part of a Vim command line.
interface LexFunction {
(state: Scanner, tokens: Token[]) : LexFunction;
interface ILexFunction {
(state: Scanner, tokens: Token[]) : ILexFunction;
}

export function lex(input : string) : Token[] {
// We use a character scanner as state for the lexer.
var state = new Scanner(input);
var tokens : Token[] = [];
var f : LexFunction = LexerFunctions.lexRange;
var f : ILexFunction = LexerFunctions.lexRange;
while (f) {
// Each lexing function returns the next lexing function or null.
f = f(state, tokens);
Expand All @@ -27,7 +27,7 @@ function emitToken(type : TokenType, state : Scanner) : Token {

module LexerFunctions {
// Starts lexing a Vim command line and delegates on other lexer functions as needed.
export function lexRange(state : Scanner, tokens : Token[]): LexFunction {
export function lexRange(state : Scanner, tokens : Token[]): ILexFunction {
while (true) {
if (state.isAtEof) {
break;
Expand Down Expand Up @@ -74,7 +74,7 @@ module LexerFunctions {
return null;
}

function lexLineRef(state : Scanner, tokens : Token[]): LexFunction {
function lexLineRef(state : Scanner, tokens : Token[]): ILexFunction {
// The first digit has already been lexed.
while (true) {
if (state.isAtEof) {
Expand All @@ -93,17 +93,16 @@ module LexerFunctions {
case "7":
case "8":
case "9":
break;
continue;
default:
state.backup();
tokens.push(emitToken(TokenType.LineNumber, state));
return lexRange;
}
}
return null;
}

function lexCommand(state : Scanner, tokens : Token[]): LexFunction {
function lexCommand(state : Scanner, tokens : Token[]): ILexFunction {
// The first character of the command's name has already been lexed.
while (true) {
if (state.isAtEof) {
Expand Down Expand Up @@ -131,7 +130,7 @@ module LexerFunctions {
return null;
}

function lexForwardSearch(state : Scanner, tokens : Token[]): LexFunction {
function lexForwardSearch(state : Scanner, tokens : Token[]): ILexFunction {
// The first slash has already been lexed.
state.skip("/"); // XXX: really?
var escaping : boolean;
Expand All @@ -157,7 +156,7 @@ module LexerFunctions {
return lexRange;
}

function lexReverseSearch(state : Scanner, tokens : Token[]): LexFunction {
function lexReverseSearch(state : Scanner, tokens : Token[]): ILexFunction {
// The first question mark has already been lexed.
state.skip("?"); // XXX: really?
var escaping : boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/cmd_line/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class CommandLine {
}
}

export interface CommandArgs {
export interface ICommandArgs {
bang? : boolean;
range? : LineRange;
}
Expand All @@ -118,10 +118,10 @@ export abstract class CommandBase {
}
protected _shortName : string;

get arguments() : CommandArgs {
get arguments() : ICommandArgs {
return this._arguments;
}
protected _arguments : CommandArgs;
protected _arguments : ICommandArgs;

abstract execute() : void;
}
10 changes: 5 additions & 5 deletions src/cmd_line/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import * as node from './node';
import * as lexer from './lexer';
import {commandParsers} from './subparser';

interface ParseFunction {
(state : ParserState, command : node.CommandLine) : ParseFunction;
interface IParseFunction {
(state : ParserState, command : node.CommandLine) : IParseFunction;
}

export function parse(input : string) : node.CommandLine {
var cmd = new node.CommandLine();
var f : ParseFunction = parseLineRange;
var f : IParseFunction = parseLineRange;
let state : ParserState = new ParserState(input);
while (f) {
f = f(state, cmd);
}
return cmd;
}

function parseLineRange(state : ParserState, commandLine : node.CommandLine) : ParseFunction {
function parseLineRange(state : ParserState, commandLine : node.CommandLine) : IParseFunction {
while (true) {
let tok = state.next();
switch (tok.type) {
Expand All @@ -44,7 +44,7 @@ function parseLineRange(state : ParserState, commandLine : node.CommandLine) : P
}
}

function parseCommand(state : ParserState, commandLine : node.CommandLine) : ParseFunction {
function parseCommand(state : ParserState, commandLine : node.CommandLine) : IParseFunction {
while (!state.isAtEof) {
var tok = state.next();
switch (tok.type) {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd_line/subparsers/quit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function parseQuitCommandArgs(args : string) : node.QuitCommand {
if (!args) {
return new node.QuitCommand({});
}
var scannedArgs : node.QuitCommandArguments = {};
var scannedArgs : node.IQuitCommandArguments = {};
var scanner = new Scanner(args);
const c = scanner.next();
if (c === '!') {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd_line/subparsers/write.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use strict";

import {WriteCommand, WriteCommandArguments} from '../commands/write';
import {WriteCommand, IWriteCommandArguments} from '../commands/write';
import {Scanner} from '../scanner';

export function parseWriteCommandArgs(args : string) : WriteCommand {
if (!args) {
return new WriteCommand({});
}
var scannedArgs : WriteCommandArguments = {};
var scannedArgs : IWriteCommandArguments = {};
var scanner = new Scanner(args);
while (true) {
scanner.skipWhiteSpace();
Expand Down
5 changes: 2 additions & 3 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as util from "./util";

interface VimErrors {
interface IVimErrors {
[index: number] : string;
}

Expand All @@ -12,15 +12,14 @@ export enum ErrorCode {
E488 = 488
}

const errors : VimErrors = {
const errors : IVimErrors = {
32: "No file name",
37: "No write since last change (add ! to override)",
488: "Trailing characters"
};


export class VimError extends Error {

private _code : number;
private _message : string;

Expand Down
14 changes: 7 additions & 7 deletions src/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import * as vscode from "vscode";

export class KeyboardLayout {
private mapper : KeyMapper;
private mapper : IKeyMapper;

constructor(mapper? : KeyMapper) {
constructor(mapper? : IKeyMapper) {
this.mapper = mapper;
}

Expand Down Expand Up @@ -37,12 +37,12 @@ export class KeyboardLayout {
}
}

export interface KeyMapper {
export interface IKeyMapper {
name : string;
get(key : string) : string;
}

class KeyMapperEsEsQwerty implements KeyMapper {
class KeyMapperEsEsQwerty implements IKeyMapper {

private mappings = {};

Expand All @@ -64,7 +64,7 @@ class KeyMapperEsEsQwerty implements KeyMapper {
}
}

class KeyMapperDeDeQwertz implements KeyMapper {
class KeyMapperDeDeQwertz implements IKeyMapper {

private mappings = {};

Expand All @@ -87,7 +87,7 @@ class KeyMapperDeDeQwertz implements KeyMapper {
}


class KeyMapperDaDKQwerty implements KeyMapper {
class KeyMapperDaDKQwerty implements IKeyMapper {

private mappings = {};

Expand All @@ -110,7 +110,7 @@ class KeyMapperDaDKQwerty implements KeyMapper {
}
}

class KeyMapperSvSEQwerty implements KeyMapper {
class KeyMapperSvSEQwerty implements IKeyMapper {

private mappings = {};

Expand Down
4 changes: 2 additions & 2 deletions test/keyboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// The module 'assert' provides assertion methods from node
import * as assert from 'assert';
import {KeyboardLayout, KeyMapper} from '../src/keyboard';
import {KeyboardLayout, IKeyMapper} from '../src/keyboard';

suite("KeyboardLayout", () => {

Expand All @@ -19,7 +19,7 @@ suite("KeyboardLayout", () => {
});

test("can use custom mapper", () => {
class FakeMapper implements KeyMapper {
class FakeMapper implements IKeyMapper {
get name() : string {
return "fake mapper";
}
Expand Down
Loading

0 comments on commit 2a2483b

Please sign in to comment.