Commit Graph

3985 Commits

Author SHA1 Message Date
Rintaro Ishizaki
af5daed144 [CodeCompletion] Tweak fast completion dependency checking
- Detect same file with bufferID instead of the file name
- Compare virtual in-memory filesystem content with hash value
2020-05-04 16:35:41 -07:00
swift_jenkins
6253fd4753 Merge remote-tracking branch 'origin/master' into master-next 2020-05-04 14:57:15 -07:00
Nathan Hawes
0f132bf75c Merge pull request #31431 from nathawes/rename-with-backticks
[IDE][SourceKit] Support escaped identifiers for the syntactic rename and related idents requests.
2020-05-04 14:50:33 -07:00
Rintaro Ishizaki
05a87e86c4 [CodeCompletion] Give up fast-completion if dependent files are modified
Check if dependencies are modified since the last checking.
Dependencies:

 - Other source files in the current module
 - Dependent files collected by the dependency tracker

When:

 - If the last dependency check was over N (defaults to 5) seconds ago

Invalidate if:

 - The dependency file is missing
 - The modification time of the dependecy is greater than the last check
 - If the modification time is zero, compare the content using the file
   system from the previous completion and the current completion

rdar://problem/62336432
2020-05-04 13:02:09 -07:00
swift_jenkins
eff5d782a3 Merge remote-tracking branch 'origin/master' into master-next 2020-05-04 09:40:15 -07:00
Nathan Hawes
fe9fc260fa Merge pull request #31465 from nathawes/doc-info-availability-catalyst
[IDE] Loosen assertion check in IDE/SyntaxModelWalker
2020-05-04 09:30:23 -07:00
Nathan Hawes
deecb58fe6 [IDE] Loosen assertion check in IDE/SyntaxModelWalker
We were asserting that the attribute range recorded in the AST started at the
same location as the fist unconsumed SyntaxNode in the file. This should be
true in most cases, but isn't for mispelled attributes, corrected in the AST
but not recognised or present in the list of SyntaxNodes. E.g.
@availability(...) comes through as if @available(...) was specified, but
there's no SyntaxNode for it because we don't highlight invalid attributes
(to indicate they're invalid).

Resolves rdar://problem/62201594
Resolves https://bugs.swift.org/browse/SR-12500
2020-05-01 10:33:22 -07:00
swift_jenkins
9b6f01b6d9 Merge remote-tracking branch 'origin/master' into master-next 2020-04-30 20:37:34 -07:00
Daniel Sweeney
ea526c6383 Converting ModuleDecl::ImportedModule from std::pair to a dedicated struct. (#31360) 2020-04-30 20:26:03 -07:00
Nathan Hawes
0f8619b943 [IDE][SourceKit] Support escaped identifiers for the syntactic rename and related idents requests.
Resolves rdar://problem/46409010
Resolves rdar://problem/48256383
2020-04-30 13:08:23 -07:00
swift_jenkins
4dc2e3c785 Merge remote-tracking branch 'origin/master' into master-next 2020-04-29 17:59:15 -07:00
Robert Widmann
1319b53528 Hide the TypeExpr in ClosureExpr 2020-04-29 13:40:39 -07:00
Robert Widmann
19ab68db98 [NFC] Strip UnresolvedSpecializeExpr of its TypeLoc
No caller needed the type
2020-04-28 20:10:10 -07:00
Robert Widmann
5b3060318e [NFC] Strip ClosureExpr of its TypeLoc 2020-04-28 20:10:10 -07:00
swift_jenkins
91d132ebbc Merge remote-tracking branch 'origin/master' into master-next 2020-04-28 10:47:35 -07:00
Robert Widmann
a6fc9b3679 Merge pull request #31253 from CodaFi/casting-call
Strip TypeExpr of its TypeLoc
2020-04-28 09:45:53 -07:00
swift_jenkins
b516583ac4 Merge remote-tracking branch 'origin/master' into master-next 2020-04-28 09:19:47 -07:00
Rintaro Ishizaki
2b4cc8581e Merge pull request #31316 from rintaro/ide-completion-protocolext-rdar53591636
[CodeCompletion] Don't show protocol extension only members in override
2020-04-28 09:08:39 -07:00
swift_jenkins
eef4c01793 Merge remote-tracking branch 'origin/master' into master-next 2020-04-27 14:19:02 -07:00
swift-ci
041dfb9354 Merge pull request #29847 from tkachukandrew/add-equatable-conformance 2020-04-27 14:01:17 -07:00
swift_jenkins
11beecd7fe Merge remote-tracking branch 'origin/master' into master-next 2020-04-27 12:17:57 -07:00
Rintaro Ishizaki
b2a742cb17 Merge pull request #31307 from rintaro/ide-completion-rdar62121221
[CodeCompletion] Prioritize type matching overload for unresovled member
2020-04-27 12:10:19 -07:00
Rintaro Ishizaki
ab7ba4ce79 [CodeCompletion] Don't show protocol extension only members in override
Protocol extension only members are not customization point. Code
completion should not suggest them in override/conformance completion.

rdar://problem/53591636
2020-04-27 11:52:27 -07:00
swift_jenkins
71c6aaa126 Merge remote-tracking branch 'origin/master' into master-next 2020-04-27 09:58:21 -07:00
Varun Gandhi
65577940d0 [NFC] Get rid of -Wrange-loop-analysis warnings. (#31324) 2020-04-27 09:47:52 -07:00
Andrew Tkachuk
d0ac023dbc Apply requested changes 2020-04-25 21:13:14 +03:00
Rintaro Ishizaki
e947512875 [CodeCompletion] Prioritize type matching overload for unresovled member
For exmaple:

    func foo(_: Int, _: IntOption)
    func foo(_: Float, _: FloatOption)

    foo(intVal, .<HERE>)

Previously code completion suggests static member from 'IntOption' and
'FloatOption' without any prioritization. Prioritize members from
'IntOption' because the user probably wants to input them.

In such cases, 'CodeCompletionExpr' at the cursor position is
pre-typechecked to 'IntOption'. So mark results with matching type with
'ExprSpecific'.

rdar://problem/62121221
2020-04-24 18:01:59 -07:00
swift_jenkins
896fd4bcb8 Merge remote-tracking branch 'origin/master' into master-next 2020-04-24 13:38:01 -07:00
Nathan Hawes
b297ea6d9d Merge pull request #31184 from nathawes/defaulted-arg-list-implicitness
[Sema] Maintain the implicitness of call argument tuple/parens in coerceCallArguments
2020-04-24 13:25:46 -07:00
swift_jenkins
71686f9984 Merge remote-tracking branch 'origin/master' into master-next 2020-04-24 12:58:09 -07:00
Joe Groff
b4c7a7e85d Merge pull request #31224 from AnthonyLatsis/rename-getfullname-2
AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl
2020-04-24 12:51:28 -07:00
swift_jenkins
dae7b2425d Merge remote-tracking branch 'origin/master' into master-next 2020-04-23 19:39:25 -07:00
Nathan Hawes
7c0a17803d [Sema] Maintain the implicitness of call argument tuple/parens in coerceCallArguments
If any arguments were defaulted the tuple/paren was made implicit, even though
the original tuple/paren was present in the source.

This prevented some sourcekit ASTWalkers from considering them, making
refactorings, documentation info, jump-to-definition and other features
unavailable when queried via their argument labels.

Resolves rdar://problem/62118957
2020-04-23 18:54:46 -07:00
Robert Widmann
09db2902d2 Strip TypeExpr of its TypeLoc
Remove duplication in the modeling of TypeExpr. The type of a TypeExpr
node is always a metatype corresponding to the contextual
type of the type it's referencing. For some reason, the instance type
was also stored in this TypeLoc at random points in semantic analysis.

Under the assumption that this instance type is always going to be the
instance type of the contextual type of the expression, introduce
a number of simplifications:

1) Explicit TypeExpr nodes must be created with a TypeRepr node
2) Implicit TypeExpr nodes must be created with a contextual type
3) The typing rules for implicit TypeExpr simply opens this type
2020-04-23 17:04:38 -07:00
Nathan Hawes
b7ac8f87b1 [IDE][AST] Handle frameworks with traditional overlays where the underlying module declares cross imports in sourcekit.
We weren't handling this case, so their generated interfaces / doc info
wouldn't include symbols from the cross-import overlays, and we wouldn't
map the underscored cross-import overlay name back to the declaring
framework's name in cusor-info, completion results or when indexing.

Resolves rdar://problem/62138551
2020-04-23 13:03:59 -07:00
Anthony Latsis
74252028ca AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl 2020-04-23 05:16:55 +03:00
swift_jenkins
f5510bf1a4 Merge remote-tracking branch 'origin/master' into master-next 2020-04-20 16:57:12 -07:00
Nathan Hawes
c0b5cb9122 Merge pull request #31098 from nathawes/indentation-fixes
[SourceKit/CodeFormat] Indentation fixes for multi-line string, UnresolvedSpecializeExpr, and trailing target handling.
2020-04-20 16:51:48 -07:00
Hamish Knight
7f8a0e8a6c Requestify implicit imports
Add ModuleImplicitImportsRequest, which computes
the modules that should be implicitly imported by
each file of a given module. Use this request in
import resolution to add all the necessary
implicit imports.

The request computes the implicit imports by
consulting the ImplicitImportInfo, which ModuleDecl
can now be created with. This allows us to remove
uses of `SourceFile::addImports` in favor of
adding modules needed to be implicitly imported to
the ImplicitImportInfo.
2020-04-20 13:20:35 -07:00
swift_jenkins
e43ca6c24c Merge remote-tracking branch 'origin/master' into master-next 2020-04-19 20:17:20 -07:00
Nathan Hawes
e01c1a1579 [SourceKit/CodeFormat] Get 'trailing' indentation to work in more places and fix a bug where multi-line string indentation was modified.
E.g. if/guard condition patterns are column-aligned, but hitting enter after
the ',' below wasn't column-aligning the next empty line:

guard let x = Optional(42),
// No indentation added here after enter

Also the isTargetContext() check takes a start and end token location, but
wasn't accounting for the end location pointing a multiline string, so we
weren't walking into such nodes. This meant we didn't realise the target
location was within a multiline string in some cases, and we ended up
interfering with whitespace in its content.
2020-04-19 15:11:16 -07:00
Rintaro Ishizaki
5fb9d73421 Avoid unnecessary performTypeChecking() in REPL 2020-04-19 13:01:04 -07:00
Robert Widmann
5481631baf Merge remote-tracking branch 'upstream/master' into master-next 2020-04-17 20:27:23 -07:00
Rintaro Ishizaki
0f1cffd2d2 [CodeCompletion] Completion for control trasfer target
Completion after 'break' and 'continue'

rdar://problem/57016218
2020-04-17 14:18:33 -07:00
Andrew Tkachuk
fc382d2085 Merge branch 'master' into add-equatable-conformance 2020-04-17 19:14:20 +03:00
swift_jenkins
71d5ac021b Merge remote-tracking branch 'origin/master' into master-next 2020-04-16 11:37:51 -07:00
Rintaro Ishizaki
47e303a98d [CodeCompletion] Fix a crash in context type analysis for tuple expr
When completing inside tuple expressions, the context tuple type may
have fewer number of elements. In such cases, we cannot provide the
expected type.

rdar://problem/61668779
2020-04-16 09:24:00 -07:00
Nathan Hawes
9e0e611949 [SourceKit/CodeFormat] Update hasOutdent check to handle specialization ranges < >
They were missed before, so < > that should trigger outdenting weren't. E.g.
let x = foo<
  Int, String, Int
>()
    .count // Indented becase we didn't process the < > brackets previously.
2020-04-15 19:20:20 -07:00
swift_jenkins
688478c709 Merge remote-tracking branch 'origin/master' into master-next 2020-04-13 16:20:37 -07:00
Rintaro Ishizaki
5d6298ad05 Merge pull request #30996 from rintaro/ide-completion-performcachedoperaiton
[CodeCompletion][NFC] Fix typo
2020-04-13 16:20:09 -07:00