Skip to content
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

Update for apple/swift#29619 #712

Merged
merged 1 commit into from Feb 5, 2020

Conversation

hamishknight
Copy link
Collaborator

No description provided.

@hamishknight
Copy link
Collaborator Author

apple/swift#29619

@swift-ci please test

@hamishknight hamishknight changed the title Update for https://github.com/apple/swift/pull/29619 Update for apple/swift#29619 Feb 3, 2020
@hamishknight
Copy link
Collaborator Author

apple/swift#29619

@swift-ci please test

@slavapestov slavapestov merged commit a3072c9 into apple:swift/master Feb 5, 2020
@hamishknight hamishknight deleted the a-buffet-of-tokens branch February 5, 2020 21:58
marcrasi pushed a commit to marcrasi/llvm-project that referenced this pull request Feb 6, 2020
marcrasi pushed a commit to marcrasi/llvm-project that referenced this pull request Feb 7, 2020
marcrasi pushed a commit that referenced this pull request Feb 7, 2020
…fix-to-tensorflow

This is the main PR fixing https://bugs.swift.org/browse/SR-12076 in swift-jupyter. There are three parts to the fix:
* A PR into apple/swift cherry-picking fixes apple/swift#29619 and apple/swift#29664 from master: apple/swift#29707.
* This PR cherry-picks the #712 fix from apple:swift/master llvm-project.
* This PR also makes additional fixes in SwiftCodeCompletion.cpp, which is a custom thing in the `tensorflow` branch of llvm-project.

**Background on SwiftCodeCompletion.cpp**

The existing REPL code completion implementation ([REPLCodeCompletion.cpp](https://github.com/apple/swift/blob/167fea2c78ba334c8248dc05d32e50ccb848122f/lib/IDE/REPLCodeCompletion.cpp)) had some problems making it unsuitable for implementing code completion in swift-jupyter:
* It didn't handle redeclarations correctly.
* It didn't have an API that was callable from Python.

So I duplicated it into `SwiftCodeCompletion.cpp` and made improvements.

I'm planning to upstream these improvements soon so that we don't have this duplicate implementation, but for now we have it.

Whenever someone makes an important change in `REPLCodeCompletion.cpp`, we need to make the corresponding change in `SwiftCodeCompletion.cpp`.

**This PR's fixes to SwiftCodeCompletion.cpp**

apple/swift#29664 fixes https://bugs.swift.org/browse/SR-12076 for `REPLCodeCompletion.cpp` by changing it from reusing an existing source file to creating a new source file for every completion request.

So this PR makes a corresponding change in `SwiftCodeCompletion.cpp`, making it create new source files for every request. This actually simplifies the logic in `SwiftCodeCompletion.cpp` quite a lot, because we don't have to deal with existing state in the files.

Also, while making this change, I noticed that `SwiftCodeCompletion.cpp` wastefully parsed and typechecked a file merely to calculate the completion offset (see explanation in doc comment `FindCompletionPrefixOffset` for explanation of what completion offset it). So I switched it to calculate the completion offset by looking at the characters, inspired by logic in [sourcekit-lsp](https://github.com/apple/sourcekit-lsp/blob/9b8e4c714651ac56dea4c268650b7e68fb918814/Sources/SourceKit/sourcekitd/SwiftLanguageServer.swift#L537).
marcrasi pushed a commit to marcrasi/llvm-project that referenced this pull request Feb 7, 2020
…lete-fix-to-tensorflow

This is the main PR fixing https://bugs.swift.org/browse/SR-12076 in swift-jupyter. There are three parts to the fix:
* A PR into apple/swift cherry-picking fixes apple/swift#29619 and apple/swift#29664 from master: apple/swift#29707.
* This PR cherry-picks the apple#712 fix from apple:swift/master llvm-project.
* This PR also makes additional fixes in SwiftCodeCompletion.cpp, which is a custom thing in the `tensorflow` branch of llvm-project.

**Background on SwiftCodeCompletion.cpp**

The existing REPL code completion implementation ([REPLCodeCompletion.cpp](https://github.com/apple/swift/blob/167fea2c78ba334c8248dc05d32e50ccb848122f/lib/IDE/REPLCodeCompletion.cpp)) had some problems making it unsuitable for implementing code completion in swift-jupyter:
* It didn't handle redeclarations correctly.
* It didn't have an API that was callable from Python.

So I duplicated it into `SwiftCodeCompletion.cpp` and made improvements.

I'm planning to upstream these improvements soon so that we don't have this duplicate implementation, but for now we have it.

Whenever someone makes an important change in `REPLCodeCompletion.cpp`, we need to make the corresponding change in `SwiftCodeCompletion.cpp`.

**This PR's fixes to SwiftCodeCompletion.cpp**

apple/swift#29664 fixes https://bugs.swift.org/browse/SR-12076 for `REPLCodeCompletion.cpp` by changing it from reusing an existing source file to creating a new source file for every completion request.

So this PR makes a corresponding change in `SwiftCodeCompletion.cpp`, making it create new source files for every request. This actually simplifies the logic in `SwiftCodeCompletion.cpp` quite a lot, because we don't have to deal with existing state in the files.

Also, while making this change, I noticed that `SwiftCodeCompletion.cpp` wastefully parsed and typechecked a file merely to calculate the completion offset (see explanation in doc comment `FindCompletionPrefixOffset` for explanation of what completion offset it). So I switched it to calculate the completion offset by looking at the characters, inspired by logic in [sourcekit-lsp](https://github.com/apple/sourcekit-lsp/blob/9b8e4c714651ac56dea4c268650b7e68fb918814/Sources/SourceKit/sourcekitd/SwiftLanguageServer.swift#L537).
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.

None yet

2 participants