From 65a48ca15dafc303e03b4eaf8663f68ea6fabb3b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 6 Jun 2017 11:27:31 -0700 Subject: [PATCH] Encorporting feedback --- Gulpfile.ts | 2 +- src/services/completions.ts | 10 +++------- tests/cases/fourslash/completionListWithMeanings.ts | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Gulpfile.ts b/Gulpfile.ts index d856254296e..c2724b5fb10 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -745,7 +745,7 @@ declare module "convert-source-map" { export function fromSource(source: string, largeSource?: boolean): SourceMapConverter; } -gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => { +gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile, run], (done) => { const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "../../built/local/bundle.js" }, /*useBuiltCompiler*/ true)); return testProject.src() .pipe(newer("built/local/bundle.js")) diff --git a/src/services/completions.ts b/src/services/completions.ts index 7c0662c7531..8b11eb74e61 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -749,13 +749,9 @@ namespace ts.Completions { } function isContextTokenValueLocation(contextToken: Node) { - if (contextToken) { - const parentKind = contextToken.parent.kind; - switch (contextToken.kind) { - case SyntaxKind.TypeOfKeyword: - return parentKind === SyntaxKind.TypeQuery; - } - } + return contextToken && + contextToken.kind === SyntaxKind.TypeOfKeyword && + contextToken.parent.kind === SyntaxKind.TypeQuery; } function isContextTokenTypeLocation(contextToken: Node) { diff --git a/tests/cases/fourslash/completionListWithMeanings.ts b/tests/cases/fourslash/completionListWithMeanings.ts index 995bec8bd66..61dc95adca8 100644 --- a/tests/cases/fourslash/completionListWithMeanings.ts +++ b/tests/cases/fourslash/completionListWithMeanings.ts @@ -11,6 +11,7 @@ ////var tt = /*valueExpr*/xx; ////var yy: /*typeExpr*/point = { x: 4, y: 3 + /*valueExprInObjectLiteral*/tt }; ////var kk: m3.point3/*membertypeExpr*/ = m3.zz2/*membervalueExpr*/; +////var zz = { x: 4, y: 3 }; const markers = test.markerNames(); @@ -37,6 +38,7 @@ const values: CompletionInfo[] = [ ["xx", "var xx: number"], ["tt", "var tt: number"], ["yy", "var yy: point"], + ["zz", "var zz: point"], ["m2", "namespace m2"], // With no type side, allowed only in value ];