Skip to content

Less aggresive completion list #1767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Feb 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
308f13f
infrastructure for builder item in completion list
Jan 9, 2015
85c5b3d
This fixes #1505 by not showing completionlist when defining a property.
Jan 9, 2015
54bf7ad
Add test case for completionlist when adding properties to a class.
Jan 14, 2015
1d2554b
Fix to make the completionlist work correctly when typing a new gener…
Jan 20, 2015
8c26917
Fourslash support for the builder property on completion lists.
Jan 20, 2015
8bcf376
Clean up
Jan 20, 2015
34cc5cc
First try at getting logic in for showing the builder.
Jan 20, 2015
189c8f8
Support for builder in modules + tests
Jan 20, 2015
c0a5dea
Delete old modules completion list test.
Jan 20, 2015
4892381
Merge branch 'master' into LessAggresiveCompletionList
Jan 20, 2015
832af68
Builder in constructor aruguments + tests.
Jan 20, 2015
cb4a110
test cases for builder in constructor
Jan 20, 2015
e4a24e9
Builder implementation for properties and parameters inlcuding tests.
Jan 22, 2015
7bc8f1e
Merge branch 'master' into LessAggresiveCompletionList
Jan 22, 2015
54c9e56
White space fixes
Jan 22, 2015
3bb817f
Clean up after code review, white space etc.
Jan 22, 2015
a9245d7
Merge branch 'master' into LessAggresiveCompletionList
Jan 30, 2015
5166d09
Merge branch 'master' into LessAggresiveCompletionList
Feb 3, 2015
3b0f8f6
Added comments and some additional cases
Feb 3, 2015
f8adf4e
Merge branch 'master' into LessAggresiveCompletionList
Feb 3, 2015
62bc9df
Support for destructuring + test case.
Feb 3, 2015
93f3321
Update API sample tests.
Feb 3, 2015
d9f678f
Rename the isBuilder property to something more meaningful.
Feb 4, 2015
e233da0
Parameter destructuring + tests
Feb 4, 2015
6e35f79
Add builder support for variable declarations + test cases.
Feb 4, 2015
ece874f
Merge branch 'master' into LessAggresiveCompletionList
Feb 4, 2015
40824ed
Added templates, assignement and arrays + tests.
Feb 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/harness/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,16 @@ module FourSlash {

Harness.IO.log(errorMsg);
this.raiseError("Completion list is not empty at Caret");
}
}

public verifyCompletionListAllowsNewIdentifier(negative: boolean) {
var completions = this.getCompletionListAtCaret();

if ((completions && !completions.isNewIdentifierLocation) && !negative) {
this.raiseError("Expected builder completion entry");
} else if ((completions && completions.isNewIdentifierLocation) && negative) {
this.raiseError("Un-expected builder completion entry");
}
}

Expand Down
192 changes: 143 additions & 49 deletions src/services/services.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/baselines/reference/APISample_compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,7 @@ declare module "typescript" {
}
interface CompletionInfo {
isMemberCompletion: boolean;
isNewIdentifierLocation: boolean;
entries: CompletionEntry[];
}
interface CompletionEntry {
Expand Down
3 changes: 3 additions & 0 deletions tests/baselines/reference/APISample_compile.types
Original file line number Diff line number Diff line change
Expand Up @@ -5464,6 +5464,9 @@ declare module "typescript" {
isMemberCompletion: boolean;
>isMemberCompletion : boolean

isNewIdentifierLocation: boolean;
>isNewIdentifierLocation : boolean

entries: CompletionEntry[];
>entries : CompletionEntry[]
>CompletionEntry : CompletionEntry
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/APISample_linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,7 @@ declare module "typescript" {
}
interface CompletionInfo {
isMemberCompletion: boolean;
isNewIdentifierLocation: boolean;
entries: CompletionEntry[];
}
interface CompletionEntry {
Expand Down
3 changes: 3 additions & 0 deletions tests/baselines/reference/APISample_linter.types
Original file line number Diff line number Diff line change
Expand Up @@ -5594,6 +5594,9 @@ declare module "typescript" {
isMemberCompletion: boolean;
>isMemberCompletion : boolean

isNewIdentifierLocation: boolean;
>isNewIdentifierLocation : boolean

entries: CompletionEntry[];
>entries : CompletionEntry[]
>CompletionEntry : CompletionEntry
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/APISample_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,7 @@ declare module "typescript" {
}
interface CompletionInfo {
isMemberCompletion: boolean;
isNewIdentifierLocation: boolean;
entries: CompletionEntry[];
}
interface CompletionEntry {
Expand Down
3 changes: 3 additions & 0 deletions tests/baselines/reference/APISample_transform.types
Original file line number Diff line number Diff line change
Expand Up @@ -5542,6 +5542,9 @@ declare module "typescript" {
isMemberCompletion: boolean;
>isMemberCompletion : boolean

isNewIdentifierLocation: boolean;
>isNewIdentifierLocation : boolean

entries: CompletionEntry[];
>entries : CompletionEntry[]
>CompletionEntry : CompletionEntry
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/APISample_watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,7 @@ declare module "typescript" {
}
interface CompletionInfo {
isMemberCompletion: boolean;
isNewIdentifierLocation: boolean;
entries: CompletionEntry[];
}
interface CompletionEntry {
Expand Down
3 changes: 3 additions & 0 deletions tests/baselines/reference/APISample_watcher.types
Original file line number Diff line number Diff line change
Expand Up @@ -5720,6 +5720,9 @@ declare module "typescript" {
isMemberCompletion: boolean;
>isMemberCompletion : boolean

isNewIdentifierLocation: boolean;
>isNewIdentifierLocation : boolean

entries: CompletionEntry[];
>entries : CompletionEntry[]
>CompletionEntry : CompletionEntry
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference path='fourslash.ts' />

////interface A</*genericName1*/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't put newlines in here unless they also have //// preceding them, otherwise fourslash considers each thing a new file (all within the same project context). It's usually an unobservable difference but it's best to just be safe. Same thing in other tests by the looks of it, I won't comment on each one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intended these to be new files.

////class A</*genericName2*/

////class B<T, /*genericName3*/

////class A{
//// f</*genericName4*/

////function A</*genericName5*/


test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.completionListIsEmpty();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference path='fourslash.ts' />

//// var [x/*variable1*/

//// var [x, y/*variable2*/

//// var [./*variable3*/

//// var [x, ...z/*variable4*/

//// var {x/*variable5*/

//// var {x, y/*variable6*/

//// function func1({ a/*parameter1*/

//// function func2({ a, b/*parameter2*/

test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.completionListIsEmpty();
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,17 @@

////function testFunction(a, b/*parameterName4*/

////class bar1{ constructor(/*constructorParamter1*/
////class bar5{ constructor(public /*constructorParamter1*/

////class bar2{ constructor(a/*constructorParamter2*/
////class bar6{ constructor(public a/*constructorParamter2*/

////class bar3{ constructor(a, /*constructorParamter3*/
////class bar7{ constructor(protected a/*constructorParamter3*/

////class bar4{ constructor(a, b/*constructorParamter4*/
////class bar8{ constructor(private a/*constructorParamter4*/

////class bar5{ constructor(public /*constructorParamter5*/
////class bar9{ constructor(.../*constructorParamter5*/

////class bar6{ constructor(public a/*constructorParamter6*/

////class bar7{ constructor(private a/*constructorParamter7*/

////class bar8{ constructor(.../*constructorParamter8*/

////class bar9{ constructor(...a/*constructorParamter9*/
////class bar10{ constructor(...a/*constructorParamter6*/


test.markers().forEach((m) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference path='fourslash.ts' />

////var aa = 1;

////class A1 {
//// /*property1*/
////}

////class A2 {
//// p/*property2*/
////}

////class A3 {
//// public s/*property3*/
////}

////class A4 {
//// a/*property4*/
////}

////class A5 {
//// public a/*property5*/
////}

////class A6 {
//// protected a/*property6*/
////}

////class A7 {
//// private a/*property7*/
////}

test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.not.completionListIsEmpty();
verify.completionListAllowsNewIdentifier();
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

////var a2, a/*varName4*/

debugger;
test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.completionListIsEmpty();
Expand Down
13 changes: 13 additions & 0 deletions tests/cases/fourslash/completionListBuilderLocations_Modules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// <reference path='fourslash.ts' />

////module A/*moduleName1*/


////module A./*moduleName2*/


test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.not.completionListIsEmpty();
verify.completionListAllowsNewIdentifier();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/// <reference path='fourslash.ts' />

////var x = a/*var1*/

////var x = (b/*var2*/

////var x = (c, d/*var3*/

//// var y : any = "", x = a/*var4*/

//// var y : any = "", x = (a/*var5*/

////class C{}
////var y = new C(

//// class C{}
//// var y = new C(0, /*var7*/

////var y = [/*var8*/

////var y = [0, /*var9*/

////var y = `${/*var10*/

////var y = `${10} dd ${ /*var11*/

////var y = 10; y=/*var12*/

test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.completionListAllowsNewIdentifier();
});


22 changes: 22 additions & 0 deletions tests/cases/fourslash/completionListBuilderLocations_parameters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference path='fourslash.ts' />

////var aa = 1;

////class bar1{ constructor(/*constructorParamter1*/

////class bar2{ constructor(a/*constructorParamter2*/

////class bar3{ constructor(a, /*constructorParamter3*/

////class bar4{ constructor(a, b/*constructorParamter4*/

////class bar6{ constructor(public a, /*constructorParamter5*/

////class bar7{ constructor(private a, /*constructorParamter6*/


test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.not.completionListIsEmpty();
verify.completionListAllowsNewIdentifier();
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

////var aa = 1;

////module /*moduleName1*/

////module a/*moduleName2*/
////class A1 {
//// public static /*property1*/
////}

////class A2 {
//// public static a/*property2*/
////}

test.markers().forEach((m) => {
goTo.position(m.position, m.fileName);
verify.completionListIsEmpty();
});
});
4 changes: 4 additions & 0 deletions tests/cases/fourslash/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ module FourSlashInterface {
FourSlash.currentTestState.verifyCompletionListIsEmpty(this.negative);
}

public completionListAllowsNewIdentifier() {
FourSlash.currentTestState.verifyCompletionListAllowsNewIdentifier(this.negative);
}

public memberListIsEmpty() {
FourSlash.currentTestState.verifyMemberListIsEmpty(this.negative);
}
Expand Down