From 8325565f0ac8783895b0f1b5a16273526326ae4a Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Tue, 5 Jul 2016 13:24:49 -0700 Subject: [PATCH 01/18] Add support for including dotted and .min.js files explicitly in include --- src/compiler/commandLineParser.ts | 7 -- src/compiler/core.ts | 40 +++++- tests/cases/unittests/matchFiles.ts | 186 ++++++++++++++++++++++++++++ 3 files changed, 221 insertions(+), 12 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 7b2aedb5d3d..72fd5ff6fd7 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -689,9 +689,6 @@ namespace ts { return output; } - // Skip over any minified JavaScript files (ending in ".min.js") - // Skip over dotted files and folders as well - const ignoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -1003,10 +1000,6 @@ namespace ts { continue; } - if (ignoreFileNamePattern.test(file)) { - continue; - } - // We may have included a wildcard path with a lower priority // extension due to the user-defined order of entries in the // "include" array. If there is a lower priority extension in the diff --git a/src/compiler/core.ts b/src/compiler/core.ts index fe4731a1c91..3fda91303f9 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -927,6 +927,22 @@ namespace ts { return undefined; } + /** + * Regex for the * wildcard. Matches all characters except for directory seperators. When + * used for including files, also does not match the file extension .min.js + * + * Breakdown for the "files" version: + * [^./] # matches everything up to the first . character (excluding directory seperators) + * (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension + */ + const singleAsteriskRegexFragment = usage === "files" ? "([^./]*(\\.(?!min\\.js$))?)*" : "[^/]*"; + + /** + * Regex for the ** wildcard. Matches any number of subdirectories. When used for including + * files or directories, does not match subdirectories that start with a . character + */ + const doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?" + let pattern = ""; let hasWrittenSubpattern = false; spec: for (const spec of specs) { @@ -947,13 +963,13 @@ namespace ts { components[0] = removeTrailingDirectorySeparator(components[0]); let optionalCount = 0; - for (const component of components) { + for (let component of components) { if (component === "**") { if (hasRecursiveDirectoryWildcard) { continue spec; } - subpattern += "(/.+?)?"; + subpattern += doubleAsteriskRegexFragment; hasRecursiveDirectoryWildcard = true; hasWrittenComponent = true; } @@ -967,6 +983,20 @@ namespace ts { subpattern += directorySeparator; } + if (usage !== "exclude") { + // The * and ? wildcards should not match directories or files that start with . if they + // appear first in a component. Dotted directories and files can be included explicitly + // like so: **/.*/.* + if (startsWith(component, "*")) { + subpattern += "([^./]" + singleAsteriskRegexFragment + ")?"; + component = component.substr(1); + } + else if (startsWith(component, "?")) { + subpattern += "[^./]"; + component = component.substr(1); + } + } + subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); hasWrittenComponent = true; } @@ -990,10 +1020,10 @@ namespace ts { } return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$"); - } - function replaceWildcardCharacter(match: string) { - return match === "*" ? "[^/]*" : match === "?" ? "[^/]" : "\\" + match; + function replaceWildcardCharacter(match: string) { + return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; + } } export interface FileSystemEntries { diff --git a/tests/cases/unittests/matchFiles.ts b/tests/cases/unittests/matchFiles.ts index d68fb9b2a7f..e862cdc379e 100644 --- a/tests/cases/unittests/matchFiles.ts +++ b/tests/cases/unittests/matchFiles.ts @@ -24,6 +24,8 @@ namespace ts { "c:/dev/x/y/b.ts", "c:/dev/js/a.js", "c:/dev/js/b.js", + "c:/dev/js/d.min.js", + "c:/dev/js/ab.min.js", "c:/ext/ext.ts", "c:/ext/b/a..b.ts" ]); @@ -76,6 +78,17 @@ namespace ts { "c:/dev/jspm_packages/a.ts" ]); + const caseInsensitiveDottedFoldersHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, [ + "c:/dev/x/d.ts", + "c:/dev/x/y/d.ts", + "c:/dev/x/y/.e.ts", + "c:/dev/x/.y/a.ts", + "c:/dev/.z/.b.ts", + "c:/dev/.z/c.ts", + "c:/dev/w/.u/e.ts", + "c:/dev/g.min.js/.g/g.ts" + ]); + describe("matchFiles", () => { describe("with literal file list", () => { it("without exclusions", () => { @@ -727,6 +740,33 @@ namespace ts { assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); assert.deepEqual(actual.errors, expected.errors); }); + it("include explicitly listed .min.js files when allowJs=true", () => { + const json = { + compilerOptions: { + allowJs: true + }, + include: [ + "js/*.min.js" + ] + }; + const expected: ts.ParsedCommandLine = { + options: { + allowJs: true + }, + errors: [], + fileNames: [ + "c:/dev/js/ab.min.js", + "c:/dev/js/d.min.js" + ], + wildcardDirectories: { + "c:/dev/js": ts.WatchDirectoryFlags.None + } + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); + }); it("include paths outside of the project", () => { const json = { include: [ @@ -952,6 +992,35 @@ namespace ts { assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); assert.deepEqual(actual.errors, expected.errors); }); + it("exclude .min.js files using wildcards", () => { + const json = { + compilerOptions: { + allowJs: true + }, + include: [ + "js/*.min.js" + ], + exclude: [ + "js/a*" + ] + }; + const expected: ts.ParsedCommandLine = { + options: { + allowJs: true + }, + errors: [], + fileNames: [ + "c:/dev/js/d.min.js" + ], + wildcardDirectories: { + "c:/dev/js": ts.WatchDirectoryFlags.None + } + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); + }); describe("with trailing recursive directory", () => { it("in includes", () => { const json = { @@ -1146,5 +1215,122 @@ namespace ts { }); }); }); + describe("with files or folders that begin with a .", () => { + it("that are not explicitly included", () => { + const json = { + include: [ + "x/**/*", + "w/*/*" + ] + }; + const expected: ts.ParsedCommandLine = { + options: {}, + errors: [], + fileNames: [ + "c:/dev/x/d.ts", + "c:/dev/x/y/d.ts", + ], + wildcardDirectories: { + "c:/dev/x": ts.WatchDirectoryFlags.Recursive, + "c:/dev/w": ts.WatchDirectoryFlags.Recursive + } + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); + }); + describe("that are explicitly included", () => { + it("without wildcards", () => { + const json = { + include: [ + "x/.y/a.ts", + "c:/dev/.z/.b.ts" + ] + }; + const expected: ts.ParsedCommandLine = { + options: {}, + errors: [], + fileNames: [ + "c:/dev/.z/.b.ts", + "c:/dev/x/.y/a.ts" + ], + wildcardDirectories: {} + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); + }); + it("with recursive wildcards that match directories", () => { + const json = { + include: [ + "**/.*/*" + ] + }; + const expected: ts.ParsedCommandLine = { + options: {}, + errors: [], + fileNames: [ + "c:/dev/.z/c.ts", + "c:/dev/g.min.js/.g/g.ts", + "c:/dev/w/.u/e.ts", + "c:/dev/x/.y/a.ts" + ], + wildcardDirectories: { + "c:/dev": ts.WatchDirectoryFlags.Recursive + } + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); + }); + it("with recursive wildcards that match nothing", () => { + const json = { + include: [ + "x/**/.y/*", + ".z/**/.*" + ] + }; + const expected: ts.ParsedCommandLine = { + options: {}, + errors: [], + fileNames: [ + "c:/dev/.z/.b.ts", + "c:/dev/x/.y/a.ts" + ], + wildcardDirectories: { + "c:/dev/.z": ts.WatchDirectoryFlags.Recursive, + "c:/dev/x": ts.WatchDirectoryFlags.Recursive + } + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); + }); + it("with wildcard excludes that implicitly exclude dotted files", () => { + const json = { + include: [ + "**/.*/*" + ], + exclude: [ + "**/*" + ] + }; + const expected: ts.ParsedCommandLine = { + options: {}, + errors: [], + fileNames: [], + wildcardDirectories: {} + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); + }); + }); + }); }); } \ No newline at end of file From 0966ebcffb51cda0e73657784a2aebaa9ca3f955 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Tue, 5 Jul 2016 17:11:04 -0700 Subject: [PATCH 02/18] Removing startsWith reference and fixing linter error --- src/compiler/core.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 3fda91303f9..895a325cca6 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -941,7 +941,7 @@ namespace ts { * Regex for the ** wildcard. Matches any number of subdirectories. When used for including * files or directories, does not match subdirectories that start with a . character */ - const doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?" + const doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; let pattern = ""; let hasWrittenSubpattern = false; @@ -987,11 +987,11 @@ namespace ts { // The * and ? wildcards should not match directories or files that start with . if they // appear first in a component. Dotted directories and files can be included explicitly // like so: **/.*/.* - if (startsWith(component, "*")) { + if (component.indexOf("*") === 0) { subpattern += "([^./]" + singleAsteriskRegexFragment + ")?"; component = component.substr(1); } - else if (startsWith(component, "?")) { + else if (component.indexOf("?") === 0) { subpattern += "[^./]"; component = component.substr(1); } From e0aca418bc0ae395c84ab770c33a7c019ced27cc Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Tue, 12 Jul 2016 11:13:35 -0700 Subject: [PATCH 03/18] Responding to PR feedback --- src/compiler/core.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 895a325cca6..f913e6f9664 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -987,17 +987,17 @@ namespace ts { // The * and ? wildcards should not match directories or files that start with . if they // appear first in a component. Dotted directories and files can be included explicitly // like so: **/.*/.* - if (component.indexOf("*") === 0) { + if (component.charCodeAt(0) === CharacterCodes.asterisk) { subpattern += "([^./]" + singleAsteriskRegexFragment + ")?"; component = component.substr(1); } - else if (component.indexOf("?") === 0) { + else if (component.charCodeAt(0) === CharacterCodes.question) { subpattern += "[^./]"; component = component.substr(1); } } - subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); + subpattern += replaceWildcardCharacters(component, singleAsteriskRegexFragment); hasWrittenComponent = true; } } @@ -1020,6 +1020,10 @@ namespace ts { } return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$"); + } + + function replaceWildcardCharacters(component: string, singleAsteriskRegexFragment: string) { + return component.replace(reservedCharacterPattern, replaceWildcardCharacter); function replaceWildcardCharacter(match: string) { return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; From 574851f526d65d139ccc1d32f0b1c66634d47ed9 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Wed, 13 Jul 2016 11:00:54 -0700 Subject: [PATCH 04/18] More PR feedback --- src/compiler/core.ts | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index dca1487e1fa..5157f3e0b04 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -922,20 +922,22 @@ namespace ts { const reservedCharacterPattern = /[^\w\s\/]/g; const wildcardCharCodes = [CharacterCodes.asterisk, CharacterCodes.question]; + /** + * Matches any single directory segment unless it is the last segment and a .min.js file + * Breakdown: + * [^./] # matches everything up to the first . character (excluding directory seperators) + * (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension + */ + const singleAsteriskRegexFragmentFiles = "([^./]*(\\.(?!min\\.js$))?)*"; + const singleAsteriskRegexFragmentOther = "[^/]*"; + export function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude") { if (specs === undefined || specs.length === 0) { return undefined; } - /** - * Regex for the * wildcard. Matches all characters except for directory seperators. When - * used for including files, also does not match the file extension .min.js - * - * Breakdown for the "files" version: - * [^./] # matches everything up to the first . character (excluding directory seperators) - * (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension - */ - const singleAsteriskRegexFragment = usage === "files" ? "([^./]*(\\.(?!min\\.js$))?)*" : "[^/]*"; + const replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; + const singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; /** * Regex for the ** wildcard. Matches any number of subdirectories. When used for including @@ -997,7 +999,7 @@ namespace ts { } } - subpattern += replaceWildcardCharacters(component, singleAsteriskRegexFragment); + subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); hasWrittenComponent = true; } } @@ -1022,12 +1024,16 @@ namespace ts { return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$"); } - function replaceWildcardCharacters(component: string, singleAsteriskRegexFragment: string) { - return component.replace(reservedCharacterPattern, replaceWildcardCharacter); + function replaceWildCardCharacterFiles(match: string) { + return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles); + } - function replaceWildcardCharacter(match: string) { - return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; - } + function replaceWildCardCharacterOther(match: string) { + return replaceWildcardCharacter(match, singleAsteriskRegexFragmentOther); + } + + function replaceWildcardCharacter(match: string, singleAsteriskRegexFragment: string) { + return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; } export interface FileSystemEntries { From f24341f719866af6b31f96e6eebafba1852ac80a Mon Sep 17 00:00:00 2001 From: Sudheesh Singanamalla Date: Fri, 22 Jul 2016 00:55:21 +0530 Subject: [PATCH 05/18] Remove dependency on tsd, Related to #9658 (#9724) --- Jakefile.js | 9 --------- package.json | 1 - scripts/tsd.json | 12 ------------ 3 files changed, 22 deletions(-) delete mode 100644 scripts/tsd.json diff --git a/Jakefile.js b/Jakefile.js index 1c22305cd86..3ccca833333 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -468,15 +468,6 @@ task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "r exec(cmd); }); -var scriptsTsdJson = path.join(scriptsDirectory, "tsd.json"); -file(scriptsTsdJson); - -task("tsd-scripts", [scriptsTsdJson], function () { - var cmd = "tsd --config " + scriptsTsdJson + " install"; - console.log(cmd); - exec(cmd); -}, { async: true }); - var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests"); var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js"); var importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts"); diff --git a/package.json b/package.json index efe3866b6db..5606a423a0e 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "sorcery": "latest", "through2": "latest", "ts-node": "latest", - "tsd": "latest", "tslint": "next", "typescript": "next" }, diff --git a/scripts/tsd.json b/scripts/tsd.json deleted file mode 100644 index c2fc88a0b0f..00000000000 --- a/scripts/tsd.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "typings", - "bundle": "typings/tsd.d.ts", - "installed": { - "node/node.d.ts": { - "commit": "5f480287834a2615274eea31574b713e64decf17" - } - } -} From bd25c130caaa6c607e830f0f29784d1691308d87 Mon Sep 17 00:00:00 2001 From: Yui Date: Fri, 22 Jul 2016 07:15:12 -0700 Subject: [PATCH 06/18] Port PR 9745 to master (#9881) * Add completion for quote property name in object literal expression * Add fourslash tests for completion of quoted property in object literal expression * Handle object-literal expression as an argument Undo wip Undo wip Conflicts: src/services/services.ts * Add tests and baseline for object literal expression for arguments --- src/services/services.ts | 49 ++++++++++++++++--- ...nForQuotedPropertyInPropertyAssignment1.ts | 24 +++++++++ ...nForQuotedPropertyInPropertyAssignment2.ts | 30 ++++++++++++ ...nForQuotedPropertyInPropertyAssignment3.ts | 26 ++++++++++ ...nForQuotedPropertyInPropertyAssignment4.ts | 24 +++++++++ 5 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts create mode 100644 tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts create mode 100644 tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts create mode 100644 tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts diff --git a/src/services/services.ts b/src/services/services.ts index 3124c78bd15..3b8be487aba 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -4296,6 +4296,7 @@ namespace ts { kindModifiers: getSymbolModifiers(symbol), sortText: "0", }; + } function getCompletionEntriesFromSymbols(symbols: Symbol[], entries: CompletionEntry[], location: Node, performCharacterChecks: boolean): Map { @@ -4324,22 +4325,58 @@ namespace ts { return undefined; } - const argumentInfo = SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - // Get string literal completions from specialized signatures of the target - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); + if (node.parent.kind === SyntaxKind.PropertyAssignment && node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression) { + // Get quoted name of properties of the object literal expression + // i.e. interface ConfigFiles { + // 'jspm:dev': string + // } + // let files: ConfigFiles = { + // '/*completion position*/' + // } + // + // function foo(c: ConfigFiles) {} + // foo({ + // '/*completion position*/' + // }); + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); } else if (isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { // Get all names of properties on the expression + // i.e. interface A { + // 'prop1': string + // } + // let a: A; + // a['/*completion position*/'] return getStringLiteralCompletionEntriesFromElementAccess(node.parent); } else { - // Otherwise, get the completions from the contextual type if one exists + const argumentInfo = SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + // Get string literal completions from specialized signatures of the target + // i.e. declare function f(a: 'A'); + // f("/*completion position*/") + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, node); + } + + // Get completion for string literal from string literal type + // i.e. var x: "hi" | "hello" = "/*completion position*/" return getStringLiteralCompletionEntriesFromContextualType(node); } } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo) { + function getStringLiteralCompletionEntriesFromPropertyAssignment(element: ObjectLiteralElement) { + const typeChecker = program.getTypeChecker(); + const type = typeChecker.getContextualType((element.parent)); + const entries: CompletionEntry[] = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/false); + if (entries.length) { + return { isMemberCompletion: true, isNewIdentifierLocation: true, entries }; + } + } + } + + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo, location: Node) { const typeChecker = program.getTypeChecker(); const candidates: Signature[] = []; const entries: CompletionEntry[] = []; diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts new file mode 100644 index 00000000000..7faebc1474b --- /dev/null +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts @@ -0,0 +1,24 @@ +/// + +//// export interface Configfiles { +//// jspm: string; +//// 'jspm:browser': string; +//// 'jspm:dev': string; +//// 'jspm:node': string; +//// } + +//// let files: Configfiles; +//// files = { +//// /*0*/: '', +//// '/*1*/': '' +//// } + +goTo.marker('0'); +verify.completionListContains("jspm"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(1); + +goTo.marker('1'); +verify.completionListContains("jspm:dev"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(4); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts new file mode 100644 index 00000000000..4ba88e7dd2a --- /dev/null +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts @@ -0,0 +1,30 @@ +/// + +//// export interface Config { +//// files: ConfigFiles +//// } + +//// export interface ConfigFiles { +//// jspm: string; +//// 'jspm:browser': string; +//// 'jspm:dev': string; +//// 'jspm:node': string; +//// } + +//// let config: Config; +//// config = { +//// files: { +//// /*0*/: '', +//// '/*1*/': '' +//// } +//// } + +goTo.marker('0'); +verify.completionListContains("jspm"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(1); + +goTo.marker('1'); +verify.completionListContains("jspm:dev"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(4); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts new file mode 100644 index 00000000000..238606520e3 --- /dev/null +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts @@ -0,0 +1,26 @@ +/// + +//// let configFiles1: { +//// jspm: string; +//// 'jspm:browser': string; +//// } = { +//// /*0*/: "", +//// } + +//// let configFiles2: { +//// jspm: string; +//// 'jspm:browser': string; +//// } = { +//// jspm: "", +//// '/*1*/': "" +//// } + +goTo.marker('0'); +verify.completionListContains("jspm"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(1); + +goTo.marker('1'); +verify.completionListContains("jspm:browser"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(2); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts new file mode 100644 index 00000000000..9855bb8c502 --- /dev/null +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts @@ -0,0 +1,24 @@ +/// + +//// export interface ConfigFiles { +//// jspm: string; +//// 'jspm:browser': string; +//// 'jspm:dev': string; +//// 'jspm:node': string; +//// } + +//// function foo(c: ConfigFiles) {} +//// foo({ +//// j/*0*/: "", +//// "/*1*/": "", +//// }) + +goTo.marker('0'); +verify.completionListContains("jspm"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(1); + +goTo.marker('1'); +verify.completionListContains("jspm:dev"); +verify.completionListAllowsNewIdentifier(); +verify.memberListCount(4); From f94025d855581f4fc94d7ca895fc2c227614205a Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 1 Jul 2016 13:34:15 -0700 Subject: [PATCH 07/18] Improve web tests * Provide a favicon so chrome doesn't block waiting for one * Provide accurate content type so chrome doesn't warn --- tests/webTestResults.html | 13 +++++++------ tests/webTestServer.ts | 26 +++++++++++++++++--------- tests/webhost/favicon-32x32.png | Bin 0 -> 800 bytes 3 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 tests/webhost/favicon-32x32.png diff --git a/tests/webTestResults.html b/tests/webTestResults.html index 2993681934e..9c403248f94 100644 --- a/tests/webTestResults.html +++ b/tests/webTestResults.html @@ -3,22 +3,23 @@ Mocha Tests + -
+
- - + +
- +
- +
- +