Commit Graph

82 Commits

Author SHA1 Message Date
Konstantin Shcheglov 6449e67c5d In getElementAtOffset() try first to find the element as if it is the nameOffset.
IntelliJ sends us the file and offset of the declaration of the element,
not the file and offset where the element is referenced (and where the
user actually requested search). It uses navigation information to do
this. Unfortunately this means that in the most case the unit that
defines the element is not a priority one, so we have to resolse it
from scratch. But we know that we are always given the name offset,
so we can look first into the element model and avoid performing
expensive unit resolution.

If the search is not successful, or the file is a priority one,
we use resolved unit anyway.

R=brianwilkerson@google.com

Change-Id: Ic6a32d3d8f9e61b245b1dd9f7fdf626c809f5fd5
Reviewed-on: https://dart-review.googlesource.com/58322
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-06-04 21:14:49 +00:00
Konstantin Shcheglov 85b4a799eb Search references to elements and subtypes in all known (and discovered) files.
We discover classes in packages, so it should improve situation for Flutter.

We don't yet discover files in SDK per se (although I already see a lot
of subclasses), so might still miss some files, but all search bits are
in place, we just need to do discovery in SDK. Should be easy to do
in a day or two.

Also search for private and local elements probably still work only
for added files, again will get to it in a following CL.

https://github.com/flutter/flutter-intellij/issues/2296
https://github.com/flutter/flutter-intellij/issues/2258
https://github.com/dart-lang/sdk/issues/26762
https://github.com/dart-lang/sdk/issues/29112

R=brianwilkerson@google.com

Change-Id: Ib2b73b4cb31fd14b2514e70fbfe58735418e74d5
Reviewed-on: https://dart-review.googlesource.com/57760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-06-01 14:47:43 +00:00
Konstantin Shcheglov d49af06ce0 Fix for searching references to named parameters in hierarchy.
R=brianwilkerson@google.com

Change-Id: I932eae1a1c6e440fab2034bffc7ec850f1216b9c
Reviewed-on: https://dart-review.googlesource.com/55841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-18 00:08:38 +00:00
Brian Wilkerson 7054d92a02 Remove some classes from the analyzer public API
Change-Id: Ic53a8426818b06f44c2876abd16c789589bf78b5
Reviewed-on: https://dart-review.googlesource.com/52421
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-24 15:28:15 +00:00
Brian Wilkerson 98e0c26a89 Convert several test classes to use ResourceProviderMixin
Change-Id: I1c85c6f29ae74cca0b594fc1f9ddae098b815e72
Reviewed-on: https://dart-review.googlesource.com/31860
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-01 16:21:02 +00:00
Konstantin Shcheglov 0fb3ff477f Issue 31589. Return only unique top-level declarations.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/31589
Change-Id: Ife9c607071bba90afb04ceb828203664fab49861
Reviewed-on: https://dart-review.googlesource.com/28122
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-12-11 16:54:33 +00:00
Jens Johansen 22d0696d91 [CFE] Move front-end API under src/
This CL deprecates the front-end API and moves it into src/api_prototype.

For now all usages have been updated to point to the new location,
but they should be updated to use custom-client invocations instead (e.g.
one specific way for DDC, another for dart2js etc.)

Bug:
Change-Id: I9b4f41f6ebf55d42510fd35240d942d1dc7292d6
Reviewed-on: https://dart-review.googlesource.com/24822
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-12-01 08:42:16 +00:00
Konstantin Shcheglov 5ea30b4e3d Rename performace_logger.dart to performance_logger.dart
R=paulberry@google.com, sigmund@google.com

Bug:
Change-Id: Ib7b6d122dff3ddabde3db2270daa777a269e04ed
Reviewed-on: https://dart-review.googlesource.com/18512
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-11-03 20:24:00 +00:00
Konstantin Shcheglov 1b4239d2e4 Export ByteStore and its implementations from front_end.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug:
Change-Id: Ie2e3413a7f143e270cec2bd3ae4564ad7cc315b1
Reviewed-on: https://dart-review.googlesource.com/3840
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2017-09-07 19:23:21 +00:00
Paul Berry 89c910b9c1 Move byte_store.dart and file_byte_store.dart to their own subdirectory.
This allows us to use the subpackage relationships test to verify that
they don't import any other parts of front_end, which paves the way
for the possibility of moving them to their own package in the future.

R=scheglov@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2990323002 .
2017-08-07 11:04:48 -07:00
Konstantin Shcheglov 00d5012906 Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt.
...instead of mixing formatting with actual changes in many CLs.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2975253002 .
2017-07-13 16:28:18 -07:00
Konstantin Shcheglov e0f4c7b467 Report only private members in the same library as overrides.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2959273002 .
2017-06-28 13:47:33 -07:00
Konstantin Shcheglov 2b64bbed6a Add SearchEngine.membersOfSubtypes().
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2962023002 .
2017-06-28 11:44:48 -07:00
Brian Wilkerson 53e01faa43 Remove unused implementation of SearchEngine and rename the driver-based implementation
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2949823002 .
2017-06-21 09:33:51 -07:00
Brian Wilkerson 4da8380881 Convert more tests to use the new driver
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2939803002 .
2017-06-13 12:04:25 -07:00
Brian Wilkerson 7d26ff6d4f Remove some more library directives
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2884233004 .
2017-05-17 08:02:08 -07:00
Konstantin Shcheglov a4fd5d814f Extract PerformanceLogger from AnalysisDriver.
I also added the runAsync().

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

Review-Url: https://codereview.chromium.org/2883633002 .
2017-05-12 14:27:50 -07:00
Konstantin Shcheglov bd1ee32543 Move [file_]byte_store.dart into pkg/front_end/test/src/incremental/.
We are going to reuse ByteStore in front_end, also for incremental
compilation.

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

Review-Url: https://codereview.chromium.org/2869803004 .
2017-05-09 09:12:15 -07:00
Brian Wilkerson 6b8a56cd7f Switch the default from non-driver to driver in several tests
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2864813002 .
2017-05-07 08:34:16 -07:00
Brian Wilkerson 863bd921e1 Remove the non-driver versions of several tests
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2863593004 .
2017-05-05 13:46:03 -07:00
Brian Wilkerson dd49e79f74 Add context information to driver and add hooks for plugin management
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2795743002 .
2017-04-03 10:13:45 -07: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
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 a483610a96 Issue 28386. Implement search for potential usages with the new analysis driver.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/28386

Review-Url: https://codereview.chromium.org/2653493006 .
2017-01-23 14:07:01 -08:00
Konstantin Shcheglov 8d326e9a14 Report StateError if the DartSDK for an AnalysisDriver does not have summary.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2639743002 .
2017-01-17 20:46:00 -08:00
Konstantin Shcheglov 31c7cce275 Run refactoring tests with the new analysis driver.
There are some failures because of missing potential search results.

These tests are not updated yet because they have too many problems now.

inline_method_test.dart
move_file_test.dart
rename_import_test.dart
rename_library_test.dart

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2618993003 .
2017-01-06 10:49:34 -08:00
Konstantin Shcheglov 71fc176b9b Run class/member hierarchy tests with the new analysis driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2618033002 .
2017-01-06 09:24:31 -08:00
Konstantin Shcheglov d2f48ccf58 Make subclasses of AbstractContextTest asynchronous.
As a preliminary step before duplicating them for the new analysis driver.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2614033003 .
2017-01-05 14:21:29 -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 3a422bceb7 Implement SearchEngine.searchMemberDeclarations() for the new driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2566393003 .
2016-12-13 14:06:15 -08:00
Konstantin Shcheglov 142473b8cb Implement SearchEngine.searchTopLevelDeclarations() for the new driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2572603003 .
2016-12-13 12:11:22 -08:00
Konstantin Shcheglov 9ab69ab984 Implement SearchEngine.searchAllSubtypes() with the analysis driver.
Inline getSubClasses().

Add a couple of tests for SearchEngineImpl2 itself.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2564913002 .
2016-12-09 09:32:49 -08:00
Konstantin Shcheglov 56bde6da28 Issue 27542. Guard against CompilationUnitElement is null in SearchMatch.element getter.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/27542

Review URL: https://codereview.chromium.org/2409403002 .
2016-10-11 14:09:09 -07: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
Konstantin Shcheglov 0d84e5e586 New test for multiple imports with the same prefix name.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2200473002 .
2016-07-29 16:04:38 -07:00
Konstantin Shcheglov a3b1936567 Fix for SearchEngine.searchMemberDeclarations() - search exact names.
R=pquitslund@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2183263002 .
2016-07-26 14:47:32 -07:00
Konstantin Shcheglov dd18f93154 Issue 26926. Don't search hierarchy for static class members.
R=pquitslund@google.com
BUG= https://github.com/dart-lang/sdk/issues/26926

Review URL: https://codereview.chromium.org/2176173004 .
2016-07-25 11:36:52 -07:00
Konstantin Shcheglov a6b93661fd Fix two build failures - for typeProvider and findElement.
TBR

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

Review URL: https://codereview.chromium.org/2032893002 .
2016-06-01 18:54:10 -07:00
Brian Wilkerson 08241e9072 More strong mode clean-up
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1947813002 .
2016-05-04 07:42:46 -07:00
Konstantin Shcheglov df5ca73f45 Fix for searching LocalVariableElement of DeclaredIdentifier.
This fixes rename refactoring of such local variables.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1828793002 .
2016-03-23 12:14:31 -07:00
Konstantin Shcheglov 5051380a09 Fix for searching parameters of constructors.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1802023002 .
2016-03-14 14:39:54 -07:00
Konstantin Shcheglov bd76934452 Remove old index and search implementations.
Also rename the new implementation files and classes to remove the
'2' suffix.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1801883002 .
2016-03-14 12:19:40 -07:00
Konstantin Shcheglov 936722402d Fix for indexing synthetic enum fields.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1791493003 .
2016-03-12 08:54:22 -08:00
Konstantin Shcheglov 222a11c290 Index unqualified unresolved used names.
This fixes one of the previously disabled tests.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1788673004 .
2016-03-11 15:10:43 -08:00
Konstantin Shcheglov 76f4578af8 Start using the new index in Analysis Server.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1786013004 .
2016-03-11 14:02:37 -08:00
Konstantin Shcheglov 30c49a0eab Improve used name relations and fields indexing.
I'm in the process of switching Analysis Server to the new index and
found that we need these changes to make search tests pass.
Refactorings don't need to know whether names are read or written,
but users might (or might not) want to know this.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1787803003 .
2016-03-11 10:42:01 -08:00
Konstantin Shcheglov 4e8e1e2e04 Improve search for constructors and import elements.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1778363003 .
2016-03-10 14:57:42 -08:00
Konstantin Shcheglov 5271cd3259 Fix for indexing synthetic elements.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1779233002 .
2016-03-10 10:57:08 -08:00
Konstantin Shcheglov 4d48fa56d0 Listen for context add/remove and unit invalidation to update the index.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1783503004 .
2016-03-09 14:52:19 -08:00