Commit Graph

28 Commits

Author SHA1 Message Date
Alex Hoppen
c8424c1b7a [CodeComplete] Remove code for call pattern heuristics
These options weren’t used anymore, so we can remove them.
2024-01-22 19:57:12 -08:00
Alex Hoppen
190ee6ecc7 [CodeCompletion] Replace includes of CodeCompletion.h by more specific ones 2022-02-23 17:08:26 +01:00
Ben Barham
65ef8020de [CodeComplete] Add option to add calls with no defaults (or not)
Now that arguments are marked up with whether they have a default or
not, clients may not need the extra call (that has no default
arguments). Add an option to allow not adding this item.

Resolves rdar://85526214.
2021-12-15 13:30:57 +10:00
Alex Hoppen
163ccf9184 [SourceKit] Move invocation of code completion second pass for code completion from SoruceKit to CompletionInstance 2021-10-28 11:10:30 +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
Rintaro Ishizaki
6dd5d9482f [CodeCompletion] Introduce "Flair" in code completion
To describe fine grained priorities.

Introduce 'CodeCompletionFlair' that is a set of more descriptive flags for
prioritizing completion items. This aims to replace '
SemanticContextKind::ExpressionSpecific' which was a "catch all"
prioritization flag.
2021-06-07 17:25:01 -07:00
Rintaro Ishizaki
da96ef1f51 [CodeCompletion] Make object literals optional
For example, non-Darwin platforms probably don't want
`#colorLiteral(red:green:blue":alpha:)` and `#imageLiteral(named:)`.
Add an completion option to include them, which is "on" by default.

rdar://75620636
2021-05-07 16:27:13 -07:00
Rintaro Ishizaki
75ff9480c2 [CodeCompletion] Boost exact case-sensitive prefix match
When there are symbols 'Label' and 'label', if a user type 'Lab',
'Label' should be prioritized.

rdar://77164709
2021-04-27 22:32:37 -07:00
Rintaro Ishizaki
77b4f75608 [SourceKit] Reorgantize code completion options
* Abolish 'reuseastcontext' per-request option
* Add 'MaxASTContextReuseCount' global configuration
2020-09-03 19:30:05 -07:00
Rintaro Ishizaki
773a464e83 [CodeCompletion] Add an option to emit annotated description 2020-04-07 00:46:14 -07:00
Argyrios Kyrtzidis
4d337f2db2 [SourceKit] Turn-on by default the fast completion mode
rdar://59830963
2020-02-26 18:16:07 -08:00
Rintaro Ishizaki
c1530eedca [SourceKit] Add option to enable ASTContext reusing for code completion 2019-12-18 21:52:20 -08:00
Rintaro Ishizaki
62c44126b6 [SourceKit] Reuse compiler instance between multiple completion
- Introduce ide::CompletionInstance to manage CompilerInstance
- `CompletionInstance` vends the cached CompilerInstance when:
-- The compiler arguments (i.e. CompilerInvocation) has has not changed
-- The primary file is the same
-- The completion happens inside function bodies in both previous and
   current completion
-- The interface hash of the primary file has not changed
- Otherwise, it vends a fresh CompilerInstance and cache it for the next
  completion

rdar://problem/20787086
2019-12-18 21:52:20 -08:00
Ben Langmuir
b14cd916a3 [code-completion] Add type context for single-expression functions
Extend the support for single-expression closures to handle
single-expression functions of all kinds. This allows, e.g.

    func foo() -> MyEnum { .<here> }

to complete members of `MyEnum`.
2019-03-26 16:45:27 -07:00
Ben Langmuir
36d7acd1fa [code-complete] Set call-arg-heuristics flag in SourceKit
In the new code-completion path, expose an option to control this
behaviour; in the old path turn it off.

rdar://31113161
2017-12-18 13:20:24 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Ben Langmuir
f962e74017 [CodeCompletion] Rebalance match score and semantic context
The high weight on semantic context turns out to give a lot of
unreasonable completions on common types. For example
  [0].ma<here>
was suggesting withUnsafeMutable... over map.

rdar://problem/27393776
2016-07-20 16:37:58 -07:00
Ben Langmuir
94c23c3e1f [CodeCompletion] Include exact matches even when adding inner results
... in the experimental code-completion path. They seem to be generally
useful as a baseline result still as long as they are guaranteed to be
the first result.

rdar://problem/25177968
2016-03-16 14:21:53 -07:00
Ben Langmuir
6581eba8e6 [CodeCompletion] Improve ordering of prefix matches vs popular names
In the experimental code-completion path.

rdar://problem/24843463
2016-03-09 11:23:06 -08:00
Ben Langmuir
5da0906089 [CodeCompletion] Add optional top-N results that precede literals
Experiment with having some locals or nominal members come first, but
only a few so that the literals are still predictably near the top.

Part of rdar://problem/23865118
2016-02-03 16:31:26 -08:00
Ben Langmuir
a927dc8a5a [CodeCompletion] Hide literals that don't match the type context in SourceKit
If there is a type context, hide literal suggesetions that don't match
it, unless they are keywords and we have filtered to their names.

Incidentally fix an output buffering issue when combining filtering with
the -raw flag in complete-test.

Part of rdar://problem/23865118
2016-02-03 10:51:07 -08:00
Ben Langmuir
d16e4b0467 [CodeCompletion] Add rudimentary support for configuring allowable completions
On a per-request basis. Allows hiding/showing at multiple granularities
* everything
* module
* API by name
* keywords (by uid or all of them)
* literals (by uid or all of them)

With more specific rules overriding less specific ones (so you can hide
everything and then selectively show certain API for example).

rdar://24170060
2016-01-25 08:45:48 -08:00
practicalswift
50baf2e53b Use consistent formatting in top of file headers. 2016-01-04 02:17:48 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Ben Langmuir
11444373a5 [CodeCompletion] Don't fuzzy-match on single characters
Use prefix matching on the first character, switch to fuzzy after 2 or
more. With only a single character, we often get silly fuzzy results.
2015-11-06 19:26:48 -08:00
Argyrios Kyrtzidis
d19e4ae026 [SourceKit] Add license notices to all the source files. 2015-11-05 12:01:14 -08:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00