Commit Graph

2342 Commits

Author SHA1 Message Date
paulberry@google.com 30be07745a Handle context == null in the analysis.getHover request.
This could happen due to a race condition: the client might request
hover information for a file that the server has not established a
context for yet (e.g. during startup).

R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38207 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 19:56:28 +00:00
scheglov@google.com 1de8ecb571 Use HasToJson when set Reponse/Notification parameters.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38206 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 19:54:04 +00:00
scheglov@google.com acd4145f62 Initial implementation for 'search.findElementReferences'.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38201 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 17:45:28 +00:00
scheglov@google.com 0597e61ba3 Move index/search to services.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38045 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 22:24:59 +00:00
scheglov@google.com 9e33b85c31 Move file_system libraries into 'analyzer'.
I still end up including memory FS into 'analyzer' because tests for ResourceUriResolver use it.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38034 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 18:57:42 +00:00
scheglov@google.com 570d537b0f Update HoverInformation to include offset, length, kind.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37995 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-03 22:06:13 +00:00
scheglov@google.com 1f45100688 Move Index and IndexStore implementations into Engine.
Also move most of the related tests.

LocalIndex test is commented out, because relies on the infrastucture existing only in Server - virtual file system, mocks.
We need to move it into Engine or extract into a separate package.

This CL also removes Dart implementation of BTree.
We now use a different approach to implementing the index.

Bots are red after the previous CL, I hope that this one will fix at least some redness.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37993 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-03 21:30:25 +00:00
scheglov@google.com 82d67d0d87 Add highlight regions for comments.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37992 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-03 20:49:50 +00:00
scheglov@google.com 64f238ba34 Implemention of the 'analysis.overrides' notification.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37971 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-03 03:24:27 +00:00
scheglov@google.com 179c102d78 Implementation for 'analysis.occurrences' notification.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37954 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-02 18:38:01 +00:00
scheglov@google.com 7f70e3186f Implementation for 'analysis.getHover'.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37952 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-02 17:33:22 +00:00
paulberry@google.com 56965cd347 Fix operator== and hashCode for File and Folder objects.
This is necessary in order for File and Folder objects to be safely
stored in HashSets and HashMaps.

R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37926 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-02 00:46:15 +00:00
scheglov@google.com 9cb4f47557 Update Element/navigation/outline to use Location.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37903 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 20:25:04 +00:00
scheglov@google.com 8ed7aaef4e Remove server/generated folder.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37889 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 17:48:53 +00:00
scheglov@google.com 5eb236b9b3 Update analysis.errors notification to the newest spec.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37887 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 17:38:34 +00:00
jwren@google.com 5e873d646b Change HashMap declarations back to Map.
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37882 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 17:18:27 +00:00
paulberry@google.com 3f8968c08a Handle relative paths in the output of "pub list-package-dirs".
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37879 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 16:32:52 +00:00
paulberry@google.com e4c8c998ab Ignore bogus links, such as those created by emacs for files being edited.
R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37845 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 00:51:55 +00:00
jwren@google.com af71a4f377 Change Maps to HashMaps to save in performance, index and generated directories not touched
R=paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37840 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 22:40:08 +00:00
paulberry@google.com 590021403c Handle a failure in "pub list-package-dirs".
This can happen if the user tries to open a folder that contains no
pubspec.yaml file (and thus no pubspec.lock file).

When this happens, we artificially treat 'pubspec.lock' as a
dependency, so that if the user later creates a pubspec.yaml and runs
'pub get', we will automatically re-run "pub list-package-dirs".

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37831 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 19:34:59 +00:00
paulberry@google.com 66f969119d Rerun "pub list" when pubspec.lock changes.
(Note: we don't actually hardcode the dependency on pubspec.lock--we
use the "input_files" field of the output from "pub list" which tells
us the dependency).

This required some refactoring: ContextDirectory has been eliminated
and its responsibilities (creating the analysis context, UriResolvers,
and SourceFactory) have been shifted to ContextDirectoryManager and
AnalysisServerContextDirectoryManager.  Accordingly,
AnalysisServer.folderMap now maps directly from folder to
AnalysisContext.

Note: we don't yet properly handle the case where one of the
dependencies output by "pub list" is outside of the context folder.

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37826 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 17:44:37 +00:00
paulberry@google.com dc603c5455 Add a Resource.parent getter, which gets the parent directory.
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37746 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 15:03:24 +00:00
danrubel@google.com 64511683b8 send status notification when analysis starts and ends
BUG=
R=paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37734 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 11:53:39 +00:00
scheglov@google.com 01c2fbefb1 Index Dart/HTML units after analysis.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37707 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-25 21:14:30 +00:00
scheglov@google.com b2016358fb Update navigation computer to include Element instead of id.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37704 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-25 18:49:27 +00:00
scheglov@google.com 19b07ce26c Element.fromEngine() constructor.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37701 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-25 17:21:56 +00:00
scheglov@google.com 0aa39f1e10 A local file-based Index implementation.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37664 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-24 18:08:00 +00:00
paulberry@google.com 940f84df33 Remove dead code for tracking pubspec.yaml files.
Now that we are using "pub list-package-dirs" to find the packages
associated with a context, we no longer need to explicitly track the
presence or absence of a "pubspec.yaml" file within the context.

Note that we will have to watch the "pubspec.lock" file in order to
decide when to re-run "pub list-package-dirs", but we'll do this using
a different mechanism, since the decision of which file(s) to watch is
the responsibility of pub, and communicated to us through the JSON
output of "pub list-package-dirs".  This will be addressed in a future
CL.

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37620 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 21:33:18 +00:00
scheglov@google.com c6bba5ff20 A FileManager implementation to keep each index file in a separate file system file.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37615 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 20:00:38 +00:00
scheglov@google.com b5d098a4a2 Move split_store.dart to the store/ folder and extract collections/codecs.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37610 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 17:18:14 +00:00
paulberry@google.com 87ce2785b6 Allow "null" as a synonym for [] or {} in the analysis server API.
R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37608 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 16:51:59 +00:00
paulberry@google.com 4531158428 Allow multiple dirs per package in the data returned by "pub list".
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37565 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-20 20:12:42 +00:00
scheglov@google.com 5f8931c039 Use single quotes for index store.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37564 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-20 18:20:53 +00:00
scheglov@google.com 8b273420e3 Explicitly remove AnalysisContext from ContextCodec.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37563 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-20 18:18:12 +00:00
scheglov@google.com bd4cb891ef Port SplitIndexStore to Dart.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37556 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-20 16:18:19 +00:00
paulberry@google.com e9fa53425c Use "pub list-package-dirs" to resolve package URIs in analysis server.
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37552 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-20 14:42:01 +00:00
scheglov@google.com 6b6467a9ca New analyzer snapshot.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37516 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-19 20:58:28 +00:00
paulberry@google.com 1eacc4f343 Add support for adding/removing pubspec.yaml files.
Since this probably won't happen very often, we don't go to a great
deal of effort to handle it efficiently--we just destroy the old
context and create a new one.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37496 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-19 14:55:27 +00:00
brianwilkerson@google.com 3ada3b02d7 Implement analysis.updateOptions
R=paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37467 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-18 21:27:51 +00:00
scheglov@google.com 4b67b3a4c6 'Element' and 'Outline' implementations for the new server API.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37463 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-18 20:44:24 +00:00
scheglov@google.com e24abbc13f Fix for subscribing for notifications after analysis.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37455 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-18 17:38:34 +00:00
scheglov@google.com bf65a5694e Extract 'DartUnitHighlightsComputer' tests into a separate file.
Use constants.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37452 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-18 16:34:08 +00:00
scheglov@google.com 8df494e4b4 PackageMapUriResolver for Dart server.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37431 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 22:52:22 +00:00
paulberry@google.com 86d2b07b6b Change contract for ChangeSet to reflect AnalysisContext behavior.
The analysis server relies on changedSources having no effect on files
whose contents are already overridden, and we don't want to rely on
undefined behavior.

This shouldn't affect any clients; we are just specifying the behavior
that already existed.

Also, avoid unnecessarily invalidating analysis when changedSources
contains a source that is already overridden.

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37426 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 21:22:20 +00:00
brianwilkerson@google.com 4ad29a2671 Implemented analysis.setPrioritySource
R=paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37412 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 18:44:23 +00:00
paulberry@google.com 3ab000840c Trigger re-analysis when a file changes on disk.
R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37408 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 18:07:57 +00:00
brianwilkerson@google.com 58ee598e04 Adjust server for API changes
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37368 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-16 18:41:04 +00:00
paulberry@google.com b77f98fdbe Handle null content in ContentChange.
R=brianwilkerson@google.com, scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37328 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-13 20:23:23 +00:00
scheglov@google.com 96d0229ed7 Backport B+ tree implementation from Dart to Java.
Only in-memory implementation for in this CL.

Helper classes don't have separate tests yet.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37316 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-13 15:33:26 +00:00
scheglov@google.com e3df29d333 Fix caching paging during read.
Preliminary performance numbers: about 2000 ms to insert 1 million key/value pairs.
Page size is 8K, cache is 16 index nodes and 128 leaf nodes.
Key is Uint32List(7) = 28 bytes and value is Uint32.
I.e. it is basically ElementId to an artificial incremental id.

Keys are sequencial, with randomization every 100 keys - add a random number from the range [-5000, 5000).
I hope that it is a good simulation for our Element keys - they tend to group by libraries and parts.
So, our cache should be able to keep corresponding index/leaf nodes in memory.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37274 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-12 14:25:08 +00:00