Now that we have `defaultValue` against each argument, there was some redundancy here.
`isDefault` is redundant because if `hasArgument=false` it's always default, and if `hasArgument=true`, then `value` and `defaultValue` can be compared
When `hasArgument=false`, there's no value in duplicating `defaultValue` into `value`
Change-Id: I5cba055e56175565842efef815e08dd46e9ed36a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406621
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This adds a new field to the existing (legacy) setClientCapabilities parameters that accepts an LSP ClientCapabilities.
This will allow a legacy client to indicate that it supports things like the `workspace/applyEdit` reverse-request.
Change-Id: Ia3b75c701f1699c92f902e058daec4844ce664fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404106
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Parse errors for spec types were being reported twice - once by the containing object (in canParse()), and once by the nested canParse() call for the nested type.
This skips reporting the error for nested calls to a canParse() method, which will always report the error itself.
Change-Id: I03e4a9638fd6a3fc77eac918f6fd16def93327d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404105
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This moves completion resolution off `ElementLocation` onto the class recently created as `TypeHierarchyItemLocation`, which is now renamed to `ElementLocation2` and extracted to its own file.
Change-Id: I1f0b831ded7b08d6c09f97fcfd66f38f1dd4750e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
We take any `<tt>`-wrapped text, and keep it in some "monospaced" /
"teletype" format. For dartdoc we put it in backticks. For Javadoc
we put it in `<code></code>`, which looks standard for inline text.
This corrects some erroneous doc comment reference-looking text
(`offsets[i]`) which is not meant to be a doc comment.
Change-Id: I1d77a02368e3cde158ce95d3b0095ba09e071370
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This code generation was previously formatting generated files using the latest version. In 76feb10829 I re-ran the formatter to get the new formatting style.
However recently, a pre-submit hook to verify formatting was enabled and revealed that pkg:language_server_protocol still has an older SDK constraint, so the presubmit fails (if you modify these files).
There are two options:
1. Restore formatting to the previous version for pkg:language_server_protocol
2. Increase the SDK constraint for pkg:language_server_protocol
I picked the first for now, since analyzer_server_plugin also depends on pkg:language_server_protocol and currently has a constraint of 3.3, and I don't want to mess with that just to fix the format presubmit.
Change-Id: I2347577561e659825b444ef6622d646c6e513aea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401001
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This change is the final piece in enabling plugins in the new style to
be launched from a specification in analysis options.
Work towards https://github.com/dart-lang/sdk/issues/53402
* We support both one legacy analyzer plugin (the current max), and
a set of new analyzer plugins, which are combined and launched in one
shared plugin isolate.
* Make PluginLocator.pluginMap private.
* Add a parameter to PluginManager.addPluginToContextRoot:
isLegacyPlugin. This method is used for both legacy and new plugins,
but has slightly different behavior, finding where the plugin files
are.
Change-Id: I6644aecd4283eea22586ffd051a01b0ec8987fc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This adds basic editing for the argument types supported by `textDocument/editableArguments`. It doesn't currently attempt to format code currently (or use multiline/raw strings where they might be more appropriate), and does not allow arbitrary values that don't match the type for the parameter.
Change-Id: Ied95d95c0de39310aef0a1153864e902d56e1910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Some minor fixes/tweaks extracted from another CL
1. Fix tool/lsp_spec/codegen_dart to set `options` on `CodeStyleOptions` (a late field that needs to be set to the owning options file)
2. Fix a wrapped TODO to be indented so it's detected correctly
3. Move the custom `DartTextDocumentContentProviderHandler` handler into the `custom` folder
4. Merge `LspHandlerHelperMixin ` into `HandlerHelperMixin` since the APIs it uses are no longer LSP-specific and exist on the base server
Change-Id: Ie1b3a8057575346cf9bfb98465c0a3e330c28a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392909
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
In the upcoming LSP 3.18 spec, many types that were previously inline literal types with no names (that resulted in us auto-generating names) have been made real types with names.
In order to reduce the size of the change when LSP 3.18 arrives, this change renames some of our existing types to match the new names that they will get with LSP 3.18.
There are no functional changes here, I simple added the names to the rename list (removing any redundant values that were previously being renamed differently), regenerated the code, and then updated any remaining references (in non-generated code) to those types to match.
Change-Id: Ic556ce6e52ba94a8d42099371be18288230cd5ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389160
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This adds a new request `dart/connectToDtd` that lets a client pass a DTD URI to the server. The server will connect to DTD and provide a subset of LSP methods (those that are currently available over LSP-Over-Legacy, minus the `connectToDtd` method itself) to DTD clients.
This works for both LSP and Legacy servers, and the shared tests run against both (where for legacy, the `dart/connectToDtd` request uses the LSP-over-Legacy support).
This is not currently behind a flag, however it won't do much on its own because no clients will make this request. Once we're happy the functioanlity is good we can either agree an SDK version number for IDEs to gate calling this method on, or we can expose a flag in server capabilities (and some equiv for legacy) so the client knows the functionality is available.
Change-Id: I911d37745a1b2685249dd88e4b152c3196ba627c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379303
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
This change is just some refactoring and additional flags on handlers to reduce the size of a future CL that adds DTD support.
It:
- Slightly changes the meaning of `lspInitialized` in the server (to now mean the server is in the "initialized" state where it can handle the set of requests LSP allows after a server is initialized)
- Adds an additional future for `lspUninitialized` to track when the server moves _out_ of that state
- Removes an expando in LspOverLegacyHandler that tracked handlers against a server, because they're now available in the `lspInitialized` future (for DTD support, we need access to them without the LSP-over-Legacy handler, because we need to initialize DTD at startup regardless of whether a legacy client triggers LSP initialization)
- Adds a flag `requiresTrustedCaller` to handlers to indicate whether they can only be called by the native protocol clients. Tthis must be explicitly provided for shared handlers to ensure each choice is deliberate. The flag is unused in this CL but included here to reduce noise in the next (it touches many files)
- Changes the type of `toJson()` on generated enum clases to have the native type of the value that is returned
Change-Id: I0615cf4671b84887bf56c236d82d0fa3c26e6d87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379304
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Work towards https://github.com/dart-lang/sdk/issues/53402
I move them all out of static fields on FixProcessor to be instance
fields on a singleton class in a new file, fix_generators.dart. For
each one that ended in the word 'Map', I removed that.
I also move `_bulkFixableErrorCodes` and `canBulkFix` to
BulkFixProcessor, as it is the only caller, and holds onto the data.
I also correct some outdated doc comments.
I also make `_isFixableError` static.
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I01beccac4969f832941c75eb6d7b49b54a0b085c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377563
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>