Commit Graph

60 Commits

Author SHA1 Message Date
Konstantin Shcheglov c2d660d161 Migrate analysis_server and analysis_server_client protocol.
Change-Id: Ie0912627733f0481de0d3239647a4978e5327f12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193641
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-04-02 06:46:41 +00:00
Konstantin Shcheglov e97f1bdbf0 Switch analysis_server to language 2.12, so null safety, but opt-out files.
This should allow doing partial migration, specifically protocol files,
which are imported by other libraries, but are a small library cycle
that does not import much outside of it.

Change-Id: I904c05d6d5b444ee9a9dbd1f7ada12aabdcc5165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-30 23:39:37 +00:00
Brian Wilkerson 8969b1839c Enable omit_local_variable_types in analysis_server
Change-Id: I7e5c13d40fd276854601681fc84be321e6031b10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141583
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-30 03:58:44 +00:00
Brian Wilkerson 8efdee06d6 Begin adding return types in analysis_server
Change-Id: Id0daa52236bdc90cba6bfd7cf81d1b4cf47603c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133544
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-28 21:18:30 +00:00
Brian Wilkerson 5584c96fde Enable prefer_single_quotes in analysis_server
All of the changes except in the analysis options file are from dartfix.

Change-Id: Icd9bf02ad07f71d1fc365979c7dfe18a792dc595
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132624
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-21 17:52:52 +00:00
Brian Wilkerson 4043a6fce3 Remove unnecessary uses of new in analysis_server
Other than analysis_options.yaml, all of the changes were from running
dartfix.

Change-Id: I92411642f12a00fc6bd0bfd24dd60fe67f0fed16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128845
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-12-18 19:01:51 +00:00
Brian Wilkerson 73ea4b1a82 Remove dead code from the analysis_server tests
Change-Id: I91f943baa191e27b7e647d78e5424fcb3a5cc990
Reviewed-on: https://dart-review.googlesource.com/c/88165
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-02 14:23:09 +00:00
Brian Wilkerson e90f1f21b8 Remove unused response codes and deprecate an unimplemented request
Change-Id: I7a07182ce8b7e7636f20bd4c661e94dd3dff985c
Reviewed-on: https://dart-review.googlesource.com/77480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-01 20:19:59 +00:00
Brian Wilkerson a456753267 Move a library only used by tests into the test directory
Change-Id: Ie8dcadc6313b3745ef874954da968839eb460c71
Reviewed-on: https://dart-review.googlesource.com/52020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-20 15:56:00 +00:00
Brian Wilkerson 602a8c2a7b Clean up usage of deprecated constants
Change-Id: I9005ba6e94529e15d8f7b21322591f4a9dabec47
Reviewed-on: https://dart-review.googlesource.com/45763
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 01:02:49 +00:00
Konstantin Shcheglov 462542b734 Report UNUSED_ELEMENT for top-level variables.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/25323
Change-Id: I751ee82742ff622a9b28b3cb05886b5ee775f9ed
Reviewed-on: https://dart-review.googlesource.com/13929
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-16 17:44:06 +00:00
Brian Wilkerson e55812a3f2 Unify the server and plugin versions of the generators
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2844273003 .
2017-04-28 07:46:29 -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
Brian Wilkerson 97c613aad4 More strong mode changes in analysis_server
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1852113002 .
2016-04-03 17:56:30 -07:00
Brian Wilkerson 9ad256cf18 Move the wire protocol support into the public API
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1398293002 .
2015-10-11 07:34:28 -07:00
Brian Wilkerson 908708d655 More fixes for failures on the Windows bot
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1266923004 .
2015-08-05 08:13:28 -07:00
scheglov@google.com 9efb25fa50 Use package:test_reflective_loader instead of reflective_tests.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45365 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 20:54:29 +00:00
brianwilkerson@google.com cd58e290c4 Reformat
R=paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44151 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 22:43:12 +00:00
danrubel@google.com f94326c241 add optional request field to record time at which client made request
BUG=
R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43113 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 17:41:29 +00:00
scheglov@google.com a38a503d86 Replace @ReflectiveTestCase() with @reflectiveTest.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42821 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-13 17:11:24 +00:00
danrubel@google.com 8745f2073a new onPriorityChanged event stream
BUG=
R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41935 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-24 17:56:17 +00:00
scheglov@google.com b8da9bc651 Format and sort analyzer and analysis_server packages.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41792 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-17 22:23:53 +00:00
paulberry@google.com 1363c77a02 Change integration test send...() methods to return structured objects.
This allows us to use completions when analyzing responses from the
server in integration tests.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40909 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-04 17:37:47 +00:00
danrubel@google.com e7bdefffba update error handling to send response with stack trace
BUG=dartbug.com/20893
R=brianwilkerson@google.com, paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40237 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-15 12:30:07 +00:00
scheglov@google.com 67cd1ab0e2 Decode RefactoringFeedback automatically.
The implementation is pretty ugly though.

1. I have to add Response into ResponseDecoder.
2. I have to hack EditGetRefactoringParams.fromRequest generation to feel the "id to kind" map.

  It would be easier if we decided to return 'kind' in responses.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39887 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-04 21:13:24 +00:00
paulberry@google.com 8d8ee25cff Merge analysis_testing package into analysis_server.
Note that analysis_server already contains a file test/mocks.dart, so
the mocks.dart file from analysis_testing has been imported as
test/mocks2.dart.  I will merge these two into a single file in a
future CL.

R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39814 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 18:11:42 +00:00
paulberry@google.com a239950909 Rename Error to RequestError in analysis server API.
Also, use the code-generated RequestError class in place of the old
handwritten RequestError class.

R=jwren@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39760 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-02 18:20:47 +00:00
paulberry@google.com 3123e48d29 In the analysis server API, change RequestError.code to an enum.
Some of the error codes that were previously defined are no longer
used, so those have been removed.  The enum reflects the set of errors
that are currently in use.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39689 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-29 07:30:43 +00:00
paulberry@google.com 0c0fd777a6 Finish modifying analysis server to make use of code generation.
Generated code is used to produce the response to these requests:
- analysis.updateOptions
- analysis.updateContent
- analysis.setSubscriptions
- analysis.setPriorityFiles
- analysis.setAnalysisRoots
- server.shutdown
- server.setSubscriptions

Generated code is used to produce these requests:
- server.shutdown
- server.getVersion
- server.shutdown
- server.connected

Generated code is used to produce these notifications:
- completion.results
- analysis.overrides
- analysis.outline
- analysis.occurrences

Generated code is used to decode these notifications:
- server.status

In addition, some dead code was removed, the 'protocol.dart' and
'protocol2.dart' files were combined, and the fields Response.result,
Request.params, and Notification.params were made private (to
encourage future use of the generated code).  Also, some overly
verbose import statements were cleaned up by using "hide" rather than
"show".

R=danrubel@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39516 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-25 10:48:16 +00:00
paulberry@google.com e18327f317 Make more use of generated code in analysis server.
The following generated classes are now used:
- CompletionRelevance
- CompletionSuggestion
- CompletionSuggestionKind
- ErrorFixes
- HighlightRegion
- HighlightRegionType
- HoverInformation
- LinkedEditGroup
- LinkedEditSuggestion
- LinkedEditSuggestionKind
- SourceChange

Generated code is used to produce these notifications:
- analysis.errors
- analysis.highlights
- analysis.navigation
- search.results
- server.error
- server.status

Generated code is used to produce the response to these requests:
- analysis.getErrors
- analysis.getHover
- edit.getAssists
- edit.getFixes
- server.getVersion

Generated code is used to handle these notifications in unit testing:
- analysis.highlights
- analysis.navigation

In addition, these methods have been removed, since they are no longer
needed:
- Notification.getParameter
- Result.setEmptyResult
- Result.setResult

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39511 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-24 08:39:41 +00:00
paulberry@google.com c5ff06636b Make more use of generated classes in analysis server.
Generated code is now used to process input JSON, and to create
requests and process responses in unit tests.  In addition, the
handwritten classes for ElementKind and SourceEdit have been replaced
with the gennerated versions.

Also some dead code has been removed.

R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39404 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 12:39:31 +00:00
paulberry@google.com c9b9b98343 Use generated classes to create requests in analysis server unit tests.
R=jwren@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39381 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-19 20:36:16 +00:00
paulberry@google.com 34699f46d5 Start using code-generated protocol classes in analysis server.
This updates the handlers for analysis.getErrors,
server.setSubscriptions, and analysis.setSubscriptions with simpler
versions that make use of the code-generated protocol classes, and
replaces the classes AnalysisError and AnalysisService with their
code-generated versions.

It also removes some dead code.

R=jwren@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39376 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-19 18:29:41 +00:00
paulberry@google.com 7226309842 Import analysis_services.dart into analysis_server.dart.
Having two separate packages doesn't really have any benefit, and has
the downside of forcing us to carefully avoid circular dependencies
between the two.  It makes more sense to just combine them.

This is largely a mechanical change consisting of the following renames:

1. pkg/analysis_services/lib/src/* -> pkg/analysis_server/lib/src/services/*
2. pkg/analysis_services/lib/* -> pkg/analysis_server/lib/src/services/*
3. pkg/analysis_services/test/* -> pkg/analysis_server/test/services/*

There were 4 instances where 1 and 2 created a collision:
.../services/correction/assist.dart, .../services/correction/fix.dart,
.../services/refactoring/refactoring.dart, and
.../services/search/search_engine_internal.dart.  To fix the
collision, the files coming from pkg/analysis_services/lib/src were
renamed to "..._internal.dart".

In addition, pkg/analysis_services/test/test_all.dart was modified to
call pkg/analysis_services/test/services/test_all.dart.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39349 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-18 20:17:49 +00:00
paulberry@google.com 5353760386 Change the type of Error.code from int to String.
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38940 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-06 18:44:13 +00:00
scheglov@google.com aba0cfa4e6 Remove any 'group' invocations enclosing 'runReflectiveTests'.
R=paulberry@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38547 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-24 18:08:45 +00:00
danrubel@google.com 256e11dd57 more progress implementing analysis server code completion
- add more properties returned by completion suggestion
- move completion suggestion into services
- move property constants into services for use by completion services
- move HasToJson into services for completion
- remove duplicate completion test

BUG=
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38418 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-21 02:04:49 +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 bf61f59c82 Extract testing utilities into a separate package.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38039 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 20:50:59 +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
scheglov@google.com bacedfcbc1 Migrate protocol_test.dart to reflective tests.
1. Drop static.
2. Replace @runTest with 'test_' method name prefix.
3. Drop direct setUp() invocation.
4. Format.
5. Sort.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37605 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 15:37:01 +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
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
scheglov@google.com fe26a39b8d Initial implementation for 'analysis.setSubscriptions' API.
Not quite all, and not as operations yet.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36834 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-30 21:02:28 +00:00
paulberry@google.com 206854b25e Fix remaining RequestDatum tests.
There were a few problems:

- An expression like "x is List<Foo>" doesn't guarantee that every
  element of x is of type Foo.  We need to check item by item.
  Similar for maps.

- InvalidParameterResponseMatcher was failing to account for the fact
  that the response gets wrapped in a RequestFailure object.

- Tests weren't calling setUp().

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36237 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 20:03:53 +00:00
danrubel@google.com 03aaf34742 add RequestDatum tests and fix some situations
BUG=
R=paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36217 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 11:55:26 +00:00
danrubel@google.com c263b483a7 allow client to specify any combination of add/modified/removed
BUG=
R=brianwilkerson@google.com, paulberry@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36216 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 11:49:21 +00:00
paulberry@google.com 839e807406 Leave "error" key out of response JSON when there is no error.
R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36169 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-14 15:04:31 +00:00
paulberry@google.com 451b5519cb Consistently type check analysis server request parameters.
Introduces a class RequestDatum, which wraps request parameters (or
components thereof) and provides type checking and coercion.
RequestDatum also provides an operator[] so that nested parameters can
be type checked and coerced at every level of nesting.

Previously, our checking and coercion was ad-hoc, and as a result some
parameters weren't type checked at all.

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35228 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-21 22:21:39 +00:00