Skip to content

Conversation

@rintaro
Copy link
Member

@rintaro rintaro commented May 8, 2020

key.is_system: 1 is added if the associated declaration is from a system module.

rdar://problem/62617558

(This will conflict with #31637, I will rebase it after merging this)

@rintaro
Copy link
Member Author

rintaro commented May 8, 2020

@swift-ci Please test

Copy link
Member Author

Choose a reason for hiding this comment

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

I think 63 is still more than enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

@benlangmuir WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why reduce it? Isn't the bitfield within 32 bits either way?

Copy link
Member Author

Choose a reason for hiding this comment

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

As per offline discussion, we decided to keep it 127.

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2020

Build failed
Swift Test OS X Platform
Git Sha - dd65ee26546daed22b361a7bcac1d54d17e33e0d

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2020

Build failed
Swift Test Linux Platform
Git Sha - dd65ee26546daed22b361a7bcac1d54d17e33e0d

@rintaro rintaro changed the title [CodeCompletion] Add 'IsSytem' flag to code completion result item [CodeCompletion] Add 'IsSystem' flag to code completion result item May 8, 2020
@rintaro rintaro force-pushed the ide-completion-issystem-rdar62617558 branch from dd65ee2 to 92bde31 Compare May 8, 2020 02:03
@rintaro
Copy link
Member Author

rintaro commented May 8, 2020

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2020

Build failed
Swift Test Linux Platform
Git Sha - dd65ee26546daed22b361a7bcac1d54d17e33e0d

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2020

Build failed
Swift Test OS X Platform
Git Sha - dd65ee26546daed22b361a7bcac1d54d17e33e0d

@rintaro rintaro requested a review from akyrtzi May 8, 2020 15:56
@rintaro rintaro force-pushed the ide-completion-issystem-rdar62617558 branch from 92bde31 to f453c12 Compare May 11, 2020 19:06
'key.is_system: 1' is added if the associated declaration is from a
system module.

rdar://problem/62617558
@rintaro rintaro force-pushed the ide-completion-issystem-rdar62617558 branch from f453c12 to 75a0c9f Compare May 11, 2020 19:24
@rintaro
Copy link
Member Author

rintaro commented May 11, 2020

@swift-ci Please smoke test

Builder.setNumBytesToErase(dist);
Builder.addOverrideKeyword();
Builder.addDeclIntroducer(DeclStr.str().substr(0, NameOffset));
}
Copy link
Member Author

@rintaro rintaro May 11, 2020

Choose a reason for hiding this comment

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

@akyrtzi There was no MaxNumBytesToErase check for override completion.

If the dist exceed MaxNumBytesToErase, completion just gives up adding override keyword before the introducer (e.g. func, var).

Copy link
Contributor

Choose a reason for hiding this comment

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

Why reduce it? Isn't the bitfield within 32 bits either way?

// CHECK: {
// CHECK: key.kind: source.lang.swift.decl.function.method.instance,
// CHECK: key.name: "makeIterator()",
// CHECK-NEXT: key.sourcetext: "makeIterator()",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really care about testing all these fields here? Can we just check is_system specifically?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a way to check that the line is in the same item (i.e. before }, line )?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a great solution, but

CHECK: key.name: "blah blah blah"
CHECK-NOT: key.name
CHECK: key.is_system: 1

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, that actually works for is_system: 1 checks. I still haven't found a way to check the item does not have is_system: 1 line.

Copy link
Member Author

@rintaro rintaro May 11, 2020

Choose a reason for hiding this comment

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

// CHECK: key.name: "makeIterator()"
// CHECK-NOT: },
// CHECK: key.is_system: 1
// CHECK: },

// CHECK: key.name: "startIndex"
// CHECK-NOT: },
// CHECK-NOT: key.is_system: 1
// CHECK: },

This seems to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Only danger is that we could add a dictionary in the middle of the response some day, but not sure there is a better solution right now.

Only check lines we really care about.
@rintaro
Copy link
Member Author

rintaro commented May 11, 2020

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented May 11, 2020

@swift-ci Please smoke test macOS

@rintaro rintaro merged commit bfde3b0 into swiftlang:master May 12, 2020
@rintaro rintaro deleted the ide-completion-issystem-rdar62617558 branch May 12, 2020 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants