Commit Graph

366 Commits

Author SHA1 Message Date
Konstantin Shcheglov 663b7f665e Analysis.getHover should return the field's documentation for field formal parameters.
Also return the parameter's element with completion suggestion.

R=brianwilkerson@google.com
BUG= https://github.com/flutter/flutter-intellij/issues/385

Review-Url: https://codereview.chromium.org/2681233005 .
2017-02-10 08:49:40 -08:00
Konstantin Shcheglov 0a09ff53c3 Include the field documentation for named field formal parameter completion suggestions.
R=brianwilkerson@google.com, devoncarew@google.com
BUG= https://github.com/flutter/flutter-intellij/issues/385

Review-Url: https://codereview.chromium.org/2683233002 .
2017-02-09 13:24:25 -08:00
danrubel 1680c434f2 suggest method references in named expressions
Fix https://github.com/dart-lang/sdk/issues/25386

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2679503002 .
2017-02-06 12:59:05 -05:00
danrubel 02adcc9614 suggest catch and finally keywords
After a try block that does not have a "catch" block,
suggest the "catch" keyword and nothing else.
After a "catch" block, suggest the "finally" keyword.

Fix https://github.com/dart-lang/sdk/issues/27560

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2662973007 .
2017-02-06 12:57:57 -05:00
Konstantin Shcheglov 7d2447d795 Replace computeNode() with AstProvider in search.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2672973002 .
2017-02-03 10:40:44 -08:00
Dan Rubel f33c3c1676 complete named params in constructors
This add completion suggestions for named parameters
in constructors and factories, and prevents other suggestions
such as type names, identifiers, etc when they are not appropriate.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2671533002 .
2017-02-01 14:36:41 -05:00
Konstantin Shcheglov 75fff1fdb6 Implement completion in WithDirective.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2665053004 .
2017-01-31 15:06:54 -08:00
Konstantin Shcheglov fcd5f16d10 Stop using SDK summary bundle. Analyze dart:xxx as any other libraries.
Unfortunately this makes runnings tests about 30% slower :-(

I suspect that's because we have to build unlinked and linked summaries
for SDK libraries again and again for every tiny test.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2653683004 .
2017-01-24 18:32:26 -08:00
Konstantin Shcheglov 5f6ea67c1e Make Analysis Server tests use MockSdk again.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2650803005 .
2017-01-24 13:49:48 -08:00
Brian Wilkerson 22f561e914 Reapply "Add support for generic function type syntax, part 1"
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2622303006 .
2017-01-11 14:10:05 -08:00
Brian Wilkerson 85b1e7abbe Revert "Add support for generic function type syntax, part 1"
Review-Url: https://codereview.chromium.org/2624283003 .
2017-01-11 13:30:52 -08:00
Brian Wilkerson 1cd918533d Add support for generic function type syntax, part 1
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2613383003 .
2017-01-11 13:12:10 -08:00
Konstantin Shcheglov e80a54e432 Fix the rest of the completion tests with the new analysis driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2618243002 .
2017-01-08 15:16:33 -08:00
Konstantin Shcheglov e870bc9872 Fix for summarizing triple slash documentation comments.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2615013003 .
2017-01-05 12:30:44 -08:00
Konstantin Shcheglov d8c426bb85 Fix for resynthesizing libraries with invalid part URIs.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2615903003 .
2017-01-05 12:26:47 -08:00
Konstantin Shcheglov 4f03cccf06 Fix part related completion tests with the new analysis driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2616493004 .
2017-01-04 15:06:10 -08:00
Konstantin Shcheglov 1e43b4f270 Replace using MockSdk with FolderBasedDartSdk + summaries in AbstractContextTest(s).
It has some performance penalty (about 2-3 seconds in 35 seconds total).

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2610823004 .
2017-01-04 14:39:24 -08:00
Konstantin Shcheglov 20ca3e9b7e Enable several completion tests with the new analysis driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2612103002 .
2017-01-04 14:23:18 -08:00
Konstantin Shcheglov f0a0b1fc79 Fix some completion tests with parts.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2573233002 .
2016-12-14 16:28:02 -08:00
Konstantin Shcheglov 8dbfef1cf1 Fix completion tests that attempted to resolve a library.
We don't need this with the new analysis driver.
The library element will be resynthesized on demand.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2571333002 .
2016-12-14 12:33:06 -08:00
Konstantin Shcheglov 63d1c18f41 Add completion tests for the new analysis driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2572203002 .
2016-12-14 12:05:20 -08:00
Paul Berry ae6fd961a1 Prepare for decoupling analyzer ASTs from element model.
This CL creates top level accessor functions which may be used to map from AST data structures to their corresponding elements and types, and begins using those accessor functions throughout the SDK.  It also adds empty interfaces ResolutionTarget and ResolutionType, which are implemented by Element and DartType respectively.

In a future CL, I will change the types stored in the AST to ResolutionTarget and ResolutionType, rather than specific element types; this will decouple the ASTs from the element model.  The presence of the accessor functions will allow clients to continue accessing elements and types in a type-safe way.

R=asgerf@google.com, brianwilkerson@google.com, scheglov@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/2551023005 .
2016-12-07 11:08:14 -08:00
Konstantin Shcheglov fc30904a39 Completion with the new analysis driver.
It works for top-levels, fields, locals, prefixed expressions.

Integration is not the most efficient - we resolve the full unit.
It works fine for files with about 1000 lines, about 50-70 ms.

We could slightly improve timing if we prioritize completion over
navigation and highlight notifications, which are currently prepared
and sent before completion.

In giant files like src/dart/element/element.dart, about 8500 lines,
it takes about 400 ms from typing to receiving completion. The theoretical
bottom bound for such files is about 70 ms - time that it required to
parse, create unlinked bundle, ensure that the API signature is the
same, load linked bundles and prepare to resynthesize. On top of this
goes any time required to resolve a single method and completion itself.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2478963002 .
2016-11-06 10:45:46 -08:00
Konstantin Shcheglov 05a86a7495 Remove 'initializeTestEnvironment' from 'analysis_server'.
Also fixes the server_options_test.dart:22 test broken in https://codereview.chromium.org/2394683006/

R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2402483002 .
2016-10-06 10:26:17 -07:00
Konstantin Shcheglov de4d8b3a78 Switch analysis_server to use 'package:test'.
I'm changing DEPS in the corresponding analyzer CL.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2394683006 .
2016-10-06 08:47:15 -07:00
Brian Wilkerson ecc84b26a4 Break up another large file
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2342733002 .
2016-09-15 07:49:27 -07:00
Dan Rubel 023295912a improve import URI completions at EOF
fixes https://github.com/dart-lang/sdk/issues/27020

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2342473002 .
2016-09-14 11:22:25 -04:00
Dan Rubel 4fce5e9022 reduce the relevance of completions starting with "$"
fixes https://github.com/dart-lang/sdk/issues/27303

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2330413004 .
2016-09-13 14:21:31 -04:00
Konstantin Shcheglov 9aa060e67f Issue 27143. Fill documentation for local, AST based completion.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/27143

Review URL: https://codereview.chromium.org/2313003002 .
2016-09-06 12:05:20 -07:00
danrubel d92849a8af fix completion in switch case
Fixes https://github.com/dart-lang/sdk/issues/26856

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2250873002 .
2016-08-16 18:07:52 -07:00
pq 722d4a13b0 Default trailing comma support to true (#26647).
BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2185873002 .

See: https://github.com/dart-lang/sdk/issues/26647.
2016-07-27 09:42:12 -07:00
Konstantin Shcheglov 7d9d451730 Don't insert additional ':' when changing a named argument name.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2136223004 .
2016-07-12 17:25:55 -07:00
danrubel 37a6f62566 fix code completion when enableTrailingCommas is true
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2128693002 .
2016-07-07 12:42:30 -04:00
Konstantin Shcheglov 2cdaa62c98 Make LIBRARY_CYCLE, LIBRARY_CYCLE_UNITS and LIBRARY_CYCLE_DEPENDENCIES for library source.
It seems to me that it uses only LibrarySpecificUnit.library anyway.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2094133002 .
2016-06-27 08:43:59 -07:00
Brian Wilkerson f183ec3a45 Fix equality between subclasses of Source
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2050083002 .
2016-06-09 07:42:32 -07:00
danrubel 2d310f1e67 improve completions in closures and switch statements
This addresses several situations where the parser interprets "as" as
part of an "as" expression, but the user is trying to enter the "async"
keyword or an identifier starting with "as".

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2034713004 .
2016-06-06 08:09:44 -04:00
Jaime Wren e3af3c8d76 Code completion improvement. Recommend all 'E.x' where E is an enum, also, filter out only the correct enum types in named arguments.
BUG=https://github.com/dart-lang/sdk/issues/24759

Review URL: https://codereview.chromium.org/1989393002 .
2016-05-18 12:08:17 -07:00
Konstantin Shcheglov 27650456d1 Improve completion after IfStatement.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1968883002 .
2016-05-11 08:36:27 -07:00
Konstantin Shcheglov cd7b7fc018 More tweaks for 'for' completion.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1963323003 .
2016-05-10 20:22:12 -07:00
Konstantin Shcheglov 522eaa9a80 Don't suggest types, getters, etc in 'for (Type ^)'.
Variable names should be suggested there.

It does not work for the moment, I'll need to make changes into
VariableNameContributor. But NOT suggesting all the garbage - for me
thi is 90% of the full solution ;-)

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1960783002 .
2016-05-09 12:30:15 -07:00
Konstantin Shcheglov cf71ab114b Suggest 'is' in 'if (x is^)'.
So, we don't treat is as an expression start, and don't suggest
inappropriate 'while', 'await', etc or identifiers.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1958733002 .
2016-05-06 14:36:43 -07:00
Konstantin Shcheglov 3775d92000 Suggest 'var' and 'final' in intializer of 'for'.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1953893004 .
2016-05-06 13:49:48 -07:00
Konstantin Shcheglov b73b82221e Fixes for completing 'for (var v in^)' and 'if (v is^)'.
The 'if (v is)' will require more work - we somehow manage to suggest
'if', 'final', 'switch', 'while', but NOT 'is'. But at least identifiers
are now out.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1956813004 .
2016-05-06 13:17:15 -07:00
Konstantin Shcheglov 0f0b38dab3 Implement stable resolution of generic types without type arguments to their bounds.
R=brianwilkerson@google.com, leafp@google.com
BUG= https://github.com/dart-lang/sdk/issues/26265

Review URL: https://codereview.chromium.org/1927323002 .
2016-04-29 08:25:55 -07:00
Konstantin Shcheglov 470c5de12e If the expected 'returnType' is 'null', just do not check it.
The completion tests are fragile and too sensitive to task model
changes. I have a change that inserts a new analysis result between
RESOLVED_UNIT3 and RESOLVED_UNIT4, and by doing this the next task to
perform resolves types in imported libraries. But in CC test we
continue performing analysis tasks and incidentally resolve something
what the 'null' checks don't expect.

So, I think we need to stop doing these checks.
If needed, we can check something directly by asking the state of some
analysis results from AnalysisContext.

R=jwren@google.com, danrubel@google.com
BUG=

Review URL: https://codereview.chromium.org/1932003002 .
2016-04-28 13:15:33 -07:00
Jaime Wren 1aee4602bc Code completion bug fix, https://github.com/dart-lang/sdk/issues/26342, and test cleanup in variable_name_contributor_test.dart
BUG=https://github.com/dart-lang/sdk/issues/26342
R=danrubel@google.com

Review URL: https://codereview.chromium.org/1924683002 .
2016-04-27 09:26:49 -07:00
Jaime Wren e01634bd79 Code completion progress part two of fix to https://github.com/dart-lang/sdk/issues/24254, addition of new contributor, variable_name_contributor.dart.
The completions are not yet showing up in either IDE, IntelliJ or Atom.

BUG=https://github.com/dart-lang/sdk/issues/24254
R=danrubel@google.com

Review URL: https://codereview.chromium.org/1916893002 .
2016-04-25 12:51:14 -07:00
Jaime Wren 58bf3075a8 Code completion progress part one of fix to https://github.com/dart-lang/sdk/issues/24254, addition of optype.includeVarNameSuggestions
BUG=https://github.com/dart-lang/sdk/issues/24254
R=danrubel@google.com

Review URL: https://codereview.chromium.org/1910263004 .
2016-04-22 11:00:21 -07:00
Jaime Wren bfb5849f44 Code completion bug fix, don't suggest optional field formal parameters that are already in the constructor
BUG=https://github.com/dart-lang/sdk/issues/26255
R=danrubel@google.com

Review URL: https://codereview.chromium.org/1907723002 .
2016-04-21 10:46:35 -07:00
Jaime Wren cc065a3ad0 Code completion improvement, use type information when suggesting constructors, part 2.
This finishes the work started with https://codereview.chromium.org/1892823003/, by also adding the filter into the local_library_contributor.dart.

BUG=https://github.com/dart-lang/sdk/issues/26254
R=danrubel@google.com

Review URL: https://codereview.chromium.org/1908703002 .
2016-04-21 10:16:06 -07:00