Commit Graph

1606 Commits

Author SHA1 Message Date
Ben Barham
157c742cac Merge pull request #39851 from bnbarham/always-add-module-name
[CursorInfo] Always add module name to response
2021-10-28 09:05:59 +10:00
Ben Barham
8128450690 [CursorInfo] Always add module name to response
To simplify clients, have the cursorinfo result be consistent whether
requesting a symbol within the current module or not, ie. do not skip
adding the module name.

Resolves rdar://77003299
2021-10-22 12:35:53 +10:00
Zoe Carver
401f334b90 Merge pull request #38675 from zoecarver/lazy-importer-namespaces
[cxx-interop] Lazily import members of clang namespaces and records via requests.
2021-10-21 09:04:52 -07:00
zoecarver
b8e52a7ad2 [cxx-interop] Lazily import members of Clang namespaces and records via requests.
Also adds a ClangImporter request zone and move some requests into it.
2021-10-20 14:52:43 -07:00
Alex Hoppen
2f19d1847f [SourceKit] Add a dedicated request to retrieve the diagnostics of a file
Currently, SourceKit always implicitly sends diagnostics to the client after every edit. This doesn’t match our new cancellation story because diagnostics retrieval is no request and thus can’t be cancelled.

Instead, diagnostics retrieval should be a standalone request, which returns a cancellation token like every other request and which can thus also be cancelled as such.

The indented transition path here is to change all open and edit requests to be syntactic only. When diagnostics are needed, the new diagnostics request should be used.

rdar://83391522
2021-10-13 21:28:18 +02:00
swift-ci
3f8fea8508 Merge remote-tracking branch 'origin/main' into rebranch 2021-10-06 10:17:29 -07:00
Alex Hoppen
5e9ff15960 Merge pull request #39540 from ahoppen/pr/simulate-long-request
[SourceKit] Add option to simulate a long-running request
2021-10-05 11:59:47 +02:00
Meghana Gupta
f458d9b490 Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag (#39516)
* Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag

This includes a bit in the module format to represent if the module was
compiled with -enable-ossa-modules flag. When compiling a client module
with -enable-ossa-modules flag, all dependent modules are checked for this bit,
if not on, recompilation is triggered with -enable-ossa-modules.

* Updated tests
2021-10-04 18:46:40 -07:00
Alex Hoppen
fa0ead5dc1 [SourceKit] Add option to simulate a long-running request
This allows us to remove the dependency on a slow-to-typecheck example for a `sourcekitd-test`.
2021-10-04 21:43:53 +02:00
swift-ci
c51550f30e Merge remote-tracking branch 'origin/main' into rebranch 2021-09-30 15:11:41 -07:00
Alex Hoppen
b0678ca524 Merge pull request #39494 from ahoppen/pr/sourcekit-cancellation-tokens
[SourceKit] Allow explicit cancellation of requests with a cancellation token
2021-09-30 17:01:53 +02:00
Alex Hoppen
7d5ee83a61 [SourceKit] Allow explicit cancellation of requests with a cancellation token
The key changes here are
- To keep track of cancellation tokens for all `ScheduledConsumer`s in `SwiftASTManager`
- Generate unique request handles for all incoming requests (`create_request_handle `), use these request handles as cancellation tokens and return them from the `sourcekitd_send_request` methods
- Implement cancellation with `sourcekitd_cancel_request` as the entry point and `SwiftASTManager::cancelASTConsumer` as the termination point

Everything else is just plumbing the cancellation token through the various abstraction layers.

rdar://83391505
2021-09-30 11:45:24 +02:00
Rintaro Ishizaki
fa04717bf5 Merge pull request #39395 from rintaro/sourcekit-completion-inits
[CodeCompletion] Remove two completion options from LangOptions
2021-09-29 09:52:51 -07:00
Alex Hoppen
4521c99d56 Merge pull request #38782 from ahoppen/pr/sourcekit-cancellation
[SourceKit] Support cancellation of requests while an AST is being built
2021-09-28 20:08:14 +02:00
Alex Hoppen
7a80034e35 [SourceKit] Support cancellation of requests while an AST is being built
This commit refactors the way ASTs are being built in SourceKit and how `SwiftASTConsumer`s are served by the built ASTs. `SwiftASTManager.h` should give an overview of the new design.

This commit does not change the cancellation paradigm in SourceKit (yet). That is, subsequent requests with the same `OncePerASTToken` still cancel previous requests with the same token. But while previously, we were only able to cancel requests that haven’t started an AST build yet, we can now also cancel the AST build of the to-be-cancelled requests.

With this change in place, we can start looking into explicit cancellation of requests or other cancellation paradigms.
2021-09-23 11:53:45 +02:00
Rintaro Ishizaki
afc24dfd4b [CodeCompletion] Remove two completion options from LangOptions
"add inits to toplevel" and "call pattern heuristics" are only used in
code completion. Move them from LangOptions to CodeCompletionContext so
that they don't affect compiler arguments.
2021-09-22 16:49:50 -07:00
swift-ci
102e1cebc1 Merge remote-tracking branch 'origin/main' into rebranch 2021-09-22 15:53:25 -07:00
Rintaro Ishizaki
1656eed597 Revert "[CodeCompletion] Provide known module source file information"
This effectively reverts commit f8751d466e.
2021-09-22 10:06:19 -07:00
swift-ci
cb32b553de Merge remote-tracking branch 'origin/main' into rebranch 2021-09-04 11:32:57 -07:00
Hamish Knight
dc60996f89 Merge pull request #38836 from hamishknight/toil-and-tuple 2021-09-04 19:30:04 +01:00
swift-ci
0c7778f1bc Merge remote-tracking branch 'origin/main' into rebranch 2021-09-02 15:54:46 -07:00
Rintaro Ishizaki
bd5b3012f4 Merge pull request #38453 from rintaro/ide-completion-overrideannotation-rdarrdar62617558
[CodeCompletion] Annotate override completions
2021-09-02 15:50:26 -07:00
Rintaro Ishizaki
7e7b2c3557 [CodeCompletion] Annotate override completions
* "description" for override completion is now annotatable
* "description" doesn't include attributes and decl introducer, but it
  includes generic paramters, effects specifiers, result type clause,
  and generic where clauses
* "name" now only include the name and the parameter names
* "sourcetext" should be the same

rdar://63835352
2021-09-02 12:12:26 -07:00
Hamish Knight
78d8d09b99 [IDE] Adopt ArgumentList 2021-09-01 18:40:26 +01:00
swift-ci
86a715d70e Merge remote-tracking branch 'origin/main' into rebranch 2021-08-30 17:15:00 -07:00
Ben Barham
a375ffebcf Merge pull request #39084 from apple/remove-keywords
[Completion] Remove unused DocWords
2021-08-31 10:10:22 +10:00
Ben Barham
8ae8f1d204 [Completion] Remove unused DocWords
The various keyword/recommended/etc fields were parsed and added to
completions, but never actually plumbed through SourceKit. Since they're
still unused and the implementation is not particularly lightweight,
just remove for now.

Resolves rdar://82464220
2021-08-28 14:05:01 +10:00
swift-ci
19048afbc8 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-25 07:13:51 -07:00
Slava Pestov
bffce661c8 SourceKit: Don't call subst() with generic parameters that don't exist in the SubstitutionMap
Hack around this instead by using the two-function form of subst(),
and checking if the generic parameter is valid in the signature.

This comes up because we're using the generic signature of the
nominal type to get a SubstitutionMap, and then applying this map
to the types in the generic requirements of a member. If the member
introduces its own generic parameters, some of those requirements
might not be valid types in the outer generic signature.

This can probably use SubstitutionMap::combineSubstitutionMaps()
instead, but it would require more refactoring than I'm willing
to undertake for now.
2021-08-24 16:26:19 -04:00
swift-ci
79ca271751 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-20 14:53:15 -07:00
Ben Barham
c7620fa979 [Refactorings] Add cursor refactorings for the start of the range
When a range is a single expression/statement/decl or part of
expression, also return cursor based refactorings for the start of the
range.

This is a stop gap until the available refactorings are properly fixed
to be more lenient in general - the current fix is a little odd as eg.
if all of `foo.bar()` is selected, rename will be returned as an
available refactoring for `foo`. Still an improvement over completely
missing cursor based refactorings, however.

Resolves rdar://82060063
2021-08-18 14:04:10 +10:00
swift-ci
d21e7e0aba Merge remote-tracking branch 'origin/main' into rebranch 2021-08-11 13:32:56 -07:00
Rintaro Ishizaki
ed1db1bed2 [CodeCompletion] Explain why results aren't recommended
* Implement 'getDiagnosticSeverity()' and 'getDiagnosticMessage()' on
  'CodeCompletionResult'
* Differentiate 'RedundantImportIndirect' from 'RedundantImport'
* Make non-Sendable check respects '-warn-concurrency'

rdar://76129658
2021-08-10 17:11:14 -07:00
Rintaro Ishizaki
f8751d466e [CodeCompletion] Provide known module source file information
* 'CodeCompletionContext' now has 'requiresSourceFileInfo()' flag
* When 'true', 'SourceFiles' is populated.
* 'SourceFiles' is a list of pairs of a known module source
  file path and its up-to-date-ness
* Clients (i.e. 'CodeCompletionConsumer') can retrieve it from
  'CodeCompletionContext' in 'handleResults'
* Each completion item now has 'SourceFilePath' property
* C-APIs to get those informations
2021-08-10 17:11:14 -07:00
Ben Langmuir
d6eec880cb [completion] Update CodeCompletionConsumer::handleResults()
Receive 'CodeCompletionContext' so that consumers can get more
information from it.
2021-08-10 14:14:15 -07:00
swift-ci
8e11ea0ae8 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-06 16:13:41 -07:00
Ben Barham
f6899eda96 [SourceKit] Suppress oslog_invalid_log_message diagnostic in live issues
The index build skips *all* function bodies, including inlinable. The
`OSLogOptimization` pass expects SIL for inlinable bodies and thus
outputs a spurious diagnostic for live issues when the
`OSLogInterpolation` extension is in a separate module to the log
statement.

Ignore this for now, but we may need to re-evaluate if this becomes a
more widespread problem.

Resolves rdar://79100763
2021-08-06 16:49:43 +10:00
Arnold Schwaighofer
b5a5d38756 Adjust to LLVM's llvm_execute_on_thread removal 2021-08-05 12:15:23 -07:00
Arnold Schwaighofer
5a83172a55 Merge remote-tracking branch 'upstream/main' into rebranch 2021-08-05 12:04:56 -07:00
Rintaro Ishizaki
6e69a44c3d [ASTPrinter] Intorduce 'IntroducerKeyword' name kind
For more fine grained annoations. For now, it's handled as the same as
'Keyword' name kind.

Fix an issue where 'extension' wasn't marked as "keyword".

Also, move 'static' priting out of 'SkipIntroducerKeywords' guard
because 'static' is not an declaration introducer.
2021-07-29 12:50:24 -07:00
swift-ci
fd87ebc401 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-23 07:13:34 -07:00
Robert Widmann
d86551de67 Lift Requirement and Parameter Accessors up to GenericSignature
Start treating the null {Can}GenericSignature as a regular signature
with no requirements and no parameters. This not only makes for a much
safer abstraction, but allows us to simplify a lot of the clients of
GenericSignature that would previously have to check for null before
using the abstraction.
2021-07-22 23:27:05 -07:00
swift-ci
94817d06b4 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-20 09:13:59 -07:00
Rintaro Ishizaki
5559d9406f [CodeCompletion] NFC: rename CallParameter* to CallArgument*
Since these chunks are for call sites, the correct term is "argument".
2021-07-19 16:30:12 -07:00
swift-ci
f9e8208cb3 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-16 16:14:43 -07:00
Ben Barham
f9b3e40595 [SourceKit/DocInfo] Add is_async for properties with async getters
Resolves rdar://80546521
2021-07-16 13:35:50 +10:00
swift-ci
a3ebc9a069 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-12 10:51:07 -07:00
Doug Gregor
06bbc70b3e Module printing and serialization support for @unchecked Sendable 2021-07-11 12:29:54 -07:00
Evan Wilde
2c04be2724 llvm::StringRef compare_lower -> compare_insensitive
The `compare_lower` API was replaced with `compare_insensitive` in llvm
commit 2e4a2b8430aca6f7aef8100a5ff81ca0328d03f9.

git clang-format ran.

(cherry picked from commit aca2de95ee)
2021-07-02 10:55:17 -07:00
Evan Wilde
42ff140171 llvm::StringRef equals_lower -> equals_insensitive
The `equals_lower` API was replaced with `equals_insensitive` in llvm
commit 2e4a2b8430aca6f7aef8100a5ff81ca0328d03f9 and
3eed57e7ef7da5eda765ccc19fd26fb8dfcd8d41.

Ran git clang-format.

(cherry picked from commit e21e70a6bf)
2021-07-02 10:55:17 -07:00